The Daily Click ::. Forums ::. Klik Coding Help ::. Turn based AI code
 

Post Reply  Post Oekaki 
 

Posted By Message

Blackgaze

Possibly Insane

Registered
  01/11/2002
Points
  3161

VIP Member
26th June, 2004 at 15:02:32 -

Does anyone know a good article/file that tells or shows me how to create turn bases AI? I am trying to make an "Advance Wars" type game and I know how to do most code for it except for the AI. I had a go of doing an AI but it causes many bugs.
This will really me for this game, thank you.
If this isn’t good enough I could say a few examples of what I want.

 
Formerly known as "Spiderhead".

Returned after four years.
www.youtube.com/user/sevlech for more infomation

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
26th June, 2004 at 15:18:22 -

AI for a turn based strategy game is pretty difficult and I personally don't have any code but I've got some theories for you, maybe they'll help.

You might try to work out a value system that assigns each unit a "threat level" taking into consideration the enemies movement, damage, distance from the current unit. Then simply taking out the one with the highest value. Something like this would work well because it's highly generalized and each unit would act independantly, but at the same time the only units who would "work together" would be those who are close together, while all the rest went off and did their own thing. Now if you built another AI system, one that actually "thinks" (by sending units to specific locations - Try waypoints or something for this) then randomly assign these routines to each computer unit, it would probably up the challenge a bit.

Should you build your AI this way, you should add a way for the units to switch between the AI states, or use the "command routine" (the second one) to send the units somewhere then have them auto-switch to "freelance" mode.

That's it for now.

 
Craps, I'm an old man!

Kris

Possibly Insane

Registered
  17/05/2002
Points
  2017
26th June, 2004 at 15:24:23 -

yeah, i'd go with that too. Most AI nowadays is heuristic, meaning a list of possible actions is made then the best action is picked out of that list

 
"Say you're hanging from a huge cliff at the top of mt. everest and a guy comes along and says he'll save you, and proceeds to throw religious pamphlets at you while simultaniously giving a sermon." - Dustin G

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
26th June, 2004 at 15:31:56 -

Yeah, Doing that in MMF would be very difficult, and very slow.

 
Craps, I'm an old man!

Blackgaze

Possibly Insane

Registered
  01/11/2002
Points
  3161

VIP Member
26th June, 2004 at 15:47:27 -

In my example for a basic attack I done: "when enemy Y is lower than player Y" Set direction of enemy to up. And when the enemy has not moves it will not do anything or move in a random location.
But the random location will mix together to create a double move, I cant stop this

 
Formerly known as "Spiderhead".

Returned after four years.
www.youtube.com/user/sevlech for more infomation
   

Post Reply



 



Advertisement

Worth A Click