Tiles and regions (#16, #17)

The map is split into small tiles and regions. See a JavaScript demo.


Tiles and regions. I often debug my code using visual aids.

The idea is that each entity can occupy a tile and can exist in one of the region. This means less CPU needed to process logic because instead of looping through all objects to check collisions you only loop through the ones from one specific region (that you care at that point in time).

On right: the array of 0s and 1s represent the collision tiles.

Here are the full video logs:




© 2017-2020 Gali Interactive

Terms and conditions | Privacy Policy | Code of Conduct | Contact