Posted 23 October 2007 - 03:47 AM
Well, I want to know how I can implement AI for a text based game or any kind of game. Even for an RTS I heard it'll be very hard to accomplish.
I need some kind of guides, tutorials or just something that can help me out with this.
~ Tyler Moyer
Posted 23 October 2007 - 12:44 PM
initialize everything. event loop: draw / display (world, objects, etc). take input (mouse, keyboard, etc). apply AI to objects. repeat loop (implicit).
Exactly how you use / apply AI depends on the kind of game you're creating but the high level flow above can be applied.
hope that helps.
Posted 24 October 2007 - 12:27 AM
Posted 24 October 2007 - 12:29 AM
Posted 24 October 2007 - 03:40 AM
Posted 24 October 2007 - 05:00 AM
What kind of RTS are you making? I presume that your RTS would be adversarial. If so, (and as a proof of concept) you want to break your "CPU" player to engage in at least 4 phases or you can have the CPU player organize its units to be cycle thru 4 states.
For the 4 phases, you can have your CPU player be Defensive (guards its base), Offensive (attacks the other players on the map), Resource collector or Discovery (sends scouts to discover enemy locations).
The states are similar to the phases.
1. Discovery state - your CPU player will have a unit or a group that will choose a random point on the map and see if there's an enemy in the radius of that location.
2. Defensive state - your CPU player will have a unit or group defend other units, groups or structures. This is synonymous with a attack-but-don't-follow "rule". If an enemy unit or group is within attack range of the CPU unit or group, the CPU unit or group will attack.
3. Offensive state - your CPU player will have a unit or group attack an enemy unit or group until death.
4. Resource gathering state - unit or group will gather resources that can be used to purchase materials or whatever you want.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users