Jump to content
The Dark Mod Forums

Simple animals


Baddcog

Recommended Posts

Follow that rat! It stole our cheese, it did! :laugh:

My games | Public Service Announcement: TDM is not set in the Thief universe. The city in which it takes place is not the City from Thief. The player character is not called Garrett. Any person who contradicts these facts will be subjected to disapproving stares.
Link to comment
Share on other sites

  • Replies 179
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Wooo... amazing creatures these rats. Started with 3 together locked in derelict house. As usual they pretty soon head for the back door which is locked. There they hang about until the guard patrols by and unlocks the door. Fortunately for them there is a flaw (reported elsewhere and which the rats have obviously read) and he leaves the door half open. They all scurry out.

 

The black rat turns left and the other two head right. I follow them. I lose track of one of them but the other goes to the next house along and starts scratching at the door and looking back at me imploringly like a little dog waiting for me to open the door. I open it and he goes in. Think I see the pale one too. Then I go back to look for the black rat. He is still hanging around near the derelict house. He scurries round the corner, round the other side as far as the far doorway but it's boarded up so no pathing. He makes his way back, not in one walk but back and forth in increments of different sizes but with seemingly clear intent. When he gets back to the open derelict back door in he darts. He has an apple core in here. This is his route. Not related to path corners as far as I can tell but he just likes the derelict house and its outer walls.

 

I walk back up to the next house and go in. The pale rat is stuck against the dead man's chair moonwalking. His clockwork is running down and his legs moving at half speed. The other rat is scratching for me to let him out the opposite door into the street. I let him out and off he goes, exploring the next street and working his way up. He explores round the next corners back and forth but eventually he decides he likes this house and tends to hang around there.

 

I go back to the derelict house and the black rat is stuck in a corner against an overturned chair that the guard uses to climb up into the rafters. Guess it's too high for the rat. His clockwork is also running down. I go back and find the other rat who eventually also works his way back to the derelict house and also gets stuck in the same place.

 

They are amazingly lifelike and if the problems of getting stuck, and of scratching at doors, and keeping them away from unwanted areas can be worked out then this random scouting around is fascinating. Perhaps some sort of GOTO entities can be set up as perimeters. If a rat reaches that border they get an impulse to goto the centre of the territory again. Whatever random scouting around algorithm you set up greebo it certainly looks convincing. I suspect you generate a target somehow and when they reach it then a new one is generated because they certainly seem to have purpose and intelligence. I hope we can somehow keep this method even if it needs a spawnarg to switch it off in some situations.

 

Footnote: These were all set to team 0. dunno if that is relevant. they ignored me.

Link to comment
Share on other sites

Wow, you certainly spent some time observing them. :laugh: Glad you like the way they behave. I didn't code very much, it's a pretty low-level loop.

 

Before I coded that in, I watched a short Youtube video of rats running around at night in a KFC fast food restaurant and it's quite easy to see that their overall behaviour boils down to:

 

1 Look or sniff around

2 Run to somewhere nearby, often in non-linear paths and more importantly, in a random direction

3 optionally wait

4 goto 1

 

That's basically what my algorithm does. Additonally I put another option in to follow one of their next path_corner entities, so that the mapper has the possibility to "lead" them a bit. This option is randomly chosen, but eventually they follow the path_corners.

 

Thinking about this, placing two path_corners in a house, both targetting themselves (forming a "closed loop"), and the rat targetting one of them, will lead to the rat most probably not leaving the house.

Link to comment
Share on other sites

That sounds cool, I wanna check it out now. Thanks for making variety skins too :)

 

Is there someway you could make a 'time-out' for them greebo?

If> in one place too long

then>goto 1

 

That way they'd scratch at a door for maybe 10 seconds, then decide to go elsewhere. I think that might be the easiest way to make them look like they don't get 'stuck'.

Dark is the sway that mows like a harvest

Link to comment
Share on other sites

Is there someway you could make a 'time-out' for them greebo?

If> in one place too long

then>goto 1

That way they'd scratch at a door for maybe 10 seconds, then decide to go elsewhere. I think that might be the easiest way to make them look like they don't get 'stuck'.

