Frogboy Frogboy

I’m on Skynet’s side

I’m on Skynet’s side

image

This week will mark the second full week I’ve been working on the AI in Elemental.  Beta 1 doesn’t have AI in it per se. It just randomly does nonsense really.

I’ve been writing computer AI now for 17 years (egads). It’s what got me into making games in the first place. I love computer AI.  Everything else in the game (for me) is secondary.

Early AI: OS/2

The first computer AI I wrote was for Galactic Civilizations for OS/2. It had the distinction of being the first commercial (i.e. at retail) 32-bit PC game. The first commercial game to support >256 colors. But for me, the key feature was that it was also the first game to have a multithreaded AI.

Back in 1993, most developers weren’t familiar with multithreading. Games were made with a big WHILE loop.  When a player hit the turn button, they would sit and wait for the computer to make their moves.

In the OS/2 version of Galactic Civilizations, the AI generated their move in the background. This was a key advantage back then because the computing power (think 386SX) was such that most AI had to massively cheat (and I don’t mean money bonuses, I mean play a different game) in order to be challenging.  The AI in the OS/2 version of GalCiv didn’t have to cheat because it received the CPU time necessary to come up with a good strategy.

Of course, my programming abilities at the time were dismal. But thanks to multithreading, I was able to use brute force to make an AI that played reasonably well.

Today’s AI

For me, multicore does’t make quite as much of a difference in AI programming as XML has.  I have previously talked about data driving the AI.  The goal is to move away from hard-coded scripts (whether in Python or C++) and towards XML based state machines. 

The idea is that on reasonably modern computers, the AI can crunch a lot more data to come up with solutions that we humans wouldn’t think of.  Chess programs have done this sort of thing for years but chess boards are very small compared to a game.  With XML based state machines, we can do all kinds of interesting things by letting the AI look at lots and lots of data and look at overall goals that it might have and then make “intelligent” decisions.

Example: Elemental

If you look at the screenshot above, this is an example of an AI driven state machine. The AI was not “told” to build a city like this. Nor was there any sort of (IF I need Food THEN build a farm) type logic.  Instead, it looked at the XML and looked at many different conflicting priorities and determined a course of action which.  The amount of C++ code necessary to get it to intelligent build a city is less than 100 lines (compared to several thousand lines for the craptastic planetary improvement AI in Galactic Civilizations II).

AI Modding

A key feature of having an XML based AI comes in modding.  Modders can make their own AI personalities and drive their own priorities.  After all, the AI can only do what I (the AI developer) thinks is the best way to win. Experienced players may come up with other means.

Now, modding AI is nothing new. In the past, you could use Python or Lua or some other scripting language to write your own AI.  XML driven AI isn’t particularly innovative either, it’s just the sheer level of its use that is a bit different here.

208,068 views 80 replies
Reply #51 Top

Quoting Frogboy, reply 46

Quoting Tasunke, reply 45But the AI can't win if it has no one to play against ... and other AI don't count.
It counts for me.  When I "play" Galactic Civilizations it's primarily to watch the computer players play against each other.

With Elemental, I anticipate other freaks like me to do that since users can define their own AI personalities, assign them to players and then watch them fight it out.

You humans, pah. Frankly, if I didn't need your stinking money Elemental would just be for the computer players.

 

*sending two monks to visit Frogboy so they may enlighten him as to the wisdom of such thoughts* ..."hummm" *clears throat as I watch the monks set of in their quest hoping Frogboys AI will not return them in knots*  (\B):vulcan:(\B)

Reply #52 Top

Quoting Frogboy, reply 46



Quoting Tasunke,
reply 45
But the AI can't win if it has no one to play against ... and other AI don't count.


It counts for me.  When I "play" Galactic Civilizations it's primarily to watch the computer players play against each other.

With Elemental, I anticipate other freaks like me to do that since users can define their own AI personalities, assign them to players and then watch them fight it out.

You humans, pah. Frankly, if I didn't need your stinking money Elemental would just be for the computer players.

