Pages: [1]
  Print  
Author Topic: [WIP] Improving the AI  (Read 1819 times)
Neon_Knight
In the year 3000
***

Cakes 49
Posts: 3763


Trickster God.


« on: June 02, 2019, 09:45:20 AM »

Quote from: Steven Polge
AI is a vital to most games as a key mechanic for providing challenging and interesting situations and choices for players. Sometimes AI implementations unnecessarily try to address features that don't improve the experience, and often AI implementations fail to make the game as interesting and challenging for the player as they should have. By challenging, I don't mean hard, but rather engaging and though provoking, and not easily exploitable.

In terms of implementation, rather than provide a laundry list of features like path finding, obstacle avoidance, etc., I think it's more important to consider how the player will perceive the AI. The number one requirement for good AI is to never (or at least almost never) look stupid. Players will much more readily notice (and judge AI based on) recurrent examples of brain dead behavior, rather than occurrences of brilliant tactics. Certainly, players appreciate smart, unexpected, and emergent behavior, but only if it's reasonably obvious what's happening. To this end, it's vital that your NPCs provide a lot of feedback about what they are thinking and doing through speech and animation.

The AI needs to understand the rules, strategy, and tactics of the game as well as a player of similar skill level would. It needs to have a knowledge model about the game world and game state that is similar in limitations to what a player would know. For FPS games, it's also very important for the AI to have a human-like aiming model, with the same kinds of strengths and weaknesses in hitting targets under various conditions that would affect a human player.

[The challenge is] successfully implementing all the features and capabilities I've described. One important factor is prioritizing AI sufficiently, and early enough in the project, in the face of many other issues and features that are more immediate needs during the development of the game. It's also important to consider the AI implementation for the design of any game features with which the AI will interact. Many games seem to have AI whose development was rushed or tacked on late in development.

Some areas of the bot AI in OA needed to be polished and perfected. I've been working on several areas of the code for quite some time, but there's still a lot of work to be done. These two days that have passed, I've been working almost exclusively on the AI. Here's a test pk3, up to commit d0cc77c.

Things that need to be tested:

  • Domination (general behavior)
  • Possession (general behavior)
  • Rocket jumping behavior
  • Grappling hook behavior
  • Just in case there are problems, 1FCTF behavior

To do:

  • The problem reported by Sub-Zero in Discord, regarding the bots not using MG in long distances. I think I've found the culprit, but I need to be sure.
« Last Edit: June 04, 2019, 12:26:57 PM by Neon_Knight » Logged


"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.
andrewj
Member


Cakes 24
Posts: 581



« Reply #1 on: June 02, 2019, 08:11:18 PM »

One thing I've noticed is how the bots don't like to simply jump down to a lower level, they always walk to the edge, look down and slowly walk off the edge.  It is very unhuman like, and makes the vulnerable to attack while doing this.

The other main thing that bugs me is that the bots will engage you in battle while their health is high, but get a rocket hit on them (or whatever) and suddenly they are running away to get some health.  I get the logic behind it, but I think humans are more likely to try to finish off their opponent before going to heal up.
Logged
fromhell
Administrator
GET A LIFE!
**********

Cakes 35
Posts: 14519



WWW
« Reply #2 on: June 02, 2019, 08:13:41 PM »

That last bit corresponds to a bot's defined self preservation value IIRC.


My curiosity about the bot code is about that interbreed/script generating stuff that was gutted out of the bot library altogether.  There's probably some of that in gladiator but i didn't check that either.  Unfortunately any questions I might have will never be answered as Mr. Elusive passed away some years ago. Sad


If I go to edit the AI though it'd be for 'cosmetic' reasons, like giving more personality potential (i.e. specific character reactions, love/hate relationships) to flesh out the cast more...
« Last Edit: June 02, 2019, 08:39:16 PM by fromhell » Logged

asking when OA3 will be done won't get OA3 done.
Progress of OA3 currently occurs behind closed doors alone

I do not provide technical support either.

new code development on github
Gig
In the year 3000
***

Cakes 45
Posts: 4382


