AI Combat - Alert my friends!

Everything about development and the OpenMW source code.
User avatar
Jyby
Posts: 408
Joined: 10 Dec 2013, 04:16

Re: AI Combat - Alert my friends!

Post by Jyby » 31 Mar 2014, 23:13

One problem with that implementation:

Code: Select all

  |              |       Cell A
  |       NPC    |
-------------------- <-Cell line
  |       me     |
  |              |       Cell B
Wont the NPC try to pursue me until I reach Cell A?

It might be better to keep a list of crimes with the player. When the crime is payed off we iterate the list and reset the actors actors.

There is a lot going on when you go to jail. It is a perfect chance to barrow the CPU since the player is serving his term.


EDIT: But we may still need to tip off guards when the player gets close to them. That seems like a function call we need to make every draw. Which seems like overkill and resource intensive.

Any better ideas?

I've made some major progress when it comes to the basic flow of alarm: http://pastebin.com/ap7K40aV

I'm not sure if this is how it should work.

EDIT: The NPC shouts Thief even if he doesn't attack or report your crime. You can test this in vanilla morrowind by going to Foryn Gilnith's Shack, location 6 on this map, http://www.uesp.net/wiki/File:MW_Map_SeydaNeen.jpg. When you get there proceed to steal his things and hear his cries and yelps. You also won't get a bounty. This means his alarm is 0, because iAlarmStealing = 1. This also means you can kill him without receiving a bounty because he won't alarm anyone.
Macbook Air 2013 - 1.7GHz Intel i7 - 8 GB - 512 GB SSD - Intel HD 5000
Windows 10 PC - 4GHz Intel i7 - 16 GB - 512 GB SSD - EVGA GTX 1060 SSC

Tarius
Posts: 574
Joined: 24 Oct 2011, 19:29

Re: AI Combat - Alert my friends!

Post by Tarius » 01 Apr 2014, 00:38

A good thing to keep in mind is that this can be expanded upon later to act more like Skyrim's crime system where you can kill all the witnesses to your crime.
I am a bigger fan of tons of control rather than taking the "user-friendly" approach.
-Okulo

User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: AI Combat - Alert my friends!

Post by Zini » 01 Apr 2014, 08:52

Wont the NPC try to pursue me until I reach Cell A?
I suspect there is a range limit. Actors shouldn't follow the player forever. But I have no idea what this limit is.
It might be better to keep a list of crimes with the player.
If the list of unresolved crimes is stored in the player data structure or globally does not matter at the moment. It may become relevant, if we ever add multiplayer, but then maybe not. It depends on how that multiplayer implementation goes and that is not something we should concern us right now.
When the crime is payed off we iterate the list and reset the actors actors. There is a lot going on when you go to jail. It is a perfect chance to barrow the CPU since the player is serving his term.
Currently it does not matter, But I am not in favour of implementations that may touch additional cells, because that may bar certain optimisations later.
EDIT: But we may still need to tip off guards when the player gets close to them. That seems like a function call we need to make every draw. Which seems like overkill and resource intensive.
If that is really just a question of distance, then it is no problem at all. These calculations are dirt cheap and doing them every frame will not impact performance. On the other hand, if we need to go for LOS, things look less good. Maybe throttle the check, i.e. perform it only once every couple of frames?

silentthief
Posts: 435
Joined: 18 Apr 2013, 01:20
Location: Currently traversing the Ascadian Isles

Re: AI Combat - Alert my friends!

Post by silentthief » 01 Apr 2014, 18:44

Zini wrote:
Wont the NPC try to pursue me until I reach Cell A?
I suspect there is a range limit. Actors shouldn't follow the player forever. But I have no idea what this limit is.
From play it seems like guards will chase you as long as they can still "see" you, even out into the wilderness far away from town.
Zini wrote:Maybe throttle the check, i.e. perform it only once every couple of frames?
This is how vanilla handles it, as you can sometimes get a couple of seconds time to act/run/attck before enemies (whether they are guards or not). Bethesda even has a quote that says something like "this character is in combat" which it displays when you try to talk to a character that is going to attack someone (usually you)

ST
"You like to dance close to the fire, don't you?."

Post Reply