I can implement something like that, yes. I don't know if that will help much, but it's worth a try.

Link to comment
Share on other sites

Look or sniff around

 

Yes, this is the missing animation that we need, I think. The rat needs a simple, 'stand in one place and sniff' animation to play as well as the "sit up on haunches and sniff" animation.

 

I enjoyed reading your little rat adventure, Fidcal, that was highly entertaining. :)

 

(in fact, I might post it on the website for fun on the next update, if you don't mind)

Link to comment
Share on other sites

Bit more... Tried default team 5 and they all came after me. I hid in fireplace but they got me pinned in. I use broadheads and they go over on their sides writhing. That's pretty good. I can pick them up and lob them at the guard. Their legs still animate after death so needs tweaking to time out after a while. By default it partly solves the scratching at a door because they will come after you (unless you are hid in dark I guess.) What is team 5 anyway? I couldn't figure it out from wiki. Something to do with matrixes.

 

I'll experiment later with path corners to see if I can influence them and also look at the two places they got stuck. It might just be a matter of rethinking how we monsterclip and where.

 

@springheel : yes, that'd be fun and maybe a screenshot of a rat?

Link to comment
Share on other sites

Shouldn't the rats try to avoid the player and maybe also have a preference for dark places?

 

I guess greebo could add some quick check into the algorithm for their "random patrol" and make them go in the opposite direction more likely if they spot the player?

 

Likewise, if spot brightly lit => move faster/earlier.

"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 planned to make the rats just go into Flee state. The fleeing code is already in place (see test/flee.map), so I'll probably just re-use that one. I haven't looked into "hostile" rats so far, that's why they are still trying to attack the player instead of running away. :)

Link to comment
Share on other sites

Oh man, these things are adorable! :wub:

 

A few videos; the first shows a possible issue among those listed previously. I seem to have made either a really good friend or an enemy. :) He followed me around relentlessly, till I shot him with an arrow, then he seemed to go about his business again. This was reproduced.

 

http://208.49.149.118/thedarkmod/temp/rat1.wmv

 

Two more vids, just for cuteness' sake (and for anyone else who may not have checked them out prior to now). Shadow possibilities abound:

http://208.49.149.118/thedarkmod/temp/rat2.wmv

http://208.49.149.118/thedarkmod/temp/rat3.wmv

 

Am I the only one with an overwhelming desire to frob them? :laugh:

Link to comment
Share on other sites

On the default team the rats homed in on the AI's ankles while I hid in the rafters. He kept recoiling. In the console it said something about 'no escape point'. Is that something mappers should set up, like a flee point? On team 0 they ignore him.

 

I just trapped a rat behind a door. I can see that is might be possible to use this in a mission - to actually have say a small rat cage and lay it in the path of a rat and catch it for some purpose. Release it somewhere to distract a guard or drive the maid from the kitchen while you rob the gold plates. My guess is the cage would be a moveable and its door a mover door bound to the cage. Might even be able to have a piece of cheese in their with a stim and the rat with a response - triggers the door shut.

 

I put two linked path corners in the derelict house where they start to see if they would tend to stay there but they behaved much as before. One hangs around that area. I found the others stuck again in another house.

 

The hop up and down modest steps quite well. Don't know what their step height limit might be. They look excellent as background movement and very natural running in a street etc. Yes, if they were to flee from all other creatures, have some means of fixing them if they get stuck, and have some barrier control like a deterrent to keep them away from some areas they'd be great. If they were to flee from all creatures maybe an unrendered entity with this same deterrent effect could be placed my the mapper at strategic points to control their areas.

 

 

On other thought about the above maid - a new AI spawnarag 'flees_from_rats' ?

Link to comment
Share on other sites

On the default team the rats homed in on the AI's ankles while I hid in the rafters. He kept recoiling. In the console it said something about 'no escape point'. Is that something mappers should set up, like a flee point? On team 0 they ignore him.

Yes, you can setup specific flee points for each team. See test/flee map for a few examples. The "team" spawnarg on the flee entities define the team they apply to.

 

