Hi all,
I have a pretty simple turn based game I am trying to implement, but before diving to far I am investigating the techniques and problems I could run into. Essentially playing it out on paper so I can domain model it before jumping on a keyboard.
My grid has a specific size of 11x7. There are NO obstacles. To move one square in any direction will cost 1.
In one turn I can choose to move 1 or 3 squares on the grid.
1 is easy.
I can just expose the current tiles neighbours as possible destinations.
If I am at [0,0]
If I move 3 spots, I could in theory move to
[0,3], [3,0], [1,2], [2,1]
My understanding of pathfinding is
- Here is my source (0,0)
- Here is my destination (1,2)
- do the pathfinding thing and ‘Highlight’ the path (dijkstra’s algorithm, or should I just use something simpler?)
- click to move
I am unsure because I have no obstacles, and no varied movement costs, so will pathfinding always highlight the desired path? I feel like I could plot the paths instead as I already know how to get there? eg (0,0) to (1,2) would save me a list of the tiles (0,0), (1,0), (1,1), (1,2)
The next step is detecting enemies, but thats a separate conversation.
Thoughts anyone?
Well, you will still probably have enemies and friends on the board, so it’s not a simple move to here kind of thing is it? Otherwise, then you probably don’t need path finding. But if there is anything you need to walk around, you need path finding. Granted, it won’t be working very hard and you can use a simplified version.
This guy has an interesting series on Astar path finding:
The more I think about it, the more pathfinding is just not needed. I already know my predefined paths. The tilemap is the same for every game, and it’s a small sports game. Im unpacking how Football, Tactics & Glory on Steam works during gameplay as a base for mine.
A couple of minutes on the main gameplay will give you a good idea :
Ignoring the management side of any given sport, I am focusing on purely the gameday experience at this point.
Any thoughts to why they might need pathfinding?
Even if an opposition player is on a predefined path where I might pass a ball, I can know that by simply checking their position and running it against my small set of predetermined path positions. Knowing this allows me to present some level of chance the pass might be intercepted etc. It’s a very state driven experience.
I don’t think you would need it. You could always use navmesh if you are worried about players going around each other and it would probably look more natural, or use a raycast because you might be using that for the ball. Anyway, it’s not like you can’t add it later if you feel you need it. The tiles would just be nodes, but the player would always be walking on a empty tile so he kind of takes a funny looking path sometimes with path finding.