1 min
The fifteenth CGD blog post about Don’t Walk By
This week I integrated the levels pawn count into the pawn manager and reworked the point of interest system.
The level editor now has a slider for how many pawns should be in the level. This integration consisted of taking this value stored in a level’s metadata and setting the max spawn count in the pawn manager script to that value.
The original point of interest system I implemented was not efficient. Originally a random POI was found using a very large for loop (1000000 iterations) where a random poi was found each iteration. If the POI satisfied the conditions of not being the POI the pawn was currently at and wasn’t at it’s maximum number of pawns then the loop would end otherwise it would keep looping. The for loop was used instead of while loop so that eventually if no applicable POI was found then the loop would end and the first POI would be used. If a while loop was used then it would lock up the hole game. However there have been levels with very few POIs or a lot of pawns which caused this loop to run for 1000000 iterations which still locked up the game for a while.
I changed this system entirely to one where when a pawn needed a POI a list of applicable POIs would be made. Then a random POI would be selected from the list. If the list was empty then the pawn would stay at the POI they were currently at.
Subscribe to this blog via RSS.
C++ 30
Directx12 11
Mario kart 11
Commercial games development 15
Unity 15
Low-level programming (19) C++ (30) Text based adventure (5) Ex-machina (9) Game engine programming (11) Directx12 (11) Mario kart (11) Land of gold (5) Audio visual production (1) Commercial games development (15) Unity (15) Don't walk by (15)