.com.unity Forums

.com.unity Forums (http://forum.shrapnelgames.com/index.php)
-   Dominions 3: The Awakening (http://forum.shrapnelgames.com/forumdisplay.php?f=138)
-   -   request for new patch: an ai that can learn (http://forum.shrapnelgames.com/showthread.php?t=35449)

wailoktam July 18th, 2007 11:16 AM

request for new patch: an ai that can learn
 
I am sure a lot of you who develop the game and play the game must know what I am talking about. I think the game would become more interesting if the AI makes some choice based on a statistical model trained on played games. While doing everything based on a statistical model may seems too large a change for a patch, doing a bit of it by using machine learning technique should not be too difficult. For example, the decision the AI makes regarding scales can be changed to include some training elements. I think it should not be too difficult to implement. Ultimately, if the AI can be trained to build SC/thugs/counter-SC armies, that would be amazing.

Wahnsinniger July 18th, 2007 11:50 AM

Re: request for new patch: an ai that can learn
 
It Would be amazing.

Building a learning AI into a game as complex as Dominions would both give very rewarding results, and also would be painfully difficult to program. GOOD Artificial Intelligence is about the hardest thing to program in any game. One reason so many games now-a-days rely on Multiplayer modes is because developers like to cop-out and skimp on the AI. Stardock focused big time on AI in Galactic Civilizations 2 and actually succeeded, but they didn't include multiplayer as a result. (Not complaining though) Considering one of the strengths of Dominions is its vast content, the devs need to keep focusing their limited resources on that, and fixing bugs; not building an uber AI.

As for Satistical modeling, I thing you're kinda refering to a Neural-Net thing. Neural Nets are bad. Very Bad. Not worth the effort for game which sports a rich multiplayer community (of which I've yet to play a MP game, since they all seem to be "started" or "Full", Does anyone ever friggin start a new one?)

Sorry to say, but if you want Human-like opponents...play against humans. Not bashing your ideas though, Learning AI WOULD be great.

NTJedi July 18th, 2007 12:06 PM

Re: request for new patch: an ai that can learn
 
Quote:

Wahnsinniger said:
Stardock focused big time on AI in Galactic Civilizations 2 and actually succeeded, but they didn't include multiplayer as a result. (Not complaining though) Considering one of the strengths of Dominions is its vast content, the devs need to keep focusing their limited resources on that, and fixing bugs; not building an uber AI.


I never purchased Galactic Civilizations_2 because a multiplayer extension was never developed. I have heard Stardock is working on a fantasy TBS game which will be multiplayer. Their focus on building a strong AI could definitely make the game a long term keeper.

Quote:

Wahnsinniger said:
Not bashing your ideas though, Learning AI WOULD be great.

Sounds great however the learning AI project is too great to include within a patch as Wahnsinniger says. A scriptable AI would open more doors for improving the AI opponents and has worked great for many successful games such as AgeofEmpires_2 and Neverwinter Nights. Hopefully Dominions_4 will have a scriptable AI.
The other benefit for Illwinter with having a scriptable AI is that if someone complains about a computer opponent all Illwinter has to do is say, "Create and implement your own AI via the scripts option." As time passes gamers of the community will continue to develop stronger and stronger AI scripts.

MaxWilson July 18th, 2007 12:37 PM

Re: request for new patch: an ai that can learn
 
Statistical AI could be as simple as observing that "when I take both death-3 and misfortune-3 (as Bandar Log), my empire dies 30% faster. Bad combination, stay away."

I would much rather have an API of some kind for the AI (even documentation for the .trn and .2h files might do) so that people can write their own AIs. That way they can use nation-specific tactics, can learn if you want them to, can be passed on to other players, etc. Making Illwinter write another AI, given that we already have a pretty decent one, seems like a lot to ask.

Edit: oh, I forgot. It would be nice if you could designate human-controlled players with the same anti-handicaps as Difficult/Mighty/Impossible AIs, since AI players would "look" like humans from the host's perspective. It might also be fun for new players to receive a competitive advantage.

-Max

Wahnsinniger July 18th, 2007 12:50 PM

Re: request for new patch: an ai that can learn
 
The Scriptable AI is something I didn't even think about. That IS a good idea. Especially since the game isn't real-time, scriptable AI works great.

Quote:

MaxWilson said:
Statistical AI could be as simple as observing that "when I take both death-3 and misfortune-3 (as Bandar Log), my empire dies 30% faster. Bad combination, stay away."

So you mean, between games, the Game would try to figure out what works and what doesn't? Seems like it'd just be easier for the devs to hardcode in good combinations, and choose which combinations to avoid, Instead of spending a bunch of time writing Statistical stuff.

The other (more useful) learning AI would continually check throughout a game: "Hmmm, Nation X keeps dominating me with lots of blessed units. Switch production and research to a bunch of Battlefield Mages". But that requires alot of coding itself, and you either have to script in specifically what changes it would make and end up with a inflexible system, or write a Very flexible system which would be unreliable and difficult to code.

MaxWilson July 18th, 2007 01:08 PM

Re: request for new patch: an ai that can learn
 
The thing about the statistical stuff is that 1.) it can depend on the opponent, and 2.) it can extract knowledge that the developers don't have. To wit, in some playing circles with a very aggressive set of players, taking death-3 might be a no-brainer, whereas if most players are defensive and borders are static growth becomes more desirable. Moreover, if the opponent begins to adjust to your strategy a learning AI can re-adjust its style (between games) when it starts to become ineffective. The approach of hardcoding "good combinations" is how most AI seems to be done, and it works well until you figure out the weak points. Dom3 has a good, strong AI, until you figure out the things it can't handle (SCs). At that point you either exploit those things or stay away from them, but a human player would lose a game or two and then, if you kept on using SCs, shift its strategy to deal with them at the expense of a weaker anti-magic defense or something. (E.g. build more mages and fewer huge armies, construct some Rods of the Phoenix and sprinkle them around.) A learning AI would need to have the right tools in its learning toolbox--in its simplest form it has a number of hardwired strategies and selects among them based on what is working--but without the ability to learn from your opponent's behavior you *cannot* prevent your AI from getting exploited eventually. There's no guarantee that any given learning AI would be able to deal with any given player tactic, which is why it would be good to have an API, so you can add more tools to the learning toolbox when needed.