The Elemental T-800! :w00t:

Reply #53 Top

I'm curious if time limits will still be in effect for AI decision making.  GalCiv2 AI got funny because the AI appeared to get better when a number of bot players were eliminated near mid game.

Reply #54 Top

Quoting Frogboy, reply 46

Quoting Tasunke, reply 45But the AI can't win if it has no one to play against ... and other AI don't count.
It counts for me.  When I "play" Galactic Civilizations it's primarily to watch the computer players play against each other.

With Elemental, I anticipate other freaks like me to do that since users can define their own AI personalities, assign them to players and then watch them fight it out.

You humans, pah. Frankly, if I didn't need your stinking money Elemental would just be for the computer players.

 

Can I quote that to your investors? }:)

Reply #55 Top

Quoting strager, reply 54

 

Can I quote that to your investors?

 

If we had any, sure. :)

Reply #56 Top

@Strager - have you seen Pinky and The Brain? The Frog is like The Brain, he is taking over the world (or at least he tries every day). That means that he owns Stardock and in order to punish his investors he needs to spank himself :)

Reply #57 Top

Quoting Frogboy, reply 46

With Elemental, I anticipate other freaks like me to do that

That would be Me *raises hand*

Reply #58 Top

Quoting Tasunke, reply 48
The current goal of modern robotic engineers (and robotic AI programmers) is to get a robotic soccer team to play with a human team and win (without killing the human players). This is of course, a long term goal. For now the focus is on getting cars to successfully race against each other on various tracks.

I don't see why the robots should be limited in such a way - if they have superior survivability and can be repaired/replaced more quickly than organics, why should they not take advantage of this? It's no different than human players taking advantage of their superior ... well, whatever it is they CAN do better, adaptability or learning I suppose.

Reply #59 Top

I'm fairly certain murder is a red card offense. 

Reply #60 Top

Quoting arstal, reply 59
I'm fairly certain murder is a red card offense. 

Of course - and naturally it's not viable for the entire robot team to get penalties. I'm just saying if a key human player were to come to misfortune, at the cost of a single robot being sent off (even better if he can get multiple humans) the robots could come out ahead in the end - organic professional soccer players are difficult to replace after all, much moreso than artificial ones. In all fairness the artificial competitors really should play to their strengths.

Reply #61 Top

Quoting arstal, reply 59
I'm fairly certain murder is a red card offense. 

 

But it was an accident! ;)     The robot didn't see to the left before he swinged his hand and hit the throat of that player :(

Reply #62 Top

Quoting Campaigner, reply 61

But it was an accident!     The robot didn't see to the left before he swinged his hand and hit the throat of that player

Ronaldo wishes that this were an excuse.

Reply #63 Top

Quoting TarponCrest, reply 51

Quoting Frogboy, reply 46
Quoting Tasunke, reply 45But the AI can't win if it has no one to play against ... and other AI don't count.
It counts for me.  When I "play" Galactic Civilizations it's primarily to watch the computer players play against each other.

With Elemental, I anticipate other freaks like me to do that since users can define their own AI personalities, assign them to players and then watch them fight it out.

You humans, pah. Frankly, if I didn't need your stinking money Elemental would just be for the computer players.

 

