If I were to do it all over again from scratch, I would definitely do something like this. Especially with what I've learned while making this project. However at this point I think the problem is too deeply embedded and would take a full rebuild to fix. Which I don't have the motivation for right now.Cherno wrote:When I write a system that has the A.I. and the player be able to control the same kinds of vehicles, I commonly code the vehicles to have a generic pilot variable, which is a reference to any actor. In the vehicle functionality, I would then check if the pilot inherits from PlayerPawn or not (which would indicate a monster/A.I.). Giving commands / controlling the vehicle would need some duplication because it has to be part of the player pawn class as well as the monster pilot classes. However, this can be minimized by writing the code in such a way that players and monsters only give general commands to the vehicle, like changing it's movement direction and angle, and the vehicle itself would read these changes on it's own side.
To clarify: The vehicle has no mind of it's own, it ist just an empty shell that can be used by players and the A.I. in the same way.
There are a lot of things I would have done differently in hindsight. It might just be a case of me pushing through and filing this under "lessons learned".