Frogboy Frogboy

Elemental: AI designing

Elemental: AI designing

image

For those of you not familiar with game development, most of the development is spent designing the engines and technologies that will be used by the game. In our case, about 2/3rds of the time is spent on that kind of thing. 

In many respects, this time is much like developing a traditional software application.  Elemental uses a graphics engine that has been developed over the past couple of years for Society.

Our previous games used an engine called Pear that was developed in the late 90s and enhanced over the years.  The new engine, called Kumquat, has all kinds of goodies (as you'd imagine).

One of the big differences in Kumquat from my personal coding perspective is its use of Python for scripting.  Our old engine wasn't scriptable so everything was written in C++.  Now, Stardock is a bit unusual that we don't tend to use scripts in our games. In Elemental, the only reason we're using scripting is to make it easier for other people to mod the game.

Anyway, now we're starting to put the pieces together to actually make "the game" as opposed to a series of technologies.  That means I finally get to start sinking my teeth into AI.

With Galactic Civilizations, I only got a couple of months to work on the AI and I had to do it basically on my own.  This time around, our team is large enough that I get to work on it longer and I have help.

Not that I don't mind writing functions like get the distance between two points or whatever but having others who can write the worker functions will save me a lot of time.

One other difference in Elemental was the decision to have multiplayer support. There's a single player reason for this - I want to see how people play the game before the game is released so that I can incorporate clever strategies into the AI.

Those of you not familiar with Stardock developed games know that from my personal perspective, the only point to these games is the AI.  Personally, I think it's great that humans want to play the game too but I'm in it for the computer players.  My fun on GalCiv was always watching the different AI personalities fighting each other to see who would win.  But then again, I'm a pretty weird guy.

114,212 views 67 replies
Reply #26 Top

Frogboy, you stated that before the actual implementation of behavior of AI, the game should learn basing on the actions taken by humans. I wonder how it will be done. Basically: will you use some AI algorithms to determine best solutions, or you will do it by yourself? That said I would like to ask, what is your opinion on Artificial Neural Network (ANN) being incorporated into the game (ie. the AI)? I was thinking about implementing it into a strategy-game project (Open Source) I've been working on. The main reason I am asking about it is that recently Chris Taylor said that they will implement this 'feature' into Supreme Commander 2. That made me thinking: if one could put such algorithm into a mature title like SupCom2, then maybe it's worth a discussion?

Reply #27 Top

Quoting red1939, reply 1
Frogboy, you stated that before the actual implementation of behavior of AI, the game should learn basing on the actions taken by humans. I wonder how it will be done. Basically: will you use some AI algorithms to determine best solutions, or you will do it by yourself? That said I would like to ask, what is your opinion on Artificial Neural Network (ANN) being incorporated into the game (ie. the AI)? I was thinking about implementing it into a strategy-game project (Open Source) I've been working on. The main reason I am asking about it is that recently Chris Taylor said that they will implement this 'feature' into Supreme Commander 2. That made me thinking: if one could put such algorithm into a mature title like SupCom2, then maybe it's worth a discussion?

I haven't done much AI coding, but I've read up on it from time to time since it's an area of interest for me. In a nutshell, most all AI is rule based though the term "rule" is a little loosely defined. You program the AI to make decisions the same way you, as a human, would make them. AI's generally have a set of priorities that guide what rules to use and AI variations are often, at least in part, based on different combinations of those priorities (e.g. an AI that weights economics over warfare).

A true learning AI is rare in games. One, it's hard to program correctly for the parameters the AI would need to learn. Two, to teach an AI you have to have thousands upon thousands of complete iterations that the AI can learn from to decide which actions were good or bad and that all has to happen before it initially ships. Even then, you have to create some rules for the learning AI to decide what was cause and effect versus correlation. Did the fact the AI won a game mean the research path was good or something else? How does it decide what worked and what didn't? In most games, a learning AI simply not feasible.

One thing you can do is have different AI instances fight it out and look at the characteristics for which ones win. Through that you can determine "best of class" strategies for an AI to take. Though, if you don't have enough variation in AI instances or if the general AI rules have a blind spot (say, failure to focus on defensive city upgrades) then you can end up with the best AI's all having a similar flaw.

Reply #28 Top

I may be mistaken but it seems like with MP in the alpha, and likely all MP at this point will be on their servers, they will be able to "record" every game. If they have some learning AI, they would be able to feed all the data of a game and let the game start "learning" from watching human controlled games. Or this could just be wild speculation and this type of AI learning is not even possible, at least not at the game developer level.

I just can't help but think of "WarGames" and WoPR going thru all the possible outcomes of thermonuclear war...wouldn't it be cool for the AI to watch human play, analyze it and develop it's own counters to certain strategic patterns....

Or more likely, Frogboy will analyze the MP games and design his AIs accordingly. But it would be very cool if the former was doable.

Reply #29 Top

Personally, I think it's great that humans want to play the game too but I'm in it for the computer players. My fun on GalCiv was always watching the different AI personalities fighting each other to see who would win. But then again, I'm a pretty weird guy.

I don't think you're really all THAT weird, just a bit here and there... XD Personally, I would also like to see those battles and as it is now possible for players to change the AI, I hope we will also have the option to start an all AI game to test our changes...

Even better would be a real debug-mode so we can really check how an AI decides what to do in certain situations. I assume you'll need something likes this for yourself anyway.

Reply #30 Top

Sorry to reply to my own post, but I just noticed I have two usernames with different passwords (and Member No.)... Is there anyway to combine these?

Reply #31 Top

Quoting Scorpiana, reply 5
Sorry to reply to my own post, but I just noticed I have two usernames with different passwords (and Member No.)... Is there anyway to combine these?

[email protected] :P

I may be mistaken but it seems like with MP in the alpha, and likely all MP at this point will be on their servers, they will be able to "record" every game. If they have some learning AI, they would be able to feed all the data of a game and let the game start "learning" from watching human controlled games. Or this could just be wild speculation and this type of AI learning is not even possible, at least not at the game developer level.

Well, remember, the plan was to have the MP AI running off Stardock's own server, so they would have direct control over it. As long as that's how it ends up. :P

Reply #32 Top

Quoting Denryu, reply 3
I may be mistaken but it seems like with MP in the alpha, and likely all MP at this point will be on their servers, they will be able to "record" every game. If they have some learning AI, they would be able to feed all the data of a game and let the game start "learning" from watching human controlled games. Or this could just be wild speculation and this type of AI learning is not even possible, at least not at the game developer level.

I just can't help but think of "WarGames" and WoPR going thru all the possible outcomes of thermonuclear war...wouldn't it be cool for the AI to watch human play, analyze it and develop it's own counters to certain strategic patterns....

Or more likely, Frogboy will analyze the MP games and design his AIs accordingly. But it would be very cool if the former was doable.

 

Makes me think of SkyNet 8C

 

But a learning A.I would be really cool. I guess that the learning A.I will simply be a computer that records what the winning strategies are on what size and type of maps. And if all winning conditions are enabled, what winning condition win most games on what size and type of map.

Reply #33 Top

I think that seeing people playing, their strategies and stuff, it´s already a lot of information for Frogboy. If you know what are the best strategies people use, you can make scripts for the AI to act in the same way. Of course it´s not a simple task, but since it´s already being developed with this tought on mind, surely things will go smooth. 

This A.I vs A.I. reminds me of robots fight on those science fairs =)

