I have a project to make a real-time strategy game from scratch. I am still at the early planning stage, but I have been programming a little to see the mechanics.
I know how to program. I also have a good idea of how I will structure the game classes and the Rule-Based (state-machine) AI for the computer player.
I want to develop Doctrines, which will give a specific behavior to a specific unit (but can be used on many units at the same time), such as Scout, Follow Mission Route, hold Position (attack any approching enemy or retreat if overwhelmed), etc...
The doctrines will only apply to the units, so it will have a unit perspective, and not be aware on the whole map sitatuation.
The Computer AI will analyse the entire visible map and decide on which soctrine to assign each unit depending on another set of rules.
I am doing this in C# with OpenGL.
For now, I don't have much, only a few things in tests before I begin my main conception. I have a game loop where all the game processing (where I will call the update mouvement, combat, rendering, etc, one after the other) will happen, it is called very often if the Application.Idle event.
Now, I was wondering. Since there will be a lot of things to process in the gameloop, should the Computer AI and the Units select their actions in that loop or will it be too slow?
If I want all things to be simultaneous, Should I create a separate Thread for the computer AI? Or even a separate thread for every unit?
I don't have much experience with multi-threading. What would be the best approach for this?