Trading Game Dev Diary #3

Refactored the whole Create Event for the main game object controller. Reduced the code within the event from > 200 lines to 15. Everything is now in script modules with INIT functions. Every module adds struct data to the global state.

Main Game Object Create Event + Script / Object list in IDE

I also added a players / player module which holds all players (the actual player + AI players). The “add”-functions creates new player structs from a constructor. Every player struct gets an UUID, generated by system data + timestamps. Functions tests this UUID against those already in the registry (“_regs”, another new module to keep track of UUIDs and stuff). If UUID already exists, new one gets generated.

I was really happy that I just had to remove one line from the market buy code to get things working. Thanks to the fact that structs get assigned as references to variables.

The player struct init function.