Outpost Universe Forums

Projects & Development => Outpost 2 Programming & Development => Topic started by: Mcshay on October 08, 2006, 07:05:59 PM

Title: Fully Functional Ai
Post by: Mcshay on October 08, 2006, 07:05:59 PM
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 (http://wiki.outpostuniverse.net/Compiler_Setup) and have the op2extra expansion to the SDK (http://wiki.outpostuniverse.net/Op2extra).

Rar'd
AIExample.rar (http://users.outpostuniverse.net/mcshay/Coding/AIExample/AIExample.rar)

Separate
ExampleAI.cbp (http://users.outpostuniverse.net/mcshay/Coding/AIExample/ExampleAI.cbp)
Main.cpp (http://users.outpostuniverse.net/mcshay/Coding/AIExample/Main.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.