CRI ADX  Last Updated: 2024-07-17 10:47 p
Outputting game data (ACF, ACB)

In this tutorial, we use the project created in the Creating a project and registering Waveform file to a Cue tutorial, and write a Script to create game data( ACF File and ACB File ).

This tutorial will use the project created by Creating a project and registering Waveform file to a Cue tutorial.
Before starting this tutorial, if this project is not open, please open the project or execute the Script created in the Creating a project and registering Waveform file to a Cue tutorial.

Preparing a Script file

Select "Script list..." in the Script menu to display the Script list window.
Click the New button in the Script list window to create a Script file with the name below:

Save location of Script Script file name
tutorials [CRI] tutorial04-1_build_acb.py

Script Description

Double-click the created Script to open by Run the Script from the Script Editor .
In order to get an overview of the Script in the Script list window, write the Script description as follows:

# --Description:[Tutorial]Outputting game data(ACF, ACB)


Importing Module

Once you have written the Script description, import the following modules to work with CRI Atom Craft in your Script.

import cri.atomcraft.project as acproject
import cri.atomcraft.build as acbuild

In addition to the Project Module that manipulates the project data of CRI Atom Craft, import Build Module that creates the game data.
In CRI Atom Craft, we call this game data as "build".

Getting the information needed for build

The following object is required to build the Cue Sheet and create the ACB file.

  • Cue Sheet
  • Target config: Platform settings as the output destination
  • Language Setting : Localization Settings(optional)

Below will describe the information required to build the Script.

Getting a Cue Sheet

As with the Editing and previewing parameters tutorial, get the Work Unit and then get the Cue Sheet in this Work Unit.

# Get a Work Unit
workunit = acproject.get_workunit("WorkUnit_Tutorial")["data"]
# Get a Cue Sheet root folder
cuesheet_rootfolder = acproject.get_cuesheet_rootfolder(workunit)["data"]
# Get a Cue Sheet folder "WorkUnit_Tutorial"
cuesheet_folder = acproject.get_child_object(cuesheet_rootfolder, "CueSheetFolder", "WorkUnit_Tutorial")["data"]
# Get a Cue Sheet
cuesheet = acproject.get_child_object(cuesheet_folder, "CueSheet", "Tutorial")["data"]

Getting target config

The target config is an object that manages the build settings of the platform, and is managed by Global settings.
Use the following function to get the target config folder from Global settings.

Function name Description
get_global_folder Gets each object folder directly under the Global Settings folder

Write a Script to get Target config as follows:

# Getting target config folder
target_config_folder = acproject.get_global_folder("TargetConfigFolder")["data"]
# Getting PC target config
target_config_pc = acproject.get_child_object(target_config_folder, "TargetConfigPc", "PC")["data"]

Description of getting target config

To get each object managed in the Global Settings , use the get_global_folder function to get the object folder from Global settings.
Specify the "folder type of the object" in the get_global_folder function.
Once you have an object folder, use the get_child_object function to get the target Target Config.

Getting Language settings

You need to specify the Language settings for the data build for localization. However, it is not used in this tutorial.
Language settings and target config are both managed by Global settings.
To get the language settings, follow the same method as the target config - use the get_global_folder function to get the Language settings folder. Then in this obtained folder, use the get_child_object function to get the target Language settings.

Building the game data

The obtained "Cue Sheet" and "Target config" information are required for building.
In the Build Module function, use the following function to build a Cue Sheet.

Function name Description
build_cuesheet Build the specified Cue Sheet

Write a Script to build the Cue Sheet as follows:

print("Start the build of CueSheet "Tutorial"")
result = acbuild.build_cuesheet(cuesheet, target_config_pc, None)
if result["succeed"]:
print("Completed the CueSheet "Tutorial" build.")
else:
print("Failed to build the CueSheet "Tutorial".")

Description of building Cue Sheet

Use the build_cuesheet function to build the game data.
In the build_cuesheet function, specify the "Cue Sheet information", "Target config information" and "Language settings information"(optional. Specify "None" if omitted).
When executing the function, it will build the specified Cue Sheet and at the same time, build the Global settings to create ACF files.
The return value of the function is whether the build is successful. It is stored in the "result" variable and use as the conditions for log output.

Saving and running the Script

This concludes the scripting portion of this tutorial.
Save and run the Script.
If the build is successful, it will output a log called "Build of CueSheet "Tutorial" is completed.", and outputs the ACF file and ACB file in the "PC" target folder (same hierarchy as project file).