Author Topic: AI Programming  (Read 600 times)

Offline capturts

  • Level 8
  • *
  • Posts: 43
  • Reputation: +1/-0
    • View Profile
    • Space Freight
AI Programming
« on: October 14, 2011, 08:37:26 AM »
Any tips for programming the server controlled enemies. Basically it is a turn based combat system, each turn you pick your actions for each of your characters and the enemy does the same. Then the server tells you what happened. Player vs player battles are fine, but you come across AI enemies in quests and I'm not sure of the best way to do it. At the moment the AI character randomly picks an action it can do (bite, hide, whatever) and does it.It works but the enemies are not very efficient at fighting back.

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: AI Programming
« Reply #1 on: October 14, 2011, 10:44:01 AM »
I think it is good that AI is stupid. It is the player that is supposed to be the smart one :D
Do you really want an equal level enemy to beat the same level player? Or would you prefer the player to beat stronger enemies using their "superior human brains" and get an ego boost?
Sure, players complain frequently about "stupid comupter", but if we make the computer smart one do they enjoy the game more and play longer?

There is also another problem. For example why games never make the monster switch to "flee mode" when it is almost dying? It's not like no one thought about it or that it is hard to code (simple if HP<10% retreat). It's that the game would be annoying and frustrating since the player would be running around chasing escaping monsters all the time which is basicly unplayable.

Offline 133794m3r

  • Level 22
  • *
  • Posts: 265
  • Reputation: +2/-0
    • View Profile
Re: AI Programming
« Reply #2 on: October 14, 2011, 10:16:22 PM »
Do what pokemon and other game series do. Use a weighted random number generator with some basic conditionals for deciding what to do next. It's simple enough to make the AI interesting, but not too good, to outsmart the user.

Offline Barrikor

  • Level 21
  • *
  • Posts: 248
  • Reputation: +3/-0
    • View Profile
Re: AI Programming
« Reply #3 on: October 15, 2011, 01:38:48 AM »
One way to do it is to have a couple different ai "personality types".

Basically you have a list of Actions that the ai can do. Actions can be grouped into States (ex. Actions before attacking, Actions while attacking, Actions when attacked). Each personality type has defined % chance of doing each Action when in a State. Each Unit type would have a set % chance for which personalities are most likely.
Projects: Pith Framework (at 0.5), CactusGUI (at 0.3)

Offline capturts

  • Level 8
  • *
  • Posts: 43
  • Reputation: +1/-0
    • View Profile
    • Space Freight
Re: AI Programming
« Reply #4 on: October 21, 2011, 03:51:13 AM »
I'm not convinced that dumb ai characters are a good thing  :-\ surely people want a challenge, if it's too easy they may as well read a book rather than play an adventure game?

Barrikor, I'm not too sure what you mean by 'states'?

leetgamer, I suppose this is the way to go. Better than just random but not too hard to implement.

Thanks for the thoughts. I'm 70% of the way to uploading a pre-alpha, no where near finished version if anyone wants  a laugh at my effort  :P

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: AI Programming
« Reply #5 on: October 21, 2011, 06:27:29 AM »
Yes, they want a challenge. But they want to win by their skills/brains/reflexes. 2 stupid bots are better than 1 smart bot. The challenge is the same, but the player feels better. He "outsmarted the superior force" :)

Offline capturts

  • Level 8
  • *
  • Posts: 43
  • Reputation: +1/-0
    • View Profile
    • Space Freight
Re: AI Programming
« Reply #6 on: October 21, 2011, 08:23:35 AM »
Yes, I see your point.

Offline Nox

  • Level 35
  • **
  • Posts: 768
  • Reputation: +12/-2
    • View Profile
Re: AI Programming
« Reply #7 on: October 21, 2011, 08:56:29 AM »
Then again we have different player personalities ~ different target groups. You might not want to make a game for masses and focus on people that want challenge and it's okey... In case you want more casual one go with Chris


But I believe you could reasonably strike them both (given you have the time to do it :) ) ... make normal mode* with what Chris say and then (could be later, as an addition) make some hardcore mode where the AI would be much smarter and harder ... people would be free to choose challenge, but still literally stress in the game that normal mode is not an inferior one, more like a "different one". The harder will probably be more respected, but still

*) exact wording is nothing to be ignored !  If you call it "lame mode", people will percieve it that way
Meet us at an IRC irc.freenode.net #bbg as well
https://vimeo.com/36579366 (a must-watch) | Join BOINC - no longer a hype, but you can help never the less

Offline capturts

  • Level 8
  • *
  • Posts: 43
  • Reputation: +1/-0
    • View Profile
    • Space Freight
Re: AI Programming
« Reply #8 on: October 21, 2011, 09:05:26 AM »
Yes, I like the "Lame Mode" idea!

Maybe on hard mode you'd gain XP quicker. Although I can already picture forum posts like: "Hey I just beat quest 18 on hard mode", when really they did it on easy and then changed to hard mode afterwards!

Offline Nox

  • Level 35
  • **
  • Posts: 768
  • Reputation: +12/-2
    • View Profile
Re: AI Programming
« Reply #9 on: October 21, 2011, 09:15:16 AM »
that's just up to you to implement it properly :P change player_quests { quest_id, player_id, state } to { quest_id, player_id, state, difficulty } and you're set
Meet us at an IRC irc.freenode.net #bbg as well
https://vimeo.com/36579366 (a must-watch) | Join BOINC - no longer a hype, but you can help never the less

Offline Barrikor

  • Level 21
  • *
  • Posts: 248
  • Reputation: +3/-0
    • View Profile
Re: AI Programming
« Reply #10 on: October 21, 2011, 02:55:50 PM »

Barrikor, I'm not too sure what you mean by 'states'?


By 'state' I meant the mode that the ai was in. You can give anything different states/modes though.

Projects: Pith Framework (at 0.5), CactusGUI (at 0.3)

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal