Artificial Intellengence

B22e9f99a9b9899794f5e8663a57c038
0
GameEngine_Designer 101 Oct 23, 2007 at 03:47

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.

Thanks

\~ Tyler Moyer

5 Replies

Please log in or register to post a reply.

C24eb7e6aaefba78b94c831ddc7b4d0b
0
donBerto 101 Oct 23, 2007 at 12:44

In short, you would incorporate your AI into your event loop like so:

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.

B22e9f99a9b9899794f5e8663a57c038
0
GameEngine_Designer 101 Oct 24, 2007 at 00:27

Not quite.. I have no idea on how to do this A.I. I need some more details than that.

C24eb7e6aaefba78b94c831ddc7b4d0b
0
donBerto 101 Oct 24, 2007 at 00:29

Could you provide more details about what kind of AI you want?

B22e9f99a9b9899794f5e8663a57c038
0
GameEngine_Designer 101 Oct 24, 2007 at 03:40

Like, an RTS game. I am desiging an text based RTS game using C# and building it as a WindowsApplication.

C24eb7e6aaefba78b94c831ddc7b4d0b
0
donBerto 101 Oct 24, 2007 at 05:00

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.

  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.