Reply #34 Top
Wasn't there also something about Stardock using ultra-powerful comps for AI, and people connecting to those AI's in games, kinda like Demigod?
Reply #35 Top

One other difference in Elemental was the decision to have multiplayer support. There's a single player reason for this - I want to see how people play the game before the game is released so that I can incorporate clever strategies into the AI.

 

I like this. Meaning that the AI might actually use human techniques to win a game. I wonder if it's possiblw to add to the AI that ability to learn from game to game. I play a game and I always use the same stategy for exemple. The AI after game 10 knows how I react and adapts to it. Is this something possible or is it just science fiction?

 

Very cool stuff in any case.

Reply #36 Top

Is this something possible

It is theoretically possible, but no guarantee that it's going to be practical to do :P

Reply #37 Top

Quoting Solam, reply 10

I like this. Meaning that the AI might actually use human techniques to win a game. I wonder if it's possiblw to add to the AI that ability to learn from game to game. I play a game and I always use the same stategy for exemple. The AI after game 10 knows how I react and adapts to it. Is this something possible or is it just science fiction?

https://forums.galciv2.com/138274

Reply #38 Top

For what it is worth, I think Frogboy will do a pretty good on things out of the gate. His AI work has always been better then others I have encountered, even those with cheats enabled.

Reply #39 Top

Quoting Wintersong, reply 12

https://forums.galciv2.com/138274

Oh yeah!!

Your strategies could be written to disk and then analysed in future games by the AI.  It's something I definitely want to put into our next game (a fantasy strategy game) in some form so that the AI really does learn over the course of multiple games. 

Reply #40 Top

The best thing about GalCiv2's AI in my opinion is that the different races act very differently, but generally effectively.  All sides are not created equally--which I like--and the different AI strategies all work better or worse depending on the map size, map conditions, neighbors, the player, and a bit of luck.  it makes every game a little bit different.

Reply #41 Top

I can't wait, Galciv 2 was a rare treat, just being able to ramp up clock cycles for the AI and having a fair game against competitors who managed to come up with very different strategies that somehow all managed to give me a very hard time. Good times.

Reply #42 Top

Will you provide python-level api or also xml/other data files to tweak? I think specifically making a new kind of personality could be done by changing an xml file without altering the code.

Regarding python, will it be possible to associate one leaser's personality to a specific python module eporting the relevant functions so we could have several python modules providing different ai's which would be easy to share and work together?

Do you have an idea of how many low level calls will be exposed to python? Am I understanding correctly that you are going to put all the logic in python?

Mind you, considering the quality of Galciv ai, I don't think we'll need to mod Elemental's ai, but Civ IV's aggressive ai was a nice thing for instance, in that it changed not just a few weights but a whole lot of algorithms. Mixing aggressive and regular ai inside a same mod could be fun (particularly on island/continents games), so I wonder if something like that would be doable in Elemental.

Reply #43 Top

So.... Who wants to take bets on how many games before Stardock AI becomes sentient?

On another note: The link to societygame.net seems to be not working. Is this by design or some (temporary) problem with the site? I wanna see it. :(

Reply #44 Top

If an AI ever does become sentient, we're hosed...  It's sure to exterminate us just for the hell of it.

Reply #45 Top

I hope Elemental AI will have a strategic AI layer and a tactical AI layer. Too many TBS just move units somehow and make units/buildings without any strategy or goal at all.

Reply #46 Top

Quoting psychoak, reply 19
If an AI ever does become sentient, we're hosed...  It's sure to exterminate us just for the hell of it.
Why destroy us when it could manipulate the brainless masses into doing its will?:moo:

Reply #47 Top

Why destroy us when it could manipulate the brainless masses into doing its will?

I get this part, but why the cow? Because it's the thing that looks closest to a sheep?

Reply #48 Top

Milked like cows?

Reply #49 Top

I suppose, though brainless masses are usually compared to sheep. :P

Reply #50 Top

Cows are almost as dumb as Horses, so the analogy still stands. ;p