FreeOrion

Forums for the FreeOrion project
It is currently Sun Dec 17, 2017 11:11 pm

All times are UTC




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: [AI Design] The basics
PostPosted: Tue Jul 22, 2003 7:58 am 
Offline
Krill Swarm

Joined: Wed Jul 16, 2003 8:06 am
Posts: 12
Location: The Netherlands
Time to restart the AI design.

Here goes nothing.

I am in charge of the AI it seems. Cool, can someone add my name to the sourceforge list and can someone give me a list of the other people that want to work on the AI.

I propose the division of the AI into seperate parts. I've already written a partial design for the fleet/military AI. I am trying to recover that document.

But for now, we will have to start over from basicly scratch. I am going to make a few very broad descriptions and then we will discuss from that. Based on that I will write up a design, based on that design we will start to program the AI part by part. If nobody objects anymore, we are using C++ to code the AI in.

The AI, at start, will be mostly seperate from the actual program itself. This is to facilitate testing and simulation. Also, the concepts used in the programming of the AI will be very different from the ones used in the programming of an 4/5X game. We already had the confusion about AI and game universe on the last forums. No need to repeat that. This also means that there, eventually must be written an interface that will make it possible for the AI to affect the game and also read information from it.

More in the next post.

_________________
Crimson Rider takes out a purse and carefully picks two coins. With an elegant move he tosses them on the table. A slight smile is upon his face as he points at them and says : "Those are mine"


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 22, 2003 8:10 am 
Offline
Krill Swarm

Joined: Wed Jul 16, 2003 8:06 am
Posts: 12
Location: The Netherlands
AI Model

The AI, or rather all the AI's will consists of individual modules, these modules will read and write data to and from the AI universe, thus affecting the world around them. This affection of the world is the only way they can change anything.

For example, if an AI at some level needs more ships to defend a system, it doesn't directly request such ships from an other AI, but rather it changes a state in the AI universe so that it states that in system X, Y ships are needed. Another AI sees this change and can, or can not send those ships. But direct communication between this AI is never taking place. Altough often it will seem that it is.

This will facilitate the complete division of individual AI modules, they need not be aware of each other. Only to be aware of the universe they can see and write to.

_________________
Crimson Rider takes out a purse and carefully picks two coins. With an elegant move he tosses them on the table. A slight smile is upon his face as he points at them and says : "Those are mine"


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 22, 2003 9:14 am 
Offline
FreeOrion Lead Emeritus
User avatar

Joined: Thu Jun 26, 2003 6:23 am
Posts: 885
Location: Australia
When you say C++ for the AI, what do you mean? I'm still very much wanting the AI to be done in python according to our earlier decision. Some parts of this will be done in C++ to expose the AI code/API to python.

I intend to learn python sometime in the near future to help this happen. I want our game to be flexible, and putting the entire AI in C++ is not going to help that goal as much as using python.

I'm going to see if I can locate that gamasutra article that was posted on the old forums. Anyway, I'd appreciate hearing what your thoughts regarding C++ were.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 22, 2003 9:30 am 
Offline
Krill Swarm

Joined: Wed Jul 16, 2003 8:06 am
Posts: 12
Location: The Netherlands
Empire AI

At the highest level of the AI, meaning in authority for human logic. Is the Empire AI. This AI consists of various entities, each with their own area of expertise. These entities are very broad, and can only change things on a very broad scale.

Examples of these entities are:

Leader, can set such globals as who is at war with the empire.

Military, can set such globals as what kind of military contructions should be build and what systems should be attacked.

Science, can set such globals as what to research and what to apply.

These are of course mere examples, and they are interactive.

Meaning, if the military AI put forward a request that empire wide tanks should be build, then science might initiate tank research.

For now, the following AI have been tought up by me

OverMind Leader
IronBeard Military
PointDexter Science
OutSource Foreign
HomeStead Domestic

_________________
Crimson Rider takes out a purse and carefully picks two coins. With an elegant move he tosses them on the table. A slight smile is upon his face as he points at them and says : "Those are mine"


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 22, 2003 10:09 am 
Offline
Krill Swarm

Joined: Wed Jul 16, 2003 8:06 am
Posts: 12
Location: The Netherlands
I tought it was up to me wether to use Python or not ?

Anyway, I am very open to discussion about the topic wether to use Python or C++ or both. But rather not in a design thread.

Very basicly my reason for preferring C++ for now, is that I already know it and thus can come up with some basic code relativly fast that way.

If the other members of the AI team (who ever they are :) ) want to do Python, we need to discuss that.

_________________
Crimson Rider takes out a purse and carefully picks two coins. With an elegant move he tosses them on the table. A slight smile is upon his face as he points at them and says : "Those are mine"


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 22, 2003 4:49 pm 
Offline
Space Squid

Joined: Fri Jun 27, 2003 9:00 am
Posts: 78
Location: Germany
I'd like to see a self-learning AI sometime in the future. I know this is a little too much for the beginning, but maybe we should talk about this now, so the concepts will allow this to be added later.

It would be nice, if the player could save a demo of his game, so that all actions he made a saved to a file. The AI could take all files of Player A and look at what his weaknesses are, and what potentiall errors he made. Then the AI could try and exploit the mistakes he made. The Player gets a much more challenging gameplay after he plays some times with the same strategy, so he has either change the strategy or improve it to a point the AI doesn't see the mistakes.

There should be lots of changable variables that influence the behaviour of the overall AI, like values for:
different techs
how fast it expands
how much ships it builds
how big the ships are/what kind of ships

and so on... Those variables could be changed every other game, and the results stored somewhere. After playing some games, the AI learns, that this variable should be very high, and the other one about 5.
Maybe these files can be shared with others, so the AI will not only learn from one player, but from thousands of player simultaneus (spelled wrong, i know).


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 22, 2003 5:00 pm 
Offline
Space Kraken

Joined: Mon Jul 07, 2003 10:17 am
Posts: 146
Genetic algorithms, neural nets, and other "self-learning" programs work best on small, well defined problems. There reason why self-learning programs aren't used more often in commercial games is that they simply aren't very good at solving the divergent set of problems in a modern strategy game.

That said, as Tyreth as said all along, it would be nice to expose some sort of API for scripts to interact with. The attempt to conjure a self-learning AI for FreeOrion would be a nice project for a CS or EE graduate student. (or at very least a subset of the AI, for example growing an AI to handle resource production or diplomacy).


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 22, 2003 5:44 pm 
Offline
Space Kraken
User avatar

Joined: Sun Jul 06, 2003 3:48 am
Posts: 131
Interesting ... A SMART AI!

Now if you were to use something like the Build Queue Managers that I'm proposing the AI could use the same script file for the AI races as the player. In SP games, say Hard to Impossible, you'd be playing against what you consider the best game setup. In Impossible the AI opponents would be given certain other advantages.

Thumper


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 22, 2003 6:11 pm 
Offline
FreeOrion Designer / Space Monster
User avatar

Joined: Thu Jun 26, 2003 7:07 am
Posts: 313
We don't need to use a scripted build queue manager to have the AI develop colonies in the same way the player does. There several other ways to achieve that goal.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 22, 2003 9:54 pm 
Offline
Krill Swarm

Joined: Wed Jul 16, 2003 8:06 am
Posts: 12
Location: The Netherlands
I am very much against scripted AI. It is not really AI, but a recipe.

I am planning to include some sort of genetic AI into the code. But that design is for a later stage.

Right now the first prioiry is to have a somewhat working general AI, I am working on a very basic unit now, it's what you might call a cybernetic AI.

_________________
Crimson Rider takes out a purse and carefully picks two coins. With an elegant move he tosses them on the table. A slight smile is upon his face as he points at them and says : "Those are mine"


Top
 Profile  
 
PostPosted: Tue Jul 22, 2003 11:30 pm 
Offline
Space Krill

Joined: Tue Jul 22, 2003 6:40 pm
Posts: 6
Location: UK
What I think the A.I needs is some degree of situational awareness and feedback loop.

Most games use simple speedup bonus's to make the A.I harder, i.e. 20% production bonus, 15% faster research bonus etc... Ship designs are normally percentages as well i.e. 30% of ships space fill with missiles, 30% with beam weapons, 10%ECM, etc...

Game A.I's therefore typically deploy poor campaign strategies and combat strategies against opponents. The game A.I has no sense of threats, strengths, weaknesses, or ‘prediction’ of future situations and therefore cannot plan effectively. (I know A.I’s usually do use some basic stats to assess threat / strength i.e. number of ships, researched techs, colonies, population etc.)

If at war are we winning? Who is attacking us the most or more important succeeding the most? What technologies are they relying on? Do we need to concentrate more on building ships? Or should we apply all our resources into gaining a particular tech over the next few turns (can we research it? Trade for it? Or risk stealing it?).

In Moo2 a player looks at what the opponent is sending against them and adapts there designs. E.g. If opponent is relying on missiles, use more point defence weapons and research lightning field. If weapons are shield piecing use triple armour and reinforced hull. In moo2 you could use spy’s to get a report on all the techs an opponent had researched and research techs to counter, or try and steal the tech.

