Draw() or Update()? Where does the AI go?

Hi guys. First, I can’t thank the MonoGame community enough for helping me out. Thanks to you guys, my game will be in beta this year.

Most of the AI for my game is written and tested (in other programs) and exists as a DLL linked to my MonoGame solution. The question is: where should I call it? From Draw() or Update()? It’s my understanding that the game loop in Monogame goes Update → Draw → Update → Draw. So, where’s the best place to make the call to the AI?
Thanks!

usually in Update where you decide to update everything in game, I put the AI part in another thread so it can run in parallel in another thread/core if possible so the game will not slow down, but if not resource intensive you can put in Update.

First off, exciting news about your game going into beta!

As for the question, AI should definitely go in Update(). Draw calls will not be ran as frequently if the game lags, so putting AI in there would not be a good idea since if the game were to start lagging, the AI would also lag, but the rest of the game logic could continue to run as normal. This could lead to some problems…

Hope this helped :slight_smile: