I've had a few people ask me how to make an op2 AI player, so I finaly made some code to explain it. The following Codeblocks project should work compile fine if you have
set up your compiler and have the
op2extra expansion to the SDK.
Rar'dAIExample.rarSeparateExampleAI.cbpMain.cpp[size=8]Note: the rar'd version comes with the mission file already compiled.[/size]
To view the mission once it's compiled, go to the op2 main menu, hit 'd'. Then hit RUN_SCRIPT. Then find AiExample.dll on the list, select it and hit ok.
The AI in the mission can:
- Rebuild structures if it has power, a cc, a sf, ore, and a convec
- Build a new structure (a residence)
- Build tubes
- Build an army for defense
- Mine common ore
- Rebuild the common mine if it dies
- Repair all structures
- Rebuild all destroyed units
If you have any questions feel free to ask.