Hello,
when I have an ECS system, where the entities are only ids, the components PODs and the systems (in my case managers, because systems are low level) have all the logic.
How can I implement Pathfinding. My thought is, that I have a component PathfindingComponent, where some points are defined, where the vehicle (as example) can drive. That means, if I have a straight street, I have 2 points, the begin and the end of the street piece, in my PathfindingComponent.
If a street is added to the scene, my PathfindingManager will be notified, and see there is a component, and add the point from the component to his store. Now the AI comes in say, the vehicle have to drive to a specified street tile, and add a new waypoint (the entity id) to the WaypointComponent of the vehicle. The pathfinding now knows, where to drive an can look for a path.
Is this ok? Are there any errors in my thinking?
One problem occurs I think: What if I have a street tile which has parking slots. One for a bus and 4 for cars. These 5 points are also in the pathfinding system, but now, the AI cannot say, drive to the street tile with the entity id, the AI have to say where exactly on the street tile. How can this be solved? Are the parking slots saved in an array in another component, or should the AI exactly say where to drive?
I hope it is clear, what I mean, if not, ask and I will try to describe it better.
Dominik