-Max

Gandalf Parker July 18th, 2007 01:51 PM

Re: request for new patch: an ai that can learn
 
That level of AI would have to be done by someone specializing in AI from the beginning, and adding the game after (like GalCiv). Or have an AI programmer working closely (which the Dom game doesnt support)

Personally Id rather see hooks for external AI bots such as VGA Planets supports. Like MUDs have. A full text interface would allow for anyone to program a bot-player to act as an AI. That would not only allow for fantastic AIs that can learn, but also for a huge variety. One person can concentrate on a researcher style. One can do a barbarian horde style player. One can do a stealth style. One could write the Ultimate Ermor Challenge bot and take continual suggestions on improving it.

Every developer has things they do well, and things they dont. Im not one to gripe on the things they cant do but I will suggest that they open the door to allow others to do it for them (graphics, sounds, mods, maps, AI, help manuals) instead of trying to hold the door closed.

As for Dom3, we are closer than you think. The text output is extensive. And editing of trn/2h files is in reach. Im just not sure if we want to proceed down that path without the help and blessing of the devs.

Loren July 18th, 2007 03:18 PM

Re: request for new patch: an ai that can learn
 
You don't realize how complex such an AI would be.


There is one thing that could be done for the AI, though--take it out of the game.

Instead, put the AI in a .dll. Publish the interface to the .dll. The name of the .dll would be an option when setting up a game. Allow the community to write AI's for it.

MaxWilson July 18th, 2007 03:51 PM

Re: request for new patch: an ai that can learn
 
Actually, I really like that .dll idea. The thing I like about interfacing through .2h and .trn files is that the infrastructure is already there, and you could write your AI in any language--but there are also concerns about possible hacks. A .dll could still implement the AI in another language by spawning an AI process and communicating with it through a pipe.

