Hey, I am right now in design phase of my text based RTS with Visual C# 2005 Express Edition. Also, make sure it's for C# 2.0, Not 3.0.
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
In short, you would incorporate your AI into your event loop like so:
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.
Not quite.. I have no idea on how to do this A.I. I need some more details than that.
Could you provide more details about what kind of AI you want?
Like, an RTS game. I am desiging an text based RTS game using C# and building it as a WindowsApplication.
That doesn't explain the kind of AI you want. The above post was a pseudo high-level algorithm of how you would implement it.
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.
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.
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.
Offensive state - your CPU player will have a unit or group attack an enemy unit or group until death.
Resource gathering state - unit or group will gather resources that can be used to purchase materials or whatever you want.