*sending two monks to visit Frogboy so they may enlighten him as to the wisdom of such thoughts* ..."hummm" *clears throat as I watch the monks set of in their quest hoping Frogboys AI will not return them in knots*  (\(\

 

They'll also heal him 10% of his max hp every 8 seconds in case he gets tired or gets a papercut. 

Reply #64 Top

OK so I am a bit confused....are we being replaced by Koreans, or Computer players, or Korean Computer players?

  ;P

Reply #65 Top

Koreans will play our game professionally, and Elemental will become the next Starcraft ;)

Reply #66 Top

The next starcraft -  speed chess style!!!   Then have  a look at the commands per second stat of those Koreans!!! 

Actually, watching a game played with finite times for turns before you automatically lose would be really interesting.....  start memorising those shortcuts!

Reply #67 Top

I think that overtime=you lose ... is a tad extreme. Instead merely flip over to the next turn, no harm done. It still means that the fastest player will get the most things done, without having a lot of default win/losses.

Reply #68 Top

Hi -  sounds very good

on the subject of different difficulty levels having random bad data -  would it be possible to create a kind of "secrete service"  option in the game?  so you research different levels of secret service or spy skills - with the higher level of the skills the information about other kingdoms and Empires gets more accurate...  so less bad data from higher level spy skills.  then to change the difficulty of the game at an AI level. you only have to limit A) how important it is in the AI to research the "spy skills"  and B)  set what level of "spy skills" are the top most level that the AI can achieve on that difficulty level... making it a bit less "random" and a bit more - "isn't a very cleaver ruler - or it's a ruler working on bad information" than oops i randomly messed up.

Doing so would be an interesting thing for players too.  as the default (no spy skills)  might give a huge variance on data about other kingdoms and empires - while high level skills would make the information a lot, if not perfectly, accurate.  I mean good intelligence in a war situation is vital and looking at a map and seeing exactly what is there 100% of the time takes that element out of the strategy for a war sim. 

Obviously at an AI level you might need a far greater range of what the spy skills gather information on than a player would.

Counter espionage could also be a research tree...

 

 

 

 

 

 

Reply #69 Top

Quoting Icepick, reply 64
OK so I am a bit confused....are we being replaced by Koreans, or Computer players, or Korean Computer players?

 

Korean Terminators probably. *_*

Reply #70 Top

하늘 그물?

:P  

Reply #71 Top

Quoting zigzag, reply 62

Quoting Campaigner, reply 61
But it was an accident!     The robot didn't see to the left before he swinged his hand and hit the throat of that player
Ronaldo wishes that this were an excuse.

 

Ronaldo would die and get a yellow card for diving (that actually did happen in a match a awhile ago, a player died on the pitch and the ref gave a yellow for diving)

 

 

Reply #72 Top

Quoting Frogboy, reply 55

Quoting strager, reply 54
"Can I quote that to your investors?"
 
If we had any, sure.

Hahah, "oops." :D

Reply #73 Top

Ronaldo would die and get a yellow card for diving (that actually did happen in a match a awhile ago, a player died on the pitch and the ref gave a yellow for diving)

Croatian leagues, right?

I was thinking more of Ronaldo's red card against Malaga.

Reply #74 Top

I'm curious how many AI "personalities" you intend to develop like in GC2. I really like that there were multiple AI "personalities" where it played towards aggression, influence, etc.

Reply #75 Top

Quoting Rishkith, reply 74
I'm curious how many AI "personalities" you intend to develop like in GC2. I really like that there were multiple AI "personalities" where it played towards aggression, influence, etc.

Rather then that, ask for those, and then the Proper Tools for us to easily make Quality Personalities our-selves. (which it seems like they're doing excellent with in XML). But still it "could" be made easier for those who wouldn't even want to mess with XML.

I can envision a "Custom AI Building Box" in my head. It'll have 5 or 6 sliders, each one representing a type of strategy used in game.

1)Warlike

2)Peaceful

3) Expansionist

etc etc...

Behind the scenes, programing wise, even the in-depth story factions that ship with the game would use these sliders to determine their personality. Each slider could be mixed and combined with others. Then after the player has had plenty of fun playing them the way they were made, they could press a un-obtrusive button and have the sliders pop-up so they can make their own custom personality from in the game. Type in your own custom diplomatic text for them for certain situations, give them your own background story (which is only a matter of opinion if you happen to like Yours better then the stock ones), and you're good to go.

Easy, cheesy, not a bother for those who don't ever want to use the AI Adjuster, and there for the people who need it but who are so new they're afraid to mess with XML. When I first started Modding and then programming for UO, even basic XML scared the crap out of me. I figured if I messed up even one line that I could screw the whole system over....and actually that's not too far fetched. For those newbie people who want to get into it but don't have the technical know-how, something like that would be a God Send.