I put two linked path corners in the derelict house where they start to see if they would tend to stay there but they behaved much as before. One hangs around that area. I found the others stuck again in another house.

Hm, and both path_corners are doubly linked against each other (like this O

 

On other thought about the above maid - a new AI spawnarag 'flees_from_rats' ?

I would think a noblewoman might be afraid of rats, but maids are presumably not so well-situated and probably used to seeing these little buggers?

Link to comment
Share on other sites

Think I completely misunderstood. I thought you were saying they run around randomly instead of the normal patrol method but you mean as well as? So now I have set them up to target the first path corner of two that are double linked to each other and generally they go back and forth but they do also slip outside and around - but they are not wandering so far. Possibly when looking at another pathable route.

 

I've noticed elsewhere that if an AI is patrolling and the player gets blocks the path way ahead then the AI can detect this. I've only noticed it with a friendly patrolling up and down a stair. If I happen to be at the top just as the AI is getting on at the bottom I think he reacts and starts scanning for another way but there isn't one. When I move back out the way then he proceeds. I hope that doesn't affect enemies because I am assuming it's not because he can see me but just that some kind of 'path blocked' is detected. If so, then in theory an enemy guard could be patrolling along, the player need only block the way in the dark (a street away) and the guard go a different way. I'm wondering if the rats were doing that. Just occasionally a guard was coming along. There is restricted room. Rat detects cannot get from path corner A to B so instead goes outside to find another route or something.

Link to comment
Share on other sites

I've noticed elsewhere that if an AI is patrolling and the player gets blocks the path way ahead then the AI can detect this. I've only noticed it with a friendly patrolling up and down a stair. If I happen to be at the top just as the AI is getting on at the bottom I think he reacts and starts scanning for another way but there isn't one. When I move back out the way then he proceeds. I hope that doesn't affect enemies because I am assuming it's not because he can see me but just that some kind of 'path blocked' is detected. If so, then in theory an enemy guard could be patrolling along, the player need only block the way in the dark (a street away) and the guard go a different way. I'm wondering if the rats were doing that. Just occasionally a guard was coming along. There is restricted room. Rat detects cannot get from path corner A to B so instead goes outside to find another route or something.

 

I don't know the code, but that sounds plausible. If the path can't be reached (because blocked by something) they would go a different way. Hopefully it can be made so they ignore the block by the player altogether.

"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

This is due the obstacle avoidance code, which runs each frame to check for entities in the way. I can imagine that Fidcal's scenario (AI walks around player in darkness without seeing him) can be problematic.

 

It's not enough to ignore the player, though, because this would affect friendly AI too (and they would dumbly moonwalk against the player). The actual behaviour is probably a function of relationship (friend or foe), lightgem level and entity==player.

Link to comment
Share on other sites

This is due the obstacle avoidance code, which runs each frame to check for entities in the way. I can imagine that Fidcal's scenario (AI walks around player in darkness without seeing him) can be problematic.

 

It's not enough to ignore the player, though, because this would affect friendly AI too (and they would dumbly run into the player).

 

Foe: can see player => attack

 

Foe: can't see player => dumbly run into him, then attack

(can't know path is blocked)

 

Friend: can see player => walk towards player, run into him, then walk other way

(based on the idea the player might move out of the way until we are there, and if he hasn't, only then find other way)

 

Friend: can't see player => walk towards player, run into him, then walk other way

(can't know path is blocked)

 

So all cases (for friend and foe) are the same unless the foe has spotted the player already.

 

Did I forget some cases?

"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

Foe: can see player => attack

 

Foe: can't see player => dumbly run into him, then attack

(can't know path is blocked)

 

Friend: can't see player => walk towards player, run into him, then walk other way

(can't know path is blocked)

 

So all cases (for friend and foe) are the same unless the foe has spotted the player already.

Yes, these are all ok I guess - it boils down that an invisible player should be ignored by the code.

 

This one is not quite accurate:

Friend: can see player => walk towards player, run into him, then walk other way

(based on the idea the player might move out of the way until we are there, and if he hasn't, only then find other way)

The obstacle avoidance code works each frame, and the AI will dynamically path around the player "obstacle". You can see that very nicely when you stand in the way of a patrolling (friendly) AI - it will immediately try to path around you. You can even check it out visually, by setting the cvar ai_showObstacleAvoidance to 2, which will show you how the code is operating.

 

At any rate, this is not a problem, I just thought I let you know how the obstacle code is functioning.

Link to comment
Share on other sites

Yes, these are all ok I guess - it boils down that an invisible player should be ignored by the code.

 

my case-studie (forgive the pun :) was meant as a "thats how it should work", not as a description on how it works now.

 

This one is not quite accurate:

 

The obstacle avoidance code works each frame, and the AI will dynamically path around the player "obstacle". You can see that very nicely when you stand in the way of a patrolling (friendly) AI - it will immediately try to path around you. You can even check it out visually, by setting the cvar ai_showObstacleAvoidance to 2, which will show you how the code is operating.

 

At any rate, this is not a problem, I just thought I let you know how the obstacle code is functioning.

 

I am torn on if this should be changed. Getting obstacle avoidance "right" is difficult because sometimes there is no real "right" decision.

 

However, maybe it shouldn't run every frame,anyway? (performance) and maybe it would be good enoughif the AI decided once per second if something is blocked or not?

"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

my case-studie (forgive the pun :) was meant as a "thats how it should work", not as a description on how it works now.

Yes, I know. I'm completely with you on that, I just thought I'd point it out.

 

As it looks, we will definitely have to tweak the obstacle avoidance code so that the player (if encountered and invisible) is ignored, but the general code is ok, no need to change that. It's not a huge thing, if we don't forget about it, it's done in an hour or so.

 

As for performance: I don't know whether it is bad or not to interlave the obstacle avoidance code - we will have to test it, I can only speculate how the behaviour would change. A good portion of the performance concerns has been resolved by the recent AI think interleaving (which includes obstacle avoidance, btw).

Link to comment
Share on other sites

Yes, I know. I'm completely with you on that, I just thought I'd point it out.

 

Yeah no problem, such subtle points sometimes get overlooked by me :)

 

As it looks, we will definitely have to tweak the obstacle avoidance code so that the player (if encountered and invisible) is ignored, but the general code is ok, no need to change that. It's not a huge thing, if we don't forget about it, it's done in an hour or so.

 

Should we add it to the tracker then?

 

As for performance: I don't know whether it is bad or not to interlave the obstacle avoidance code - we will have to test it, I can only speculate how the behaviour would change. A good portion of the performance concerns has been resolved by the recent AI think interleaving (which includes obstacle avoidance, btw).

 

Ah, so they don't do that every frame, but only when they "think".That will be faster than already so not sure if interleaving would really help.

 

Fascinating stuff anway :D

"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 months later...

Hey, thanks this was quick. :) I'll check it out - it won't be today, but maybe next week.

 

edit: just saw that you committed it to the darkmod/ repository - I'll move that to model_src.

Link to comment
Share on other sites

I just added a flesh surfaceType to these little fellows, because it seemed odd that the arrows breaks and gives a "plock" sounds when they are hit.

But after some testing with this, i'm kinda not sure if this is better. Stuck rat anyone ? ;)

 

It also sometimes causes hitching when the arrow is stuck to the rat and the physics system doesn't know what to do.

 

Is there a surface-type that would cause the flesh-hit effect but either break the arrow or make it "go through" ?

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

    • nbohr1more

      Was checking out old translation packs and decided to fire up TDM 1.07. Rightful Property with sub-20 FPS areas yay! ( same areas run at 180FPS with cranked eye candy on 2.12 )
      · 2 replies
    • taffernicus

      i am so euphoric to see new FMs keep coming out and I am keen to try it out in my leisure time, then suddenly my PC is spouting a couple of S.M.A.R.T errors...
      tbf i cannot afford myself to miss my network emulator image file&progress, important ebooks, hyper-v checkpoint & hyper-v export and the precious thief & TDM gamesaves. Don't fall yourself into & lay your hands on crappy SSD
       
      · 5 replies
    • 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.
      · 7 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
×
×
  • Create New...