It is currently Mon Dec 18, 2017 3:17 am

All times are UTC + 9:30 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: [CW2] AI
PostPosted: Sun Feb 15, 2009 9:07 am 
Offline
Main Coder

Joined: Fri Apr 04, 2008 10:50 pm
Posts: 169
There is no game yet, and still I already want to talk about AI, since it is that importand and a problem before. Ideally we find a student that has to make an AI project at college(happens frequently)

I would like to go for a rule based system, where each rule is given a value. This is the easiest of all AI systems I can think of compared to self learning ai or fuzzy logic. if unit is in state x and surrounding is y then the actions are always the same with final output Z.

A unit can maybe do 50 things in it's vinicity, so it should print in debug mode 50 lines each with a value. The rules are hard to find and probably are going to take most of the time. Some I can think of.

UnitAI
Further away is more costly since it costs fuel.
If hp is not low
-> Capping in range
-> if more then 50% attack chance -> Attack
-> if no unit in sight -> group
-> if grouped -> move toward city
else
-> goto nearest friendly city -> heal

These if else are going to grow out of porpotions so each unit should be in a state. We can then draw a diagramm for units with state transitions etc.

I think there is 1 main AI that says attack! defend! defence HQ random! dunnu...
We could make 2 sub ai's.
BuilderAI and UnitAI
The BuilderAI decides on the units that are needed again there are rules

if attacking buy best offensive unit
if defending buy best defending unit(relative to the closest enemy units in the field)

unitAI and the player use the same rules so they both should extend the same class.
UnitController, this means we only have to write the canAttack, canCapture, canSupply methods once.

Cheating
If the AI is found to be really dumb and it's not a rule problem, then we probably have to add cheating:
No Fog
Can see enemy units

layers or steps:
#1 no enemies best build up strategy
#2 1 weak enemy, ai should build up until the unit is in range and then attack it
#3 bigger enemy army, ai builds more offensive units
#4 2 ai's against each other!


Top
 Profile  
 
 Post subject: Re: [CW2] AI
PostPosted: Sun Feb 15, 2009 1:43 pm 
Offline
User avatar

Joined: Fri May 04, 2007 3:18 am
Posts: 520
Wow, this is a little early to be speaking of AI. I, too, think it is important we nail down some key aspects now.

"In my opinion, the more data we can get from units, the more effective our AI will be." [If you don't understand that previous statement, you should just ignore it for now.] At first, I am thinking AI is going to be really dumb. Then it'll gradually increase in difficulty the better we get at it.

[brainstorm]-Anyway, I think AI should be based on Unit Firing Type (Direct AI, Indirect AI).
-Making an AI for Building, eh, I suppose. As long as the AI can interact with the unit on the field, it is fine with me.

I don't want to get into the major details right now. It is so early in the process. I will try and guide this game to be ready for AI. However, explaining how it will be is a different story altogether. (Okay, shoot me... I'm procrastinating :P)

-Bad practice, so early... :twisted: Nah, stef has some really good ideas so far.

-IMO, This game has to be able to return a lot of information. Not only for debugging sake, but also for AI. We have to think about all the data we'd need from units. Example:

- Enemy firing range (1 day ahead/ 2 days ahead/CO Power/ CO Super)
- Allied firing range (1 day ahead/ 2 days ahead/CO Power/ CO Super)
- Movement range (1 day ahead/ 2 days ahead/CO Power/ CO Super)
- Fuel amount (1 day ahead/ 2 days ahead)
- Spaces away from HQ
- Spaces away from nearest city
- Spaces away from nearest factory
- Number of [x-unit] on the map
- Number of enemy [x-unit] in the map
- HP of unit
- (and so on...)

The more information we are able to get from the play field, the smarter our AI would become. Definitely something I am going to strive for when we are creating AI. I will try writing a more in-depth list of what we will need as well. However, I'll handle that later... [/brainstorm]

-JSR


Top
 Profile  
 
 Post subject: Re: [CW2] AI
PostPosted: Sun Feb 15, 2009 5:29 pm 
Offline
User avatar

Joined: Tue May 08, 2007 6:19 am
Posts: 1363
AI should probably be scriptable if you want it to be able to handle all the custom content and mods that come along (which will certainly provide a challenge). At the very least you should make sure the engine API has all the AI-relevant routines (such as pathfinding, unit commands, etc) beautifully and clearly accessible and easy to find so that the job of an AI programmer would be as easy as possible.

In other words, first focus on building the interface through which the AI communicates with the game engine, only then worry about the specifics of AI logic.


Top
 Profile  
 
 Post subject: Re: [CW2] AI
PostPosted: Mon Feb 16, 2009 1:13 am 
Offline
Main Coder

Joined: Fri Apr 04, 2008 10:50 pm
Posts: 169
Narts wrote:
At the very least you should make sure the engine API has all the AI-relevant routines (such as pathfinding, unit commands, etc) beautifully and clearly accessible and easy to find so that the job of an AI programmer would be as easy as possible.

In other words, first focus on building the interface through which the AI communicates with the game engine, only then worry about the specifics of AI logic.

True, but it doesn't hurt to write the basic rules down, maybe somebody reads this topic and takes it as a challenge :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 9:30 hours


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
Blue Moon by Trent © 2007
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group