Learning To Swim

Blamdodge was made, mostly, so I could learn Object Pooling.

Object pooling is about re-using objects in a game, instead of creating and destroying them, to save on memory and processing. Especially useful for running a game in a browser.

In the usual case: When we create, say, an enemy, our game will ask firefox to give some memory to store an enemy in. Then when we Destroy() the enemy, we have to clear that memory. This is not a very quick process. This is not an issue with a small amount of objects. But could be if we're doing it for, let's say, firing hundreds of bullets from a spaceship for example.

With Object Pooling, we create all the bullets we need in advance, and re-use them. This way we only need x amount of memory at any time. In Blamdodge, we create 30 enemies as soon as the game is started. Then we set them all to inactive. When we create an enemy, we look for the next inactive enemy and set it to active, then move it to a spawn point! When a player kills that enemy, we set it to inactive again. This also happens for the bullets and particles. We're reusing as much as we can, to help the game run better on browsers.

Boring notes for boring subjects!

Get BLAMDODGE - LowRezJam2017

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.