AI

Discussion on game mechanics, balancing etc.
Forum rules
Posted relevant content can be used under GPL or GFDL (http://www.gnu.org/) for the project. Thanks!
Post Reply
User avatar
Trilarion
Founder
Posts: 845
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

AI

Post by Trilarion »

placeholder
Xylander
Posts: 37
Joined: Wed Mar 06, 2013 5:32 pm
Location: Germany
Contact:

Project AI

Post by Xylander »

I recently studied some articles about AI and finally found one about Project AI. Sounds interesting to me and I would give it a try. As soon as we have finalized (alpha version) game mechanics I'll start experimenting with it.
Don't repeat yourself. (DRY)
Keep it simple, stupid. (KISS)
You ain't gonna need it. (YAGNI)
http://www.clean-code-developer.de/
User avatar
Trilarion
Founder
Posts: 845
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

Post by Trilarion »

Quickly read over it and it coincides with the only other piece of information I have about AIs, namely that having hierachies of goals is currently the best you can do to create a coherent strategy. I would be glad to see others than me starting to push the AI forward. :)

Two additional things:

1. Closely watch the interplay between AI and game mechanics:

We should check from time to time if our ideas of the game mechanics are compatible with what we can include in the AI. One example is difficult cooperative movements (see internet articles about Trade Empire/Starcraft movement problems, e.g. the battlefield should not be too crowded.

Other thing is that diplomacy might allow a typical MP strategy, secret arming in peace times and sudden attacks. AIs have usually a disadvantage there because they either aren't that treacherous or just don't learn anything about the character of the player from game to game. Possible changes include non-breakable treaties, mobilisation periods before wars or longer wars.

2. Some feedback and remote optimization:

Afaik all browser or online based games are doing it (collecting player usage statistics) while no standalone programm does it. Since we are open source and free, customers might be nice and allow us to analyze how the AI performed (which victory, how did various game variables develop) and to adjust free parameters of the AI (I'm sure there will be free parameters). This way we might be able to optimize free parameters.

We could have simple no knowledge optimizations to complex testing of AI strategies. The outcome might nevertheless be disappointing but I would like to experiment with such technologies at some point. It would actually be cool to see how many users play a strategy game.
User avatar
Trilarion
Founder
Posts: 845
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

Post by Trilarion »

Some more requirements for the AI I would like to have. I know they aren't well defined and they should kind of come naturally from a well crafted AI. Nevertheless it's nice to have some criteria how to judge a good AI.
  • In similar situations it should react similar, not erratic. (makes it predictable)
  • The actions should make sense.
  • Military AI: should consider counter-attacks unless the situation is hopeless
  • Diplomatic AI: Quick changes between declaring war, begging for peace, declaring war, ... should not happen
  • Diplomatic AI: Try to bargain with other in the sense of: "What would make this deal work?, What do you pay for peace?..."
  • Flavors would be nice. I.e. leaders for each nation and each leader can have some attributes like peacefullness, industrial, ...
Xylander
Posts: 37
Joined: Wed Mar 06, 2013 5:32 pm
Location: Germany
Contact:

Re:

Post by Xylander »

Trilarion wrote:In similar situations it should react similar, not erratic. (makes it predictable)
Never ever! This is the worst case that can happen!
AI must not be absolutely predictable. Example: If an AI is know to take take the shortest path (pathfinding) you'll always know where AI units will be and where not. It's easy to exploit. So many games show this kind of predictability.

An AI must chose between options it has in a somewhat unpredictable way to be suprising, to make unexpected moves. This makes games against an AI much more interesting and enjoyable. Maybe this is the most important rule for a good AI (even if this leads to silly actions, at least sometimes) ...
Don't repeat yourself. (DRY)
Keep it simple, stupid. (KISS)
You ain't gonna need it. (YAGNI)
http://www.clean-code-developer.de/
User avatar
Trilarion
Founder
Posts: 845
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

Re: XI. AI

Post by Trilarion »

It depends a bit on what exactly is the situation. If there is only one meaningful action I surely expect the AI to do it. Everything else would just result in a rather more stupid AI. If there are different but maybe equally promising solution, it might choose one based at random and you're right, that is better than always doing the same thing.

I guess what I mean by predictability is more reasonability. That every action the AI does must seem plausible in the light of what happened before or what the general preferences of the AI are. It just should not act like a lunatic.
Xylander
Posts: 37
Joined: Wed Mar 06, 2013 5:32 pm
Location: Germany
Contact:

Re: XI. AI

Post by Xylander »

Trilarion wrote:It depends a bit on what exactly is the situation. If there is only one meaningful action I surely expect the AI to do it.
You expect it - and that's the problem! :-) The 'only meaningful action' could be the worst of all when your opponent expects it and is prepared. So you have two possible solutions:
1. Make the AI aware of player expectations. For this your AI must know about a history of situations, it's own actions, what the player observed, the players actions, relations between the player's actions and it's own actions and an evaluation of the outcome.
2. Prevent that a player can be prepared or at least make preparation itself a risk.

An example: The player builds up a defensive line and leaves one weak spot. AI is programmed to be intelligent, evaluates the situation and guesses this is a trap (80% probability). It decides to attack somewhere else. Of two possible actions this is the only meaningful action because the alternative is to walk into the trap. As a result the player has one safe spot where the AI will never attack. Whenever he needs a safe spot he creates 'a whole in the wall'...

We can't build an AI implementing 1. But if we build an AI that follows the second rule, it will change the situation completely. Our AI might say: "So, there is a 80% chance this is a trap. I'll avoid walking into the trap with 80% probability. This makes it very ineffective to exploit AI behaviour. AI will detect a trap (as good as it can) and will avoid walking in most of the time, making traps ineffective (as long as the AI can detect it). On the other hand you can't exploit this because you can't be sure how the AI will react.

Adding this kind of chaos to AI logic makes it much more difficult for the player to find out AI rules and tactics, making it even more resitant to exploits. The drawback is that the AI will sometimes do silly things (like walking into an obvious trap).
Don't repeat yourself. (DRY)
Keep it simple, stupid. (KISS)
You ain't gonna need it. (YAGNI)
http://www.clean-code-developer.de/
User avatar
Trilarion
Founder
Posts: 845
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

Re: XI. AI

Post by Trilarion »

Okay, chaos seems an important ingredient of the mix although it seems at first sight counterintuitive because doing stupid things occasionally ... well it's human.

More AI related discussion will follow if we talk about diplomacy. There are many issues with treaties. Especially controverse was the discussion about if treaties can be broken without direct penalty at any time.
Alias72
Posts: 12
Joined: Tue May 14, 2013 9:08 pm

Re: XI. AI

Post by Alias72 »

one of the problems with designing AI algorithms at this point is that you do not have game mechanics yet. without knowing the effects of actions all you can do is set flavor guidelines that are ineffective in creating a reasonable AI structure.

another issue, you don't have any expected requirements so you have no way to judge how much resources should be dedicated to the AI. creating algorithms that make sense are easy, making them efficient enough to run in the background of a game is hard.

If you could give more concrete information on the final form of the game it would make the process of offering suggestions much easier.
User avatar
Trilarion
Founder
Posts: 845
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

Re: XI. AI

Post by Trilarion »

Hi Alias, of course you're right. Without the exact game mechanics all posts so far in this thread are pure speculation. I know that kind of fixing the game rules has top priority and I am working on it.

Regarding the computation power requirements: I would not set a hard requirement there, but I would be willing to sacrifize users on really old computer equipment. The reason is that in the long run they will upgrade their equipment. So if the AI takes some seconds on a modern desktop computer that's fine.

Owners of tablets or smartphones could, if we ever offer a version (user interface is the biggest problem in my eyes), can put the server part of our game on another computer and this way outsource the AI computation.

So to avoid lags, in a multiplayer game, always the most powerful device should host the game. (We could even think about distributing the AI computation workload.)
Post Reply