Support Forum

RTS Camera in a Minecraft-like World


I’m currently working on a game that has a very typical RTS camera (f.e. from Warcraft 3) where the player can navigate with the camera and at the same time command units to move somewhere, while not necessarily looking at them. This works fairly well in games with levels where the pathfinding can be calculated beforehand. But in my case, the world is procedurally generated, similar to Minecraft. In this, I see the problem that I would have an ever-expanding graph, as I can’t just deactivate or remove nodes when chunks are being loaded or unloaded (this currently depends on the position of the camera) as I need them to make the character move.

My current approach is to have a point for every tile which I add to a point graph as soon as that tile is discovered (this is done by the character moving, similar to a fog of war) to enable pathfinding. When tiles are unloaded I would only deactivate their visuals and other scripts but not remove their points from the point graph as even if I don’t see the tile I still might have to path over it as the camera could be at an entirely different location. I opted for the point graph as some tiles could have vastly different locations and because they’d be able to handle heights as well (players could be walking on ramps), unlike the grid graph (although it’s procedural mover looks very good but still not useful in my case because of the camera).

My question would therefore be if this is an adequate solution for my problem or if there is something that I am missing, my biggest concern is that I’ll end a with a huge point graph during a session taking all the memory and making it slower to find a path due to its size.


I would recommend a layered grid graph instead of a point graph if at all possible. It will generally be faster.
If you cannot use that for some reason, then your approach is probably the best one. But it will not have excellent runtime characteristics as the world gets larger, since point graphs do not scale that well.

1 Like