Author Topic: Fully Functional Ai  (Read 2607 times)

Offline Mcshay

  • Administrator
  • Sr. Member
  • *****
  • Posts: 404
Fully Functional Ai
« 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 and have the op2extra expansion to the SDK.

Rar'd
AIExample.rar

Separate
ExampleAI.cbp
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.
« Last Edit: December 04, 2007, 04:39:11 PM by Mcshay »