Port a Unity Game to Your Own Engine: Part 18.1
A concrete look into a data-oriented approach to engine development.
Bug fix
Quick patch to export_bin script so extra unnecessary data segments aren’t written to the file.
Build enemy_instances
Create schema for enemy_instances so binary data, c header, etc. can be built from command line.
Build enemy_instances_update
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.
Add game_state
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.
Next: Port a Unity Game to Your Own Engine: Part 19
Links to files below for paid subscribers.