Generating Source Code
The process of generating source code allows game data to be used inside a game. This process involves specifying the language (e.g. C#) and various generation parameters/optimizations. It can be done from both the project’s dashboard user interface and the command-line interface (CLI).
Feature |
C# |
TypeScript |
C++ (UE) |
Haxe |
---|---|---|---|---|
JSON Format |
x |
x |
x |
x |
MessagePack Format |
x |
x |
x |
x |
Language Switch |
x |
x |
x |
x |
Patching |
x |
x |
x |
x |
Formulas |
x |
x |
||
By Unique Value Indexing |
x |
x |
Using Project’s Dashboard UI
To generate source code from the dashboard, follow these steps:
Go to the dashboard of the project where you want to generate source code.
Click on the Generate Source Code button.
Choose the language you want to generate the source code in.
Specify any generation parameters required.
Click on the Generate button to initiate the process.
Download archive file with generated source code.
Using Command-Line Interface (CLI)
To generate source code from the CLI, follow these steps:
Open the command-line interface.
Navigate to the game data’s directory.
Use the
GENERATE <SOURCECODE>
command to generate the source code, specifying the target language and any generation parameters require.
Example
Charon.exe GENERATE CSHARPCODE --dataBase "c:\my app\gamedata.json" --namespace "MyGame.Parameters" --outputDirectory "c:\my app\scripts"
Use the
--outputDirectory
parameter to specify the location where generated files will be saved.Use the
--namespace
and--gameDataClassName
parameters to adjust the signature of generated classes.Use the
--splitFiles
parameter to generate multiple files instead of one large one.Use the
--clearOutputDirectory
parameter to clear the output directory from generated files when re-generating source code.
Once the process is complete, the generated source code will be available at --outputDirectory
.
See also
Working with Source Code (Haxe)