-Max

Gandalf Parker July 18th, 2007 04:16 PM

Re: request for new patch: an ai that can learn
 
Quote:

Loren said:
You don't realize how complex such an AI would be.


There is one thing that could be done for the AI, though--take it out of the game.

Instead, put the AI in a .dll. Publish the interface to the .dll. The name of the .dll would be an option when setting up a game. Allow the community to write AI's for it.

Kindof the same thing I said. External AIs. Except that mine would open it up to more people I think than a dll.

As long as it allows 3rd party AIs without compromising the security of the games internal files then Im all for it.

Kristoffer O July 18th, 2007 04:22 PM

Re: request for new patch: an ai that can learn
 
dll are windows only, right? That makes Gandalfs proposal a lot more likely. Nothing will be developed unless it is first made to work under linux. The Windows version is a bonus to all those people who happen to have a windows computer besides their linux http://forum.shrapnelgames.com/images/smilies/happy.gif
In other words, JK develops the game in linux, and tries to make it work under windows and Mac OSX as well. It usually does. He is fascinated with operating systems (or was, when development of dom-ppp begun).

thejeff July 18th, 2007 04:56 PM

Re: request for new patch: an ai that can learn
 
Well windows calls it a dll, linux just calls it a library.

You could certainly do the same thing. Make a library. Publish an API. Let dominions link to any library that meets the API.

It's a total rewrite of the ai code, though. Pulling it out of wherever it is, formalizing the interface, etc. Not likely to be an easy project.

The .2h & .trn files concept would require minimal effort. Just releasing the format. It does raise cheating concerns, though.

Reverend Zombie July 18th, 2007 05:03 PM

Re: request for new patch: an ai that can learn
 
Quote:

Kristoffer O said:
The Windows version is a bonus to all those people who happen to have a windows computer besides their linux http://forum.shrapnelgames.com/images/smilies/happy.gif


...and a bonus to anyone making money off the sales of the game! http://forum.shrapnelgames.com/image...es/biggrin.gif

MaxWilson July 18th, 2007 05:11 PM

Re: request for new patch: an ai that can learn
 
Quote:

Wahnsinniger said:
As for Satistical modeling, I thing you're kinda refering to a Neural-Net thing. Neural Nets are bad. Very Bad. Not worth the effort for game which sports a rich multiplayer community

Just wanted to stick up for neural nets here. You can't solve a problem just by running it through a neural network, but they're not bad at all at what they do, which is learn arbitrarily complex classification problems. (And with some tricks they seem to do pretty well at learning probabilities too.)

-Max

lch July 18th, 2007 05:14 PM

Re: request for new patch: an ai that can learn
 
I seriously doubt that JK would allow any external library linking for security reasons alone. And this would only be for the real cracks that know how to use it. AI's that can be scripted were already on my wish list, too - just so that people realize that developing an AI is really hard work. http://forum.shrapnelgames.com/images/smilies/wink.gif

Seriously, somebody who suggests learning AI's and thinks that they'll be going to outperform specifically designed AI's probably doesn't have much experience in that field. The idea does look nice on paper, but already for simple games the training of the AI takes considerable time. Thousands or ten thousand games at minimum to have a somewhat bearable AI that probably still sucks and isn't very competitive. Even if the whole Dom3 fan base would submit their entire games this would take dozens of years. And don't forget that this game is far away from being simple. There are so many shortcuts in the game and combos that depend on details which a statistical model would either ignore as singular peaks or try to use them in situations where they do not work for it. A statistical model would probably go for the "good for most situations" choice which usually is quite poor in a specific situation.

Giving the AI some ideas what would be best to build, cast, etc., some sort of "sugar", would probably be the easiest to achieve and the most effective. The format could be somewhat similar to what the RanDom project is using for provinces.

Gandalf Parker July 18th, 2007 05:38 PM

Re: request for new patch: an ai that can learn
 
