Luke Haslett's Portfolio
After my successful test in random level generation, I began setting up my core project using a top down template as this fits well with the gameplay characteristics I have in mind.
I started by building a standard initialisation chain to organise the order in which the engine constructs my managers, character, controller, spawn system, etc. I also replicated the scripts I’d written for building maps.
Something I noticed though was that when I was capping off the open ends of the map with custom “Room End” pieces, I was utilising a similar logic system as the normal map generation. This logic being: “Check to see if the collision boxes from the room class return true. If so, destroy the room tile, remove the spawn point, and run back through the whole event”. Except I had forgotten to put the spawn point removal in. No worries, I thought, I’ll just drop it now. But then I was curious to see how much of a difference something that small could have on a project. So I ran some numbers.
I printed an integer to the screen that incremented each time the event ran until it finished capping off the map. I did this with a 10 room map, and recorded it 10 times without the spawn point removal, and then again with it. This was my result:
Using simple math, we can see that the average before is 18.5, and after is 8.9. Meaning the engine runs through the event 51.89% less, which is an incredible amount in itself.
So, naturally, I repeated the test for different room sizes:
Now we can see that for 20 rooms, the percentage decrease is 52.97%, 30 rooms is 53.2%, 40 rooms is 51.86%, and 50 rooms is 49.26%. Making our total average 51.84%.
This is a really interesting statistic, and even though the scope and scale of my project isn’t very large, for a project in triple-A development this is a good example of how important it is to script efficiently and micro-manage with small modifications like this. Otherwise, the more you overlook your code, the more instances like this stack up and can negatively impact the game, as well as the user’s experience.