WWW
« Reply #3 on: June 03, 2019, 04:47:02 AM »

First bit of feedback.
Scenery:
- I tried on OACMPDM10, that I know has the aas compiled with grapplereach option.
- I set bot_grapple 1
- I was often using g_grapple to give the grapple to all users (note: after you enable/disable it, the grapple is given/removed to the player on respawn).
- I was using bots at skill 4, because at skill 3 and lower in their personality files ([botname]_c.c) CHARACTERISTIC_GRAPPLE_USER is set to 0.5 instead of 1.0, I suppose meaning they are less interested into using the grapple. Exception being Liz that for lower skill levels has it set to 0.1!
- I often played in TDM mode, ordering them to "follow me", to see if they used the grapple to reach me.

Things I noticed:
- It looks like they do not try anymore to use it if they do not have it. Good.
- It looks like they do not shoot at the same spot over and over again aborting it before starting to be pulled. But I would need more tests, as for the moment I only found one place where they would actually use it to follow me.
- It looks like if I go in places they cannot reach also by standard means, they will no go there anyway not even with the hook (on the roof of the BFG building).
- The only place of that map for now I found they use the grapple to follow me is inside the warehouse, going from the lower floor to the stairs near to the crates. Sometimes they succeed, but unfortunately more often they bump against the stairs and fall down, then try again (and they may fail again or succeed). I should mention that those specific stairs give some issue to bots in general, at times they jump down from the stairs instead of reaching the Dom point a few units in front of them. So it would be good to find some more places where to try the grapple.
- I'm not sure if bots do have any interest into picking grappling hook up, even in case they don't have it already. I brought five bots following me very near to the grapple spawn point, then ordered them to "roam" and they scattered without anybody of them taking the hook.
- I had to do the tests in TDM mode because I noticed that in Domination and Double Domination (maybe also other modes, but I haven't tried others today) bots do not reply correctly to some team orders. They do "report" correctly, and accept correctly the "dominate A/B" commands in DD, but they do ignore completely the "follow me" and "camp here" commands, they do not even reply to the chat in Dom, or reply with "I'll dominate point A/B" to a "follow me" order in DD! (Reminder, bots listen to team orders only using "team chat", not public chat).
- Bots do not seem to move when they have the "flight" item (which sometimes spawns in the warehouse)!

PS: It would be useful, for testing purposes, to at least temporarily have a way to "pimp up" the "will" of bots to actually use the grapple. It looks like they use it very rarely, even if they are at skill 4.... so it's hard to observe their behavior...
« Last Edit: June 03, 2019, 07:43:15 AM by Gig » Logged

I never want to be aggressive, offensive or ironic with my posts. If you find something offending in my posts, read them again searching for a different mood there. If you still see something bad with them, please ask me infos. I can be wrong at times, but I never want to upset anyone.
Neon_Knight
In the year 3000
***

Cakes 49
Posts: 3763


Trickster God.


« Reply #4 on: June 03, 2019, 08:00:51 AM »

I still have to work on the DD/DOM team orders, they're not properly implemented. (And some special changes have to be done for those modes, not sure how I would handle the menu in DOM but UT2004 had "Attack Point A" and "Attack Point B" instead of "Attack" and "Defend").
Logged


"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.
Gig
In the year 3000
***

Cakes 45
Posts: 4382


WWW
« Reply #5 on: June 03, 2019, 08:20:47 AM »

I still have to work on the DD/DOM team orders, they're not properly implemented. (And some special changes have to be done for those modes, not sure how I would handle the menu in DOM but UT2004 had "Attack Point A" and "Attack Point B" instead of "Attack" and "Defend").
I'm at the phone right now... IIRC in DD "roam" was interpreted by bots as something like "choose yourself the A/B point you wish to attack", which may fit. Maybe adding a more descriptive alias for the command, such as "attack/do at will"?
Maybe in Dom "roam" may do the same ("choose yourself a dom point to attack")?
In case you also plan to add the ability to give specific orders about which exact Dom point to attack, there is the problem that their number and their names may vary... so one should make the orders menu "dynamic" to read the point names from the map... or should name them "first one, second one, third one..." following the order they are listed in upper right corner, which may nor be optimal.
Maybe one could instead just add "attack" (attack neutral and enemy points) and "defend" (roam between the points of our team, or only around one of them), in addition to "roam" (choose yourself)....

JUST BRAINSTORMING...
Logged

I never want to be aggressive, offensive or ironic with my posts. If you find something offending in my posts, read them again searching for a different mood there. If you still see something bad with them, please ask me infos. I can be wrong at times, but I never want to upset anyone.
Neon_Knight
In the year 3000
***

Cakes 49
Posts: 3763


Trickster God.


« Reply #6 on: June 03, 2019, 08:34:14 AM »

One thing I've noticed is how the bots don't like to simply jump down to a lower level, they always walk to the edge, look down and slowly walk off the edge.  It is very unhuman like, and makes the vulnerable to attack while doing this.

The other main thing that bugs me is that the bots will engage you in battle while their health is high, but get a rocket hit on them (or whatever) and suddenly they are running away to get some health.  I get the logic behind it, but I think humans are more likely to try to finish off their opponent before going to heal up.
I've noticed that behavior too, should be fixable because it does look unnatural.

As for the second paragraph, this piece of code from ai_dmq3.c shows that behavior:

Code:
/*
==================
BotFeelingBad
==================
 */
float BotFeelingBad(bot_state_t *bs) {
if (bs->weaponnum == WP_GAUNTLET) {
return 100;
}
if (bs->inventory[INVENTORY_HEALTH] < 40) {
return 100;
}
if (bs->weaponnum == WP_MACHINEGUN) {
return 90;
}
if (bs->inventory[INVENTORY_HEALTH] < 60) {
return 80;
}
return 0;
}

The bot returns a "cowardice" value (the higher the value the more likely they will retreat) after certain checks. If they have only the Gauntlet or their health has lowered to 40HP they will be more prone to running away than if they have Gauntlet+Machinegun or their health is below 60HP. I was thinking that armor should be taken into consideration.

This "cowardice" value is then used in other two functions: BotGetLongTermGoal (for a check in Overload mode where the bot doesn't want to attack the enemy obelisk anymore) and BotWantsToRetreat (self-explanatory). In both cases, if the "cowardice" value is over 50, they will retreat.
« Last Edit: June 03, 2019, 08:38:19 AM by Neon_Knight » Logged


"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.
Neon_Knight
In the year 3000
***

Cakes 49
Posts: 3763


Trickster God.


« Reply #7 on: June 03, 2019, 05:55:46 PM »

So... I've separated each botfix into a separate branch. It's going to be better this way since we can focus on . Here are the fixes per branch:

- Bot chats: https://github.com/OpenArena/gamecode/pull/65
- Rocketjumping: https://github.com/OpenArena/gamecode/pull/66
- Grappling hook: https://github.com/OpenArena/gamecode/pull/67
- Domination: https://github.com/OpenArena/gamecode/pull/68
- Possession: https://github.com/OpenArena/gamecode/pull/69
Logged


"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.
Neon_Knight
In the year 3000
***

Cakes 49
Posts: 3763


Trickster God.


« Reply #8 on: June 03, 2019, 08:41:53 PM »

One thing I've noticed is how the bots don't like to simply jump down to a lower level, they always walk to the edge, look down and slowly walk off the edge.  It is very unhuman like, and makes the vulnerable to attack while doing this.
Apparently this behavior is in the engine side of things. And I'm yet not confident enough to go to that area.
Logged


"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.
andrewj
Member


Cakes 24
Posts: 581



« Reply #9 on: June 03, 2019, 11:47:40 PM »

One thing I've noticed is how the bots don't like to simply jump down to a lower level, they always walk to the edge, look down and slowly walk off the edge.  It is very unhuman like, and makes the vulnerable to attack while doing this.
Apparently this behavior is in the engine side of things. And I'm yet not confident enough to go to that area.
Perhaps the bspc tool could change TRAVEL_WALKOFFLEDGE into TRAVEL_JUMP? I will experiment with it today....

UPDATE: tried it just now, on a large drop they did jump but not on a small drop (128 units), however they still slowed down and looked down before jumping, so that behavior must be hard-coded in the engine.
« Last Edit: June 04, 2019, 12:12:32 AM by andrewj » Logged
Gig
In the year 3000
***

Cakes 45
Posts: 4382


WWW
« Reply #10 on: June 04, 2019, 01:01:15 AM »

About "taking some care before jumping down isn't human like"... well it depends from what you consider human! In real life, with no respawn, I would pay attention! ^_^
Sorry, I can't parkour!

  Grin Grin Grin

I don't want to troll, just to have a smile!  Smiley
« Last Edit: June 04, 2019, 01:04:15 AM by Gig » Logged

I never want to be aggressive, offensive or ironic with my posts. If you find something offending in my posts, read them again searching for a different mood there. If you still see something bad with them, please ask me infos. I can be wrong at times, but I never want to upset anyone.
Gig
In the year 3000
***

Cakes 45
Posts: 4382


WWW
« Reply #11 on: June 04, 2019, 01:25:41 AM »

One thing I forgot to say yesterday: while spectating a bot which tried repeatedly to perform that hook use in the warehouse (it tried, bumped against the walls, falled down so got some damage and tried again, and again and again), I noticed that it continued trying up to dying by "cratering" at the end. It even had the portable medkit, but it didn't use it and just consumed all of his health a little at time.

I don't remember which bot it was, maybe sarge, grism or assassin...
Logged

I never want to be aggressive, offensive or ironic with my posts. If you find something offending in my posts, read them again searching for a different mood there. If you still see something bad with them, please ask me infos. I can be wrong at times, but I never want to upset anyone.
andrewj
Member


Cakes 24
Posts: 581



« Reply #12 on: June 04, 2019, 03:10:09 AM »

About "taking some care before jumping down isn't human like"... well it depends from what you consider human! In real life, with no respawn, I would pay attention! ^_^
Heh.

I just experimented with changing the engine code -- the function is BotTravel_WalkOffLedge() in the file ai_move.c -- and found I could improve behavior somewhat, though needed extra code to ensure the speed did not get too low, otherwise a bot could get to the edge and simply stop because speed became zero.

But I actually think this function should not be changed, not much anyway.  What probably needs to happen is make the bspc tool produce better end coordinates for TRAVEL_WALKOFFLEDGE, since at the moment they are typically very vertical (X and Y coordinates of start and end are only a few units apart) so the bot is doing a very vertical fall.  If the end coordinate was out from the wall by 32 or 64 units, then I think they could fall off without slowing down.
Logged
Neon_Knight
In the year 3000
***

Cakes 49
Posts: 3763


Trickster God.


« Reply #13 on: June 04, 2019, 08:12:34 AM »

There's a fork created by Id's own Timothy Besset. And Sago also forked it.
Logged


"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.
sago007
Posts a lot
*

Cakes 62
Posts: 1664


Open Arena Developer


WWW
« Reply #14 on: June 04, 2019, 11:38:02 AM »

i would prefer calling it "Improving the AI". "Fixing" suggest that the AI is broken and I don't see any major bugs. Most of the things are improvements and some seems to suffer from regressions.

Domination and Possession could really need some improvements though.
Logged

There are nothing offending in my posts.
andrewj
Member


Cakes 24
Posts: 581



« Reply #15 on: June 05, 2019, 04:55:31 AM »

There's a fork created by Id's own Timothy Besset. And Sago also forked it.
I am working on my own fork too, but it is not ready to go public yet.
Logged
Neon_Knight
In the year 3000
***

Cakes 49
Posts: 3763


Trickster God.


« Reply #16 on: June 05, 2019, 12:52:56 PM »

Cleaned up ai_team.c

This should allows us to take a better look at how the bots are organized in team matches.
Logged


"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.
Pages: [1]
  Print  
 
Jump to: