Here it is, folks, fresh from the oven. This was a very simple test that throws a lot of logs on the fire all at once.

We start by defining some variables, and then create our ds_map. This is going to be THE Universe, what we collect everything into and save. This isn’t game state, but rather the procedurally generated universe that we’ll use as a template for the game.

Next we create a ds_grid. In the web version of the trading game, I’m actually making a grid to assign star systems to, because calculating movement between grid spaces is stupidly easy. Here, I have an actual grid data storage option. This will be 10×10, so we set up the grid and then loop through the X and Y.

With each coordinate we sub out the actual creation of a “star system” to a script-function called “scr_big_bang”. All this is doing right now is taking 4 args for the key, the system name, and the defined X and Y values. We’re creating a new ds_map in this script-function, and are just layering on properties for each data point that makes up a star system. We return this map to the caller.

The caller places the returned map into the X,Y data bucket, and we keep doing that until we’ve covered all 10×10 data spaces. Finally, we save the file to the sandbox file system area, and then destroy the grid. Oh! I forgot to stringify the grid when saving it to the top-level map. I’ll fix that for future tests.

I ran this through the debugger, and wouldn’t you know it! Everything appeared as expected. The worst part about this was trying to coerce the X and Y values into strings so I could concatenate them into keys and names for the star systems.

Sound off!

This site uses Akismet to reduce spam. Learn how your comment data is processed.