Port a Unity Game to Your Own Engine: Part 18.1
A concrete look into a data-oriented approach to engine development.
Quick patch to export_bin script so extra unnecessary data segments aren’t written to the file.
Create schema for enemy_instances so binary data, c header, etc. can be built from command line.
Create schema for enemy_instances_update and enemy_instances_draw. Fix up Makefile. Left at the end with a bug to fix in next part.
Byte pack structures
Binary export doesn’t do standard C structure packing so for now, add an attribute to the C header output for byte packed structures. Todo: Sort out the packing question.
Wrap up this clean up phase by bundling the common game variables into a game_state structure. Now everything that any system accesses needs to be fully declared in the schema file. Introduce a data rule here: A system can only write to its own data (Root, as defined in the context) - every other dependency must be read-only.
Links to files below for paid subscribers.
AltDevArts is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.