Side note: (In moo2 the tech tree was excellent, key technologies could swing battles, change the out comes of war, and the techs were diverse enough that one could come up with new designs / strategies to better the opponent, their was no single design to beat all, and therefore you could have less ships but still win a war.) (Some technologies were major jumps in the tech race and in combination with other techs provided significant advantages for limited periods of time.)

Now I’m NOT saying we have to make a self aware conscious entity (the next H.A.L), however better A.I can be achieved by giving the A.I the ability to measure or assess aspects of the game, predict future outcomes, and provide some sort of ‘feedback’ mechanism.

E.g. (Threat from other opponents?) What techs do opponents have, ‘rate of change’ of opponent ship building (are they preparing for war?), rate of research (are they trying to rush ahead?), design of opponent ships (change our designs we don’t want to be producing in-effective designs), race abilities (e.g. are they good at ground combat, do we need tech to offset this?)

E.g. (Plan to attack an opponent?) Time till attack?(attack in 15 turn? Or opportunistic?), build ships to counter opponent designs, research tech needed, increase ship production, attack key production planets first, defend our key planets.

E.g. (Feedback) do new ship designs do more damage to enemy ships of (x) design? Ratio of ships we are losing in battle compared to them, estimate enemy strength based on performance rather than numbers. Are we winning war? Can we win war?

How do we do this?
Short term planning and long term planning of goals?
Feedback metrics, did last decision improve situation? Improve our position?
Allow A.I to test ship designs by simulating combat during game turns?
Use relational database, of game properties / strategies e.g. counter heavy use of missiles with tech x,y,z and strategies a,b,c.
Fill this database with cunning strategies supplied by us and players!!!

This is just all food for thought! So don’t grill me!

PS: Sorry I whaffled a bit on this one.

_________________
"If you can't explain it simply, you don't understand it well enough." :Albert Einstein


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 23, 2003 9:31 am 
Offline
Space Squid

Joined: Fri Jun 27, 2003 9:00 am
Posts: 78
Location: Germany
with self-learning i didnt mean totally self learning, but there are some variables, that influence on how fast your empire grow, and if a player always attacks after round 150 the ai could use this knowledge of past games and doesnt have to spend anything in defense till round 130 and could develop much faster this way.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 23, 2003 12:02 pm 
Offline
Krill Swarm

Joined: Wed Jul 16, 2003 8:06 am
Posts: 12
Location: The Netherlands
basicly i plan to use genetics to some degree, most simply said, if an AI did well or won, the aspects that it used are going to be used again.

But that is all much to far away, right now we need to focus on very basic things, much more boring I know, but very important.

Things as simple as this one for instance :

Quote:
Diplomatic AI

Is dependent of a variety of functions.

First task, to make it respond, responses are for now.

Positive I like you
Neutral I don't care
Negative I don't like you

It will work out this very basic response from 2 factors.

History
Did I like you before

Military
How strong are you
How strong am I


This is quoted right from my todo list, and yes, the first steps will be this shockingly simple. Well simple to write down, not simle to make.

_________________
Crimson Rider takes out a purse and carefully picks two coins. With an elegant move he tosses them on the table. A slight smile is upon his face as he points at them and says : "Those are mine"


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 24, 2003 12:09 am 
Offline
Pupating Mass

Joined: Thu Jun 26, 2003 12:09 pm
Posts: 95
Location: Chicago
Crimson Rider wrote:
basicly i plan to use genetics to some degree, most simply said, if an AI did well or won, the aspects that it used are going to be used again.

But that is all much to far away, right now we need to focus on very basic things, much more boring I know, but very important.

Things as simple as this one for instance :



Even that much is somewhat premature. There is no diplomacy for v0.1. As far as I can tell things break into three modules for this release:

1. Exploration and colonization. Use some basic algorithms to determine next system to explore and next system to colonize.
2. Management of production. Try to match up colony needs and production capacities with empire level goals to make build selections.
3. Strategic fleet management. Manage fleet to attack enemy systems and defend against enemy attacks.

Part 1 should be fairly trivial. Part 2, a bit more complicated, but not terribly difficult. Part 3 could prove quite challenging...

_________________
Programming Lead


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 24, 2003 10:34 pm 
Offline
Krill Swarm

Joined: Wed Jul 16, 2003 8:06 am
Posts: 12
Location: The Netherlands
Actually non of the parts are trivial.

Basic exploration is not that simple even. Altough it can be made simple. As long as it has one scout for instance.

But that part was just pasted from my todo list anyways.

_________________
Crimson Rider takes out a purse and carefully picks two coins. With an elegant move he tosses them on the table. A slight smile is upon his face as he points at them and says : "Those are mine"


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group