Home » MODDING HQ 1.13 » v1.13 General Development Talk » What should the AI consider?
What should the AI consider?[message #303650]
|
Fri, 20 April 2012 00:41
|
|
Faithless |
|
Messages:439
Registered:October 2009 Location: The safe end of the barre... |
|
|
So basically I'm working on a little thing called the AI.
What I'm planning to do:
I'm going to make a function that guesstimates how good the situation would be after doing a proposed action.
So when trying to determine whether we're going to do an action, we choose the one that gives us the highest "situational value".
example:
value = cover * coverWeight + estimatedDamageOnEnemy * dmgWeight + abilityToHitAnEnemy * hitEnemyWeight
action1 is to go towards the enemy, where our cover will be less, but we will have a better chance of hitting the enemy.
action2 is to shoot at an enemy, with little chance of hitting him.
Now lets say seeking cover is very important to this soldier, which would be reflected in the weights:
coverWeight = 2, abilityToHitAnEnemy = 1, hitEnemyWeight = 1
In that case action 1 will get a low value because it has bad cover.
action1 value = 10 * 2 + 0 * 1 + 60 * 1 = 80
action2 value = 30 * 2 + 10 * 1 + 30 * 1 = 100
This might result in the AI controlled soldier shooting (action2), even though the estimated damage is low, simply because his cover will be better in the end.
This way we have an way of judging every action by the same standards, thus making our choice well founded.
--------------------------------------------------------------
This next bit is where you guys come in:
I'm making a list of all the things the AI should consider, and this thread is basically your chance to propose new factors that should play a role.
This is what I have so far (though I'm not yet sure if all of these are currently possible).
Things that affect the value directly:
- Will I be following my orders?
- Will I be getting closer to somewhere I want to go?
- How well can I be seen by known enemies on the new position?
- How easily can known enemies hit me?
- How good are my chances of hitting an enemy from my new position?
- What is the estimated damage this action will do?
- How much damage will this action do to me? (Firing an RPG at someone one square away?)
- How high will my breath be?
- How many enemies will I be spotting?
- How much ammo will I have?
- Am i blocking my mates shots? (maybe)
- Am i moving to somewhere with alot of bodies?
- Will this action bring me too close to a friend?
- Will the new position harm me? (gas, fire)
- Will the new position hinder my movement(water)?
- Will I have enough AP left for another useful action?
- How big an area will I be able to see?
- Are there any expanding effects near me? (smoke, gas)
Things that affect weights (the importance of the things in the previous list):
- Morale
- AI Type (coward, brave, idiot, sniper or combination of things)
- How strong we are compared to the enemy
- Soldier stats
- Alert Status
- Traits
- Weapon range vs enemy range
- Weapon Damage potential vs enemy potential
So, go ahead and propose some genius things.
[Updated on: Fri, 20 April 2012 18:06] by Moderator Report message to a moderator
|
Master Sergeant
|
|
|
|
Re: What should the AI consider?[message #303654]
|
Fri, 20 April 2012 01:15
|
|
Faithless |
|
Messages:439
Registered:October 2009 Location: The safe end of the barre... |
|
|
the first two are done implicitly in cover, but i'll name them here separately.
Dead bodies check is a good addition.
[Updated on: Fri, 20 April 2012 01:18] by Moderator Report message to a moderator
|
Master Sergeant
|
|
|
Re: What should the AI consider?[message #303657]
|
Fri, 20 April 2012 01:36
|
|
Flugente |
|
Messages:3509
Registered:April 2009 Location: Germany |
|
|
Nice on, I'd be awesome if you can tweak the AI.
First of all, hermano had some ideas to counter the retarded AI behaviour in light, see this thread for that: http://www.ja-galaxy-forum.com/board/ubbthreads.php?ubb=showflat&Number=302886Post302886
He produced some code, I haven't seen at it, though.
Now, my input, in a more or less ordered form. I'll just list things you haven't mentioned.
Things that should influence the value:
- Am I in gas/water (this is done in the current AI and its important)?
- Are there dead buddies lying around? (Running through a door where there are 20 bodies lying around might indicate that we should take a different approach).
- A kind of 'apprehension' of the players approach. Would propably be hard to do right. An easy way to do this would be to evaluate the current players style and draw deductions from it. One would simply have to further expand the kill statistics (kills by melee/explosives/guns/other etc.) to, perhaps, gun types (like snipe, MG...).
If that is done, the AI could react accordingly. E.g. if the player team is sniper-heavy, put more emphasis on smoke grenade use over long range, a lot of flanking, and scope more if scopes are equipped (counter-sniper).
If the player uses explosives a lot, spread more, thereby try to avoid other buddies. - Can I go into cover after my planned action?
- Would I get out of the players firing cone if I moved, forcing the player to spend APs on turning? The more important the more the player uses the prone position...
- is it day/night ?
Things that affect weights:
- traits
- current health?
- current APs
- have we heard something that might indicate mercs we do not yet know about?
Overall, a very big improvement would be a somewhat sophisticated memory for soldiers. Atm, they don't really have one, making their actions erratic. Actions like retreating into a building and then taking cover and a firing a position towards the door would increase the difficulty.
Another (minor) idea: put more emphasis on hurting the player instead of outright killing him. If given the choice between surely wounding the player or a very small chance of killing him, choose the safe option. The player has a very limited pool of troops, thereby he has to be much more careful... a highly wounded merc is effectively out of combat for at least several hours, perhaps even days.
Currently not possible, but perhaps worth a thought: skip our turn until later in our teams turn. I've too often seen nearby enemies run forward, almost reaching me, and with that they blocked their comrades view. Something like enemies that have a good firing position having their turn first would be good.
ULTRA-ULTRA-mean, and effective in ruining the players campaign:: shoot every head miner we see
Report message to a moderator
|
|
|
|
Re: What should the AI consider?[message #303658]
|
Fri, 20 April 2012 02:00
|
|
Faithless |
|
Messages:439
Registered:October 2009 Location: The safe end of the barre... |
|
|
Hey flug, the light wont be a problem, since light at night results in terrible, horrible, abysmal cover. And cover will now ALWAYS be considered (as opposed to just when seeking cover, atm).
Also, this is only part of the grand (and perhaps too ambitious) plan, so some of the things you said are covered elsewhere.
Two examples:
Persistent memory, the soldier will have a personal plan of what to do (though I am unsure how, as of now).
A commander will give orders, and he will determine the strategy (but soldiers may disobey these orders).
However this made me think of something else: it's important for the enemy to take in account how many tiles he can see (eg, more on the border of a light source).
This way we may be able to get them to camp at the edge of a light source!
Getting out of the players firing arc would be a bit iffy, I think. It will cost you more AP than him.
Also this is unrealistic behavior, which I would not like to encourage.
The current APs and noises are not supposed to affect the weight, because they aren't really linked to any of the factors that determine the situational value directly.
[Updated on: Fri, 20 April 2012 02:21] by Moderator Report message to a moderator
|
Master Sergeant
|
|
|
|
|
|
|
|
|
|
|
Re: What should the AI consider?[message #303685]
|
Fri, 20 April 2012 18:06
|
|
Faithless |
|
Messages:439
Registered:October 2009 Location: The safe end of the barre... |
|
|
Quote:Will the path to my new position harm me? Unless this is implicit as you consider each square separately along the path.
I would like to do this, but I'm not sure if it's possible without putting a heavy load on the CPU.
Quote:This is more related to Strategic than Tactical, and I'm not sure whether it's an AI-issue, but if more than one squad is set to attack a liberated sector, the first squad should wait for the second and attack simultaneously.
Yup, outside my scope.
@PasHancock
Most of what you named are actions, not things that affect our situation.
Added the weapons for weights.
For your questions, no bandaging, no bombarding and I will probably make the enemy crouch when needed.
Quote:Have everyone report in periodically. One dude misses his call = go to next alert state, two or more missing their call = sweep their last position with a tight search pattern, forcing the player to either stand and deal with overwhelming numbers of enemies at once or retreat.
Sounds nice, but also sounds like alot of work
Also, I will not force a soldier to do any actions that don't make sense, if throwing a knife makes sense for him, then he will throw, otherwise, he will not.
Report message to a moderator
|
Master Sergeant
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: What should the AI consider?[message #304854]
|
Wed, 16 May 2012 20:45
|
|
Faithless |
|
Messages:439
Registered:October 2009 Location: The safe end of the barre... |
|
|
Well progress is slow, because I don't have much free time on my hands (and choose to spend most of it elsewhere )
I've decided though that the situational happiness of a soldier will *not* be affected by any other of the soldiers.
Every soldier will only consider its own situation to decide it's "happiness" (including stuff like cover from enemy x).
To make a decision, the soldier will pick an action that creates a balance between the highest happiness score for his team and the lowest score for the enemy team.
This changes the list somewhat, since some of the items will be magically calculated in automatically.
The weights will still remain.
I will probably change the list a bit when i get around to it.
The items in it will be more along the line of the following (already implemented these, in fact).
After doing this action:
How high is my HP?
How high is my BP?
How high is my physical cover? (Chance to get through in the code)
How high is my visual cover? (Not really used by the old AI)
One problem that I have is that nearly every quest will be broken.
All quests will have to be adapted to the new AI, because part of the goal is to centralize decision making for quests.
Another problem is that because I'm modifying saved map data, I have to somehow fix old maps to still work.
EDIT:
Also, about externalizing the AI as a module, I will be making it easier to do this, but I will not actually do it.
[Updated on: Wed, 16 May 2012 20:56] by Moderator Report message to a moderator
|
Master Sergeant
|
|
|
|
|
|
Re: What should the AI consider?[message #305637]
|
Wed, 06 June 2012 08:37
|
|
fnulp |
|
Messages:2
Registered:February 2012 |
|
|
WarmSteel
Things that affect the value directly:
- How many enemies will I be spotting?
- How much ammo will I have?
- Am i blocking my mates shots? (maybe)
- Am i moving to somewhere with alot of bodies?
- Will this action bring me too close to a friend?
- Will the new position harm me? (gas, fire)
- Will the new position hinder my movement(water)?
- Will I have enough AP left for another useful action?
- How big an area will I be able to see?
- Are there any expanding effects near me? (smoke, gas)
Some of that seems a bit too micro-managed? Maybe step back and see if you can't find more general algorithms and data structures that solves these and other issues in a more general way.
Whatever you do, consider that if the "shuffling back and forth" doesn't get fixed (the AI seems to forget about mercs during the turn, I think that's pretty much what makes it oscillate), any improvement to the AI would be polishing a turd. Even random bevaviour -- that is often dumb, but sometimes gets lucky and seems smart -- is better than predictable "when X, then Y" behaviour that can be easily abused.
Sometimes less is more..
For example, every merc could add to the "threat" value of tiles (that is, you'll want to use separate arrays for that) in their line of sight, even more so in their weapon range (use a generalized weapon range though, otherwise the AI could be fooled too easily by running with knives and shooting with guns). Just add stuff like water or gas to that threat value as well (make it such a high value that the situation has to be *really* bad to choose running through gas, but not too high so it can happen), instead of dealing with all that individually.
At the same time, tiles covered by teammates might have a separate "support" value... subtract threat from support, ta-da, you know wether the area is clear and how much so, and can use this as a weight for other decisions (of course I'm being simplicistic, but maybe it gave you an idea anyway).
It might make great things possible if you calculated, for each tile under consideration, how many tiles the one can see from there, and how many of those have mercs on or near them; giving an even higher score for tiles in weapon range (of the enemy who is currently deciding), lowering the score if there is cover between the enemy and the tile. If you found smart ways of caching and recalculating that data, it could even be feasible, it surely would make a lot of decisions much easer and less "special-case-y". Just find the spot that gives you maximum bang for your buck (which would be AP) with the least threat to yourself.. is very simple math once you set up those 2-3 arrays and keep them up to date.. Try to avoid special cases, turn them into general cases when possible.
And "how much ammo will I have" is irrelevant.. if you have ammo and the shot is worth taking, take the shot, THEN realize you're out of ammo and run away/find ammo. Don't think too far ahead (but also remember things you already tried and don't try them again in the same turn, that would fix so much).
[Updated on: Wed, 06 June 2012 08:38] by Moderator Report message to a moderator
|
Civilian
|
|
|
Re: What should the AI consider?[message #305739]
|
Fri, 08 June 2012 15:10
|
|
JohnnySideburns |
|
Messages:19
Registered:September 2007 |
|
|
how about:
Am I attacking or defending?
Am I clumping up with my friends unnescssarily?
Should I try to flank instead of engaging directly?
Are enough of my friends actively engaged for me/us to flank?
Am I being assertive enough? Do I follow thorough with my plan! instead of changing my mind?
Should I advance, retreat or hold my position?
Am I doing this alone?
Am I Elite, Regular or Weeny?
Will every guy I hate back home nail my hot wife because I left her a widow?
perhaps some way of making group decisions, so they will work with some sort of unity?
Report message to a moderator
|
Private
|
|
|
Re: What should the AI consider?[message #305907]
|
Wed, 13 June 2012 09:11
|
|
JohnnySideburns |
|
Messages:19
Registered:September 2007 |
|
|
Am I getting in my mates line of fire?
if I shoot now is there a chance I'll unload into the back of one of my friends?
are we winning or losing?
should we make a coordinated retreat, and try again another time/ somewhere else?
where are the lines?
Report message to a moderator
|
Private
|
|
|
|
|
|
|
|
Re: What should the AI consider?[message #312583]
|
Wed, 28 November 2012 14:04
|
|
krux |
|
Messages:62
Registered:June 2011 |
|
|
I think people are getting into too small details IMHO. Most important should be to restore some parts of the AI that has been weakened during 1.13 development.
I remember the AI being more agressive, which is something many seem to agree with. A passive enemy will never be a challenge for the player, their only bet is to use their numbers to mob you. Story wise it would make sense with more suicidal enemies as they would probably fear being put infront of a firing squad accused of cowardice, more than they would fear our mercs.
A wild guess about the cause of the "running back and forth-problem" is that offensive and defensive actions is considered of equal value by the AI in too many cases. If these values was more biased towards the extremes, so the AI more often decides to either be really offensive or really defensive, not both on the same time.
If the AI had a commander (in the sense the player is the commander for the mercs) who decides a common strategy for all the soldiers, you wouldn't find situations where it feels like each enemy is running his own race (like one is retreating, while another is attacking). Of course individual morale/status of each soldier should be considered but on the whole there should be a more defined strategy. You would probably not notice that each soldier lacks memory or a plan if this was more defined.
The hardest part to get right would probably be those cases where you'd want the AI to NOT attack but neither do a full retreat. Like enemies defending a sector while the player outperforms them in equipment and firing range. With the "commander" implemented it would probably be easier to define a strategy for the enemy where, say, all troops hide until enough mercs get into reasonable range, then launch a full suicide attack.
tldr version: More aggressive enemies please.
Report message to a moderator
|
Corporal
|
|
|
|
|
|
Goto Forum:
Current Time: Thu Apr 18 11:38:35 GMT+3 2024
Total time taken to generate the page: 0.02047 seconds
|