Sunday, January 5, 2014

Callback Grid

Currently working on a "callback grid" that is basically a grid that overlays a tilemap.
We check to see when sprites occupy and exit the grid and call functions that take the tileX and tileY location of that
cell within the grid.

Intended usage:
A de-coupled system that can work with my lighting system to toggle on and off directional indicators around bombs in the game.

Design complication:
Should I keep track of which objects occupy certain grid space? Or should I simply know that the grid space is being
occupied by something?

Arguments:
Occupied by something:
1. Easier to program.
2. More straight forward with intended use. Any NPC or player can trigger helper indicators.

Occupied by specific object:
1. more complex
2. could use callbacks that take specific object as input.
3. How I would go about programming it is a bit more ambigious.
   What do I do when two objects occupy a cell, and the only ONE of them leaves that cell?

Thought:
I think I want to go with "Occupied by something" route.
It works for what I need NOW not what I MIGHT need in the future.
The design for it is more clear in my head (less abstract).
Overall... Just seems like less of a headache to code.

On another note: This game looks pretty cool. I should keep track of it.

http://playstarbound.com/media/

No comments:

Post a Comment