Godlike Species?

For what's not in 'Top Priority Game Design'. Post your ideas, visions, suggestions for the game, rules, modifications, etc.

Moderator: Oberlus

Post Reply
Message
Author
stride
Space Floater
Posts: 31
Joined: Sun Sep 28, 2008 3:05 pm
Location: Horten, Norway

Godlike Species?

#1 Post by stride »

While pondering over possible AI implementations I accidentally stumbled over this idea.

As far as I can see in code the AI will play with the same conditions as human players. Information available to the AI is it's own system(s) and possibly other "visible" systems and fleets. Initially an AI players could use different (or random) traits based on the specie selected; Cautious, agressive, defensive, shipbuilding, planetdeveloping, being heavily into different categories of the tech tree etc etc.

Sounds reasonable, and it would be a typical man vs machine fight. Same info available = same performance ingame. Almost.. .*grin*

Well, I considering an AI implementation pretty much like any chess game AI, something like this http://www.aihorizon.com/essays/basiccs ... inimax.htm. To be able to simulate and predict future "moves" the full gamestate and all information would need to be available to the AI. A server based implementation of this is possible; "Spawn state, map out tree to a reasonable depth, then calculate and select AI move". Not trivial to code, but still possible.

The result would be an AI player almost impossible to "sneak up" on. No point in sending off a flanking attack, as the AI would see your current move, predict future possibillities and counteract with a reasonable response.


How is that for a Godlike Specie or Doomsday Scenario? What if an AI race could develop and start using this serverside algorithms based on some advancement pretty far out in the techtree? All other species in the Universe would need to knock down that race ASAP.

It would be my idea of good fun to play :)

User avatar
OndrejR
Space Dragon
Posts: 339
Joined: Thu Oct 02, 2008 11:00 pm
Location: Slovakia

Re: Godlike Species?

#2 Post by OndrejR »

I have similar idea. What you really suppose is to use game theory to develop AI. But AI should not know all informations and therefore it would be game with incomplete information. For game theory there are already written libraries(for example gambit). AI difficulty settings will be how many next moves can AI predict. Problem with this solution is that it may be for ordinary player difficult to defeat AI(AI can also bluffing).

Another thing to implement with AI is to use evolutionary algorithms to learn what human(and other AI) players are likely to do and learn from previous mistakes(races should be already learned some gaming style).

Similar thoughts applied to diplomacy(DARPA has some projects in this area)

I intend to develop AI, but not in the next six months.

stride
Space Floater
Posts: 31
Joined: Sun Sep 28, 2008 3:05 pm
Location: Horten, Norway

Re: Godlike Species?

#3 Post by stride »

I'm not heavily into AI, but have done some solutions using Genetic Algorithms myself. It might be an approach for AI's "In System" tuning method. GA limitation is that size/set of variables describing possible solutions is static. Interesting approach for some problem areas tho.

Another far more interesting area is Genetic Programming, http://www.genetic-programming.com/gpflowchart.html where the code uses the GA approach to write the next generation of code...

Common for both is that the "fitness" or performance measure of possible solutions needs to be computed, and I'm not sure that applies to the FreeOrion AI.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Godlike Species?

#4 Post by Geoff the Medio »

We won't be modifying the standard game rules to treat empires that are controlled by AIs differently from empires controlled by humans. We also won't be making a separate class of AI players to control empires that reside on the server; all empires are controlled by players with limited knowledge about the universe derived from the same rules.

However, if you want to make a godlike AI empire, perhaps for a scenario, you could give that empire appropriate game content, such as technologies or equipment, that gives it lots of information about the universe. High detection meters on all its ships or planets, some sort of automatic espionage to gain info about other empires positions and status, and similar things should be doable without needing to modify the game code to make special cases.

I don't consider it a problem if we have an AI that is too hard, without cheating or using special rules. We can easily make it play worse. Making an AI play well is not easy.

That all said, we may have a few special cases of AIs, or AI types, to deal with different things in game that need some sort of AI, but which aren't standard empires controlled by a (human or AI) player. Space monsters come to mind, as do non-player precursor races that go about the galaxy for their own purposes. These shouldn't require modifying the game rules, however... Rather, they'd just need to be running a different AI script.

If you want to use an evolutionary / genetic algorithm to develop and AI for something like FreeOrion, you'd need to either write a cost function that uses the gamestate as an input (which is very nontrivial) or have multiple species / breeds of your AI play against eachother repeatedly and assign fitness based on number of wins or results of a partly played game (which would then need a gamestate-based cost function again). The AI itself wouldn't know the whole gamestate, but you could write a test suite that has access to the save file and thus knows the full gamestate that the AI player couldn't access during the game.

stride
Space Floater
Posts: 31
Joined: Sun Sep 28, 2008 3:05 pm
Location: Horten, Norway

Re: Godlike Species?

#5 Post by stride »

Hmmm... How should we handle rules? Would it need to be implemented and maintained in server, client and also AI code?

As a trivial example, let's concider planet production; 4 variables available to fiddle with, totalling 100%. Ideally the server should enforce this, allowing valid values only. This to prevent runaway AI's or hacked clients.


Is this an approach?

AI or other client says TestSetPlanetProduction(25,25,25,25), server responds "OK"
AI or other client says TestSetPlanetProduction(99,99,99,99), server responds "REJECTED"

Client should then be able to perform SetPlanetProduction(25,25,25,25) without any problems.

Some of this stuff might already be implemented, I haven't checked.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Godlike Species?

#6 Post by Geoff the Medio »

The only way players, human or AI, can interact with the server gamestate is by issuing orders.

There is no "SetPlanetProduction" order. There is a "ChangeFocusOrder" which lets a player specify which focus (primary/secondary : balanced/farming/mining/trade/research) planets that player controls should use. The game has rules to determine resource production based on focus.

Similarly, players can't move fleets instantly where they want them, but they can order fleets to move to a system, which it will then do over the next several turns using game rules (assuming it has enough fuel, which players can't directly change the amount of).

Similarly, players can't give themselves techs or put buildings on their planets, but they can order things to be enqueued on their production and research queues.

When deciding what orders to issue, players clients can predict what effects the orders will have. The players may not have all the relevant information to know exactly what the results will be, however. For example, there might be a building that causes some effect on planets, depending on their focus setting, that a player doesn't know about.

What actually happens each turn is calculated on the server and sent to players with their next turn update.

Post Reply