• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Design Tile based gameplay

L

Leanthor

Guest
I'm a total amateur and for my first large project I've been working on a tactics style turn based strategy game.

I'm kind of at a loss on how to handle tiles, I prototyped drawing rays from the character to change the instance of tile objects to movable tiles for movement, but I don't think that's going to work when I start to include enemies and tile modifiers. Any ideas on how to pseudocode this? Is there some sort of approach to tile based game construction that I'm not realizing?
 

Attachments

JackTurbo

Member
Raycasting isn't gonna be the most reliable way of doing things on a grid in my experience.

Have you decided on how you're pathfinding yet? - this will likely dictate how you handle a lot of other movement related things.
 
L

Leanthor

Guest
Raycasting isn't gonna be the most reliable way of doing things on a grid in my experience.

Have you decided on how you're pathfinding yet? - this will likely dictate how you handle a lot of other movement related things.
A suggestion from another person I was talking with is to iterate through every tile adjacent to the unit and assign a cost based on weights. Then do the same for tiles just checked, adding the previous cost. If a tile can be reached from 2 tiles, pick the one with the lower cost. Before iterating, walls and enemy units are removed from the available tiles.
 

JackTurbo

Member
I'd suggest taking a look at Sgt Indie's tutorial series. Its really good and explains a whole bunch in depth. He uses an object based grid, that I would caution does have a big performance overhead. It should be worth a watch though to see how he tackles these issues.

His A* implementation is pretty similar to the approach you mentioned.

 
L

Leanthor

Guest
I'd suggest taking a look at Sgt Indie's tutorial series. Its really good and explains a whole bunch in depth. He uses an object based grid, that I would caution does have a big performance overhead. It should be worth a watch though to see how he tackles these issues.

His A* implementation is pretty similar to the approach you mentioned.

Wow, this is exactly the kind of example I've been looking for, thank you so much!
 

Yal

šŸ§ *penguin noises*
GMC Elder
This is probably covered in that example, but I'd say the idea is to have a ds_queue (a FIFO data structure) and a list of visited cells. For every neighboring non-visited cell, pass on the current movement 'currency' and put it in the queue and the visited list. Until the queue is empty: get the cell. Mark it as an OK movement cell if it's not obstructed. For every neighboring cell to this cell, if it's not visited and the movement cost < movement currency, put it in the queue and in the visited list with currency-moveCost currency. Repeat until the queue is empty.

I've got some pointers for ideas to handle enemy AI if you're interested (I made a tactics game for a summer-long jam a few years ago), there were a whole bunch of things to consider and I ended up having to cut some corners to get the AI turns to not freeze the computer for several seconds :p
 
Top