Train Locomotive AI

Hello, everyone. So I just got the free version today and was wondering if there was a specific way I could go about creating a train/locomotive AI. Now, I’m not new to Unity or game development, but I am new to this project. For starters, let’s break down this question into parts. First things first, how can I keep the train on the railroad tracks? I’d appreciate all the help and any advice I can get on this subject. Please and thank you!

– Brandon


For a train/locomotive AI, I would actually recommend you to not use this package. It is definitely possible to do so, but I suspect that the benefit would be small compared to the learning curve. The reason is that you are describing a very atypical use case which would require a custom graph type (or possibly use the point graph with some custom code) and a custom movement script. It is definitely possible to do that, but I think it might be faster for you to use a simple Dijkstra or BFS, the code for which can easily be found on the internet. I suspect that you will not need very high performance from your pathfinding because railroad graphs are usually pretty sparse and relatively small, so a simple search will work just as well.

1 Like