I am starting development on a game similar to the mobile game, Egg Inc. I plan on having the player press a button and it spawns in a character that walks to one of four buildings, and disappears when they reach the building.
I haven’t started on the development of the feature yet, but I already can tell there will be performance problems if there are a large quantity of characters being moved at once. As the player will be able to spawn a large amount of agents and have them move to one of the buildings at random.
The question I wanted to ask is, is there a way for me to optimize this so that there isn’t lag for the player, or performance issues? as I can already tell that the large amount of pathfinding calculations going on at once would cause problems, especially because the game will have multiple players at once, each running their own farm that will be spawning these agents.
The characters that will be moving will also have clothing and accessories on which might also cause problems with rendering due to higher poly counts as there are a lot of items being moved at once.
I don’t have much expertise in this field, but I think having pre-set paths if possible if the best way to go if your map doesn’t dynamically change.
If a user is able to place buildings, you may be able to use an A-Star algorithm to generate nodes and reuse those nodes for every AI until the user places another building, which would incur the nodes to be regenerated.
The map wont change, the look of the building will change but not the actual position of the building. So I could just hard code all of the paths, and then make the characters move to the paths that they have?
So if there is four buildings, just program the positions of the paths and then tween the cframe of the characters to move to the positions depending on the building that they are going to?