game-dev

Manage data by black magic

In the past month, I found it is hard to manage data for the wide variety of  Entity. Although Unity already provides resource manage system, but it is not designed to handle object data. Components in ECS usually use a reference id to access resources or other components, so the data management tool should consider reference id as resource. Here is a list of features that tool should have:

  1. Can define schema to ensure data type ( make sure a field is Int / String… )
  2. Can assign an unique id to an instance of data
  3. Instance data in other table ( or collection ) can use unique id as reference
  4. When modify unique id, all reference will auto update their naming
  5. Data storage format should be Json ( or XML, YAML… ) in single file

Turns out, there is a good implement in the wild: CastleDB

CastleDB.PNG
Za use case!

AFAIK, It was created for Evoland 2 and recently used by Dead Cells. The CastleDB use  Excel like tables to manage sheet, columns in each sheet defined by name and type. After save data as json file, we can use Haxe to load json as objects. Here comes the dark magic:

As you define columns in CastleDB, Haxe can treat table column as object property to create a class then load Json as an object instance.

So now I can shape any kind POD ( or POJO / Bean, whatever ) through GUI editor for any Resource / Component / Entity data I want! I guess AAA team will develop their own data manage system, but something like CastleDB is the answer for small team. The only thing left is a fun question :

what.jpg
What!?