So I’m quite new to the A* Pathfinding Project, but would like to use it for a game of mine. I have some questions but don’t want to blast a reader with “how do I make this game”? So instead I’m going to quickly outline my goal, list out the questions, and then give my best idea as to what the answers would be. If anyone has tips, or a better idea as to how to solve any of these, I’d greatly appreciate hearing them.
My current plan is to put together a top down 2D RTS, similar in gameplay to the Pikmin series.
Here’s a visual reference: https://www.youtube.com/watch?v=Sf7kUedUiWY&ab_channel=IGN
Basically, there will be lots of little units either following a player controlled character or performing tasks throughout a moderately large 2D map. These units will need to path around level geometry when following the player character, and will need to path back “home” when carrying objects.
The player character is controllable through the gamepad, but can be instructed to move to a specific location. Control will be “taken” from the player and the character will then path-find to the selected position.
So here are my questions:
- Given the need for a large, moderately complex 2D level, which graph type would be best?
- How do I directly control the player through the gamepad?
- How would I implement different hazards/routes that different unit types would know to avoid/use? For example, water that Blue Pikmin can cross, but others will attempt to avoid.
And here are my best guesses:
- I would assume that a recast graph is optimal given the needed size of these levels. I am aware that a 2D recast graph will be available in the next beta release.
- I tried using AIPath.Move and then FinalizeMovement to control the player character, but even with “constrainInsideGraph” set to true, it was moving off the graph. I was using a GridGraph in this scenario, so maybe something was wrong there? I’ve read that using an RVOController might be the best way to handle direct movement? The player doesn’t really need object avoidance. They just need to be properly constrained to the graph 24/7.
- I would assume that generating different graphs for different units would be the best option here? In the Blue Pikmin example, I just generate a version of the map where the water DOESN’T cut a section of the graph.
Again If anyone has better solutions, I’d love to hear them. Thanks.