I hope I didnt give the impression that edit of trn/2h was my preference. I was only saying that its closer to a possibility than many think.

Id just rather that the game allowed a full text mode for play. That just means that for every non-text input (such as mouse selection) there is a matching text input. And that all actions have a text output. 80% of it is already in place.

That would allow the most options for AI thru the most methods (the most OS's, and the most scripting ot programming languages) including someone developing a dll, or a lib, or a api, etc.

Taqwus July 18th, 2007 06:01 PM

Re: request for new patch: an ai that can learn
 
There are fairly obvious data protection issues -- notably, providing an object that encapsulates *just* the information 'legally' accessible to the AI; and which provides no write-access, just a structure for queuing orders (incl. 'instant' orders like equipment moves or alchemy). It would be up to the implementation to cache historical data.

As for complexity, it would be incredibly complicated given the sheer variety of options.

Example domain where traditional AI techniques can work pretty well: driving on an empty road, maintaining lane position. The input (typically low-resolution imagery) is relatively constrained; edge-detection for the lines is reasonably well-understood; the state does not normally radically shift due to previously hidden information; and the controls (actuators) are relatively few -- steering, accelerating, breaking, shifting -- and responsive (less need for long-term planning). Credit assignment problems are usually minor.

Complex multi-player games with vast amounts of hidden information, mandatory long-term planning as some things take a long time to pay off, high randomness and configurability, and a ridiculous number of options are not easy to automate. It's difficult when it's not even obvious -why- one won or lost (credit assignment). This why AIs for even simpler games like GalCiv cheat like hell.

(Ex -- GalCiv knows where all the yellow suns are. These have the best colonization opportunies, thus eliminating much of the exploration problem. The game also cheats by biasing "random" events against the leaders. This is despite the far lower complexity. The whole Civ series is notorious for AI cheating -- ex. AIs trading tech with each other for a pittance compared to what they'll accept from any human, knowing where you are, knowing exactly what tech you have, etc -- and, if memory serves, punish-the-leader adjustments. And so forth.)

MaxWilson July 18th, 2007 06:12 PM

Re: request for new patch: an ai that can learn
 
Quote:

Gandalf Parker said:
Id just rather that the game allowed a full text mode for play. That just means that for every non-text input (such as mouse selection) there is a matching text input. And that all actions have a text output. 80% of it is already in place.


That would be really nice for reasons which have nothing to do with AI. A lot of the pain of scrolling long spell lists or message lists would be alleviated if you could just remember that Communion Master, for example, is four PageDowns into the spell list, instead of grabbing the scroll and sliding it down. (Of course it depends upon paths and current research level.)

-Max

Gandalf Parker July 19th, 2007 12:58 AM

Re: request for new patch: an ai that can learn
 
Quote:

Taqwus said:
There are fairly obvious data protection issues -- notably, providing an object that encapsulates *just* the information 'legally' accessible to the AI; and which provides no write-access, just a structure for queuing orders (incl. 'instant' orders like equipment moves or alchemy). It would be up to the implementation to cache historical data.

Ive seen mud-bots do a really decent job. Almost Turing level.

If a game can provide and receive information in text mode then a bot can be programmed to play. It is a program, playing as though its a human player. It gets no info that a human wouldnt get, and has no actions that a human doesnt have. Im not sure how well it can be made to play but at least it would toss the AI problem into many hands who could collectively decide that AI's for Dominions is not as easy as some make it sound http://forum.shrapnelgames.com/images/smilies/happy.gif

Loren July 19th, 2007 02:01 AM

Re: request for new patch: an ai that can learn
 
Quote:

MaxWilson said:
Actually, I really like that .dll idea. The thing I like about interfacing through .2h and .trn files is that the infrastructure is already there, and you could write your AI in any language--but there are also concerns about possible hacks. A .dll could still implement the AI in another language by spawning an AI process and communicating with it through a pipe.

-Max

Yeah, you've got a point about hacks.

Ok, a separate .exe that links a .dll that provides an API for dealing with the world, reading the .trn file, writing the .2h file etc. No data it's not allowed will even be in it's memory space. Have the main game engine read in the .2h file and check the legality of the orders in it.

To help things along I would suggest releasing the source for the AI. It wouldn't cost any sales--without a Dominions game the code is worthless.

alexti July 19th, 2007 02:23 AM

Re: request for new patch: an ai that can learn
 
There's no real need to support DLLs or provide API or anything else. Publishing .trn and .2h formats would be sufficient. AI can be hooked through existing --preexes/postexec options. Some utility library to read/write in trn/2h format can be written be fans - that will be the easiest part of developing AI http://forum.shrapnelgames.com/images/smilies/happy.gif

MaxWilson July 19th, 2007 02:26 AM

Re: request for new patch: an ai that can learn
 
I suspect JK and KO would be less concerned about the lost sales than the headache of a million eyes looking over their collective shoulders as they code. http://forum.shrapnelgames.com/images/smilies/happy.gif It's one thing if you were expecting to open-source it all along; it's another thing to have to justify a thousand little hackish kludges to people who weren't there when you needed to insert them.

Of course, maybe JK is superhuman and never needs to kludge. http://forum.shrapnelgames.com/images/smilies/wink.gif

-Max

vfb July 19th, 2007 05:40 AM

Re: request for new patch: an ai that can learn
 
Quote:

alexti said:
There's no real need to support DLLs or provide API or anything else. Publishing .trn and .2h formats would be sufficient. AI can be hooked through existing --preexes/postexec options. Some utility library to read/write in trn/2h format can be written be fans - that will be the easiest part of developing AI http://forum.shrapnelgames.com/images/smilies/happy.gif

Sounds like a great idea! The only problem would be if the .trn files contained any information about other players that you wouldn't know for just normally playing the turn (for example province ownership, army locations, equipment).

If it contains this info, then even before you get people writing AIs, you'll have others writing cheat programs.

MaxWilson July 19th, 2007 11:30 AM

Re: request for new patch: an ai that can learn
 
Well, there's also the possibility of the host decoding .2h files and cheating by knowing other's moves. Of course the host already has a ton of ways in which he could cheat.

-Max

HoneyBadger July 24th, 2007 09:26 PM

Re: request for new patch: an ai that can learn
 
If you could just get the AI to recognise a few very decent starting strategies to get them through Pretender creation and the first turn of the game, and then a very few explicit things definitely *to* do and definitely *not* to do

(EX: *do* recruit independent archers when you can, if you don't have national missle troops, but *don't* recruit independent troops when you can recruit better nationals, *do* forge magic items items to protect your expensive commanders, but *don't* forge those little amulets that turn them into werewolves, unless werewolves are better than what they already are), then you'd have an improved AI

This could be handled with a ranking system-like "spend 100% of gold income on national troops", unless you can recruit missle troops, "spend 95% of gold income on national troops if you can recruit slingers, 90% if you can recruit archers, 85% if you can recruit crystal amazon archers, and 80% if you can recruit longbowmen" limited ofcourse by available resources, just as an example.

You could then give them a list of Pretender builds to choose from and some idea of what to do with them.

Gandalf Parker July 24th, 2007 10:18 PM

Re: request for new patch: an ai that can learn
 
In a way we have that some of that. The "list of pretender builds and some idea of what to do with them". Maps can include a god build and scales. Loading the map with positions, structures, sites, can "lead" the AI in a certain direction. So we can get this if someone wants to build a Scenario map which includes a bigger better Ermor or Rlyeh.

Also the Semi-Random program allows including god builds that can be randomly assigned to AIs when you run it. If we can get enough different good players to do builds for each nation then that can become a great feature. But we need for someone who really FEELS Mictlan to provide some Mictlan builds. And someone who FEELS Ctis to provide Ctis builds. And Caelum, Abyssia, Pangaea, Arcos. Those are all so different that totally random builds just dont do as good a job as if we provided some smart ones.


All times are GMT -4. The time now is 08:27 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.