Don't Walk By - 15

Don't Walk By - 15

May 1, 2020. | By: Evan Diamond
1 min

The fifteenth CGD blog post about Don’t Walk By

Overview

This week I integrated the levels pawn count into the pawn manager and reworked the point of interest system.

Pawn count integration

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.

Point of interest (POI) rework

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.

About

Gamers developing new games.

Social Links

Our Bunker

University of the West of England,
Frenchay Campus, Bristol, BS16 1QY,
United Kingdom.