Jump to content
The Dark Mod Forums

Call for missing mouth offsets and eye heights


grayman

Recommended Posts

A couple bugtracker issues involve drowning.

 

The code uses the AI's mouth location to figure out if there's water at that spot, which means the AI can't breathe. It's expecting a spawnarg called "mouth_offset" (defined in the *.def files) to find the mouth's location.

 

"mouth_offset" is supposed to be an [x,y,z] vector which is:

 

* the offset from the head origin if there's a separate head

* the offset from the eyes position if there's no separate head

 

Unfortunately, "mouth_offset" doesn't show up anywhere in the *.def files, so by default it's [0,0,0].

 

This means:

 

* human AI's drown if the base of their neck is underwater

* animal AI's drown if their eyes are underwater

 

I could drop AIs into water to come up with estimates for the missing "mouth_offset" values, but it'll be more accurate if anyone familiar with the models could give me the real values. I need one for the human head and one for each of the AIs that don't have separate head models. For the latter, I probably just need the Z value.

 

Also ...

 

A few AIs (rats, spiders, ...) are missing the "eye_height" spawnarg. So that defaults to 0 and they end up drowning if their feet are underwater, since "eye_height" is the distance from the floor.

 

So please check your models for proper "eye_height" and provide me with that.

 

 

I'll plug everything into the *.def files.

 

Thanks!

Link to comment
Share on other sites

The animal AI you could probably just load into DarkRadiant and see what the eye height is on the grid. I'll have to check the humanoid AI separately. If you can make a tracker entry and assign it to me that will help me remember.

Link to comment
Share on other sites

The animal AI you could probably just load into DarkRadiant and see what the eye height is on the grid. I'll have to check the humanoid AI separately. If you can make a tracker entry and assign it to me that will help me remember.

 

Done.

 

#2421

Link to comment
Share on other sites

There is also the issue that rats are good swimmers, so they shouldn't actually drown. But that is probably already tracked (can't check right now).

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

There is also the issue that rats are good swimmers, so they shouldn't actually drown. But that is probably already tracked (can't check right now).

 

Agreed, but rats aren't aware of water, so they just walk along the bottom until they die, regardless of water depth.

 

Would be nice if they could walk into water over their head and look like they're swimming across the surface.

Link to comment
Share on other sites

The animal AI you could probably just load into DarkRadiant and see what the eye height is on the grid. I'll have to check the humanoid AI separately. If you can make a tracker entry and assign it to me that will help me remember.

 

I've made estimates for the animals. At some point it would be good for the modelers to verify the numbers after they're checked into SVN. Change them if necessary.

 

And "mouth_offset" is misleading. For many AI, it should be "nose_offset", since they can breathe through their nose even if their mouth is submerged. So when you come up with this offset for humanoids, make it for the nose and not the mouth. I've done that with animals like the horse and belcher, where the nose is well above the mouth.

Link to comment
Share on other sites

Agreed, but rats aren't aware of water, so they just walk along the bottom until they die, regardless of water depth.

 

Would be nice if they could walk into water over their head and look like they're swimming across the surface.

 

I think the animation for that would be missing. Cod-wise, it is doable, although there might be problems like that water surfaces have no AAS? So the rat wouldn't know where to swim to if it enters the water.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

I think the animation for that would be missing. Cod-wise, it is doable, although there might be problems like that water surfaces have no AAS? So the rat wouldn't know where to swim to if it enters the water.

It's already on the tracker that AI aren't aware of deep water that they can't walk through. It might be possible to create a new "swim" movement type that's like the existing "fly" movement type (using a 3d grid of AAS points), but constrained to stay within the water. The AAS compiler is not in the SDK, though.

Link to comment
Share on other sites

I've set eye_height and mouth_offset values for non-humanoids that define the breathing/drowning border.

 

Couldn't simply use measurements from DR; those don't always match the idle measurements at runtime.

 

 

Made small code changes in two areas. Dead bodies were still executing the drowning check to see if they should take damage and/or die.

 

 

I just need the humanoid values to finish testing.

 

Link to comment
Share on other sites

Ok, as best I can tell the offset should be +12. It won't be exactly the same for every AI, but it should be pretty close.

Link to comment
Share on other sites

You could try a debug display (or an attachment at the same point) to show you where a given offset is ending up on the head, then adjust it ingame by doing reloaddecls and spawning a new AI, until it appears in the right place.

 

Thanks for the suggestion.

 

However, I just finished with this a few minutes ago. It's as close as I can get it. Some of the animations move the head in and out of the water (i.e. the horse) and you can see where the horse is drowning when his snout is in the water and breathing when it's out.

 

I added a debug display over an AI's head that says "Drowning (H)" or "Breathing (H)" where H = health so I could easily tell when either was happening. This will be turned off at checkin time. We can turn it on in the future to debug new AI.

 

The only place I cheated was with the spiders. They breathe through the bottom of their abdomens, so technically they should drown in a few units of water. But I think having spiders move through shallow water is okay, so I bumped the drown level up so it's a bit less than the vertical midway of their abdomens.

 

I didn't test all the variations of human AIs because there are so many. I worked with a Citywatch Guard to set the proper height, which should be good for nearly all of them. Any oddballs can be corrected if/when they're found.

Link to comment
Share on other sites

Great! Now all we need is an AAS modification so that AI know not to walk into water deep enough to drown them. :)

 

Given that water height can dynamically be raised/lowered, I don't think that would work. Dynamic AAS modificatins like for elevators are tricky, because it is not easily possible to tell whether an area will floor later, or not.

 

However, a basic "survivor trait" could be coded in, like "water level is rising higher than ankles/kneedeep" -> uhoh try to find dry land (check AAS spots nearby until I find one not covered by water, if none, use the one with the shallest water level). The "swim" animation could also also be tied in later, but for now a simple "I am not gonna run there and then drown" fixup would be already better than what we have (e.g. flee => drown).

 

The ankle/kneedeep would be to cover cases where a patrol leads the AI throug a puddle, we don't want the to panic just because of that :)

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

The ankle/kneedeep would be to cover cases where a patrol leads the AI throug a puddle, we don't want the to panic just because of that :)

 

I'd vote for a waist-deep check, since that should be sufficiently realistic. A water level check is already done each frame, where waist = the vertical halfway point of the bounding box. So the situation we're talking about only needs to check that setting, and not determine water depth on its own.

 

This would help the lanternbot. I put one in water over his head and he eventually died. But while still alive, he was moving all his parts and spouting steam every few frames. Didn't look realistic. Keeping him out of deep water would avoid this situation. (But if he fell into water over his head, he'd look a bit silly while dying.)

Link to comment
Share on other sites

I'd vote for a waist-deep check, since that should be sufficiently realistic. A water level check is already done each frame, where waist = the vertical halfway point of the bounding box. So the situation we're talking about only needs to check that setting, and not determine water depth on its own.

 

Yeah, I remember this code, checking for "waist deep" would indeed be easier.

 

Edit: Tangent: Does the AI get slowed down propertional to water-depth? Walking waist-deep should be slower than ankle-deep. I think it does for the player, but for AI? If not, both should get slowed down.

 

This would help the lanternbot. I put one in water over his head and he eventually died. But while still alive, he was moving all his parts and spouting steam every few frames. Didn't look realistic. Keeping him out of deep water would avoid this situation. (But if he fell into water over his head, he'd look a bit silly while dying.)

 

Hm, maybe he should simply explode when fallen into water that deep? It's a steam engine, so it could stop working once the boiler cools down and the water seeps in, but maybe an explosion is more spectacular and solves the silly-death?

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

  • 2 weeks later...

Given that water height can dynamically be raised/lowered, I don't think that would work. Dynamic AAS modificatins like for elevators are tricky, because it is not easily possible to tell whether an area will floor later, or not.

How often does that happen? Are mappers going to be frequently creating ponds/lakes that can be drained and re-filled? If they are going to go to the trouble of creating dynamically raised water, they can put in an AAS blocking entity as well to dynamically block the AI from walking in there.

 

A pre-check at the start of the map would work for the great majority of situations where AI would otherwise walk into deep water and drown.

Link to comment
Share on other sites

How often does that happen? Are mappers going to be frequently creating ponds/lakes that can be drained and re-filled? If they are going to go to the trouble of creating dynamically raised water, they can put in an AAS blocking entity as well to dynamically block the AI from walking in there.

 

I don't know how often it happens, but a mapper shouldn't have to handle that situation - it can get pretty tricky, because if the water is low, the AI should walk in, and if not, should walk out - but how do you tell that the AI? I bet mappers don't even know that (if it is actually possible yet).

 

A pre-check at the start of the map would work for the great majority of situations where AI would otherwise walk into deep water and drown.

 

Yes, it is better than nothing, but I'd still prefer a dynamic solution :)

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 2 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
×
×
  • Create New...