Games Practical Project Development Blog - Week #7

Finally, seven weeks in and plenty of research and testing later, we have Cellular Automata starting to be implemented! The first pass has been completed, creating a grid based on the numbers placed into the x and y, and a randomly placing wall and floor grids.

Here we have an example of the level building randomly at run time, running from a single blueprint placed in the level. Making use of floor and wall cells children from a Master cell set up, and using some tweaked rules from Cellular Automata (altering the likelyhood of walls spawning compared to floors), and marking the cells x and y locations.

In order for the level to generate, you need to set the x and y of the grid, setting up the length and height

The function that sets up the physical portion of the grid, actually spawning in the children of the master cell, Floor cells and Wall Cells, filling out the grid between the x and y to produce the entire level


Getting this to generate through blueprinting, and keep the fps in a playable area/avoid a massive lag spike during the initial generation was a challenge, alongside this being my first time setting up the maths for a grid system. The theory behind the grid was pretty simple to get set up, however I wanted the grids centre to be directly on top of the billboard in the blueprint, so I knew where things would spawn and expand out from in the level. This was much simpler than I thought it would be, and I spent more time than I'd like to admit messing around with different ways to do this before the penny dropped, and I just halved the x and y, removed the result from the x and y, and had that as the negative side of the level, making the initial spot 0, 0. I also had to make sure that the outer cells all needed to be walls, to ensure there wasn't an opening in the level for the player to escape. To do this I checked the min and max x & y positions during the for loops, and if the current cell was along any of these axis, I would force a wall to spawn.

The blueprint holding all of this logic runs a series of functions at beginplay, to set up the layout of the level once the level is loaded, with some logic in place to place the player on a floor cell after the level is generated prepared for when the generation is developed further.

With this great success under my belt, it was finally time to flood my game with some audio, having been deafeningly silent before this point. Thanks to my friend @_SashaSolomon for coming across this great music pack being shared on YouTube for the use of "video games and other audiovisual projects". After giving it a listen, I knew it would be perfect for the setting and atmospheres I had envisioned, and downloaded it right away.



Comments