Jump to content
The Dark Mod Forums

Creating "Ambient" AI


Springheel

Recommended Posts

I'm working on a city map, and I'd like to create the sense that there are lots of people around. I don't want to load the map down with AI, however. Is it possible to spawn an AI for a short period of time and then destroy him? I recall people describing that the pathnodes for that behaviour don't quite work properly, and instead they spawn an AI that is just invisible until needed (but still "thinks" and uses up FPS).

 

Ideally, I'd like to have things like AI that the player sees from a distance, walking across a street and disappearing around a corner (then destroyed), or AI like the rats in St. Lucia, that emerge when triggered, but vanish when out of the player's POV. Anyone got some tricks to share?

 

@Tels: Does your "suicide" script work on AI? Could it be used for this purpose?

Link to comment
Share on other sites

I'm working on a city map, and I'd like to create the sense that there are lots of people around. I don't want to load the map down with AI, however. Is it possible to spawn an AI for a short period of time and then destroy him? I recall people describing that the pathnodes for that behaviour don't quite work properly, and instead they spawn an AI that is just invisible until needed (but still "thinks" and uses up FPS).

 

Ideally, I'd like to have things like AI that the player sees from a distance, walking across a street and disappearing around a corner (then destroyed), or AI like the rats in St. Lucia, that emerge when triggered, but vanish when out of the player's POV. Anyone got some tricks to share?

 

@Tels: Does your "suicide" script work on AI? Could it be used for this purpose?

 

Yeah, it should work on AI, because an AI is just an entity. But AI already have a script object (or so I think), so having another script object on them is not possible.

 

And while it should be easy to add support for a spawnarg on AI that says "remove yourself from the game in X seconds", maybe it would be better to use a trigger. Something that automatically removes any object that crosses into its trigger area. (Can build such a thing).

 

However, you might have trouble spawning the AI and then having them follow a path. It might probably be a good idea to fix this anyway, because my LODE also can spawn AI, but then the AI just stands there, even rats.

 

In the meantime, could you teleport your AI around? From blue-room to street and a few seconds later back? Of course, the AI would then always waste CPU... possible crying in the corner of the blue room :)

 

Guess this really needs a small testmap and a few hours experimenting.

"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

Make sure if you do teleport an AI that if he has anything attached to him it will teleport with him. I played around with this a long time ago and have very faint memory that this might have been an issue.

 

The problem with making them invisible with the pathnodes is they're still technically "there" and still make sounds, lol, just not rendered or physical.

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

To take an AI out of the map ...

 

Put him on a path.

 

Create a func_remove with this spawnarg:

 

"target" "<AI's name>"

 

At the point in his path where you want him to disappear, place a trigger_once_entityname with these spawnargs:

 

"entityname" "<AI's name>"

"target" "<func_remove's name>"

 

When the AI walks through the trigger_once_entityname, it recognizes him, triggers the func_remove, and that takes the AI out of the game.

Link to comment
Share on other sites

Let's say, for example, that I want an AI to walk across a street up ahead of the player. If I did this:

 

1. Set AI to be dormant, as well as deaf and blind (so they aren't accidently triggered by an alert)

 

2. Have AI triggered by player reaching a certain spot on the street

 

3. AI walks across to pathnode out of sight, and is then removed using Grayman's method above.

 

would that presumably have a minimal CPU hit?

Link to comment
Share on other sites

Maybe something could be piggybacked onto the Doom3 entity Dormancy-Tests, which is supposed to stop expensive entities from "thinking" when they are out of the Player's PVS.

 

Maybe an extra entity keyVal that causes an entity to be removed ( or reused ) when going dormant.

 

Altho that would probably require a map with good portal placement, to get the most out of something thats based on a PVS test.

Link to comment
Share on other sites

Keep in mind if you make them deaf and blind that's not a spawnarg you can update in-game, so they'll stay that way. So make sure the player really can't interact with them (or whatever else deafness & blindness stops). But you can definitely do Step 2 by having the trigger target the AI (IIRC).

 

The AI in my warehouse is triggered by a trigger-brush, and I went through all of the issues in this thread at one time or another trying to get it to work. So you can see how he was done if something doesn't work. (To keep my AI quiet, BTW, I just gave him a custom .def so I could control his barks. And to keep him from moving early, I just put him behind a door that opened on trigger.)

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

I thinik it is definitely easier to spawn the AI, let it walk to the pathnode, and then let it be removed.

 

The tricks here are:

 

* if a LODE spawns an AI, the AI just stands there. Presumable you can do "target" "path_node_to_walk_to" and he should start patrolling, if this works, you can use a LODE to spawn random AI (targeted at random path starts if you wish). Only problem is "repeated spawning", I can (and should) add this to the LODE (soontobeSEED).

* graymens remove method targets a specific AI - but we want all AI that reaches an area to be removed. I think a custom entity with a custom script object should do the trick.

 

The advantages of the above would be that you do not have a specific AI but can have different ones, even more than one, f.i. it could look like a busy street where people pass from left to right or right to left in an "endless" stream that doesn't repeat (because every AI could look different). And all that by placing one LODE, one "remove-any-AI" entity and two path nodes.

 

If you only want a specific AI walk from A to B this method might be a bit overkill, but since it could do this, too, ''d rather implement it this way than hack around with triggers and so on.

 

@demagogue: Do you mean you made the AI deaf etc so the player cannot alert the by f.i. throwing things at them, shooting at them etc?

"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

When Solarspace mentioned using "Func_Animate" for his Chicken models I immediately thought of this application.

 

1) Setup a bunch of Func_Animate with the same model and animation as AI

2) If player = x distance then replace Func_Animate with real AI

 

From my understanding there was another discussion about bird behavior where the use of AI for the birds was also in question. Did Grayman ever look into concept this further?

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

A related question no doubt easily answered:

 

I would like to have an AI waiting in idle mode until a player gets to a particular point, and then start his patrol. What do I target with the trigger? Do I target the AI, or the first pathnode I want him to walk to?

 

Hm, I'd say the AI, but you'd also need a "waitForTrigger" spawnarg on him (if that is actually implemented). Targetting the path node probably does nothing.

"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 set up the AI targeting a path_wait and then a path_corner. I don't want the AI to start his path_wait until triggered, however.

 

I put wait_for_trigger 1 on the AI, and targetted the AI with a trigger_once entity. However, it doesn't appear to work. The AI just starts his path_wait without waiting for the trigger.

Link to comment
Share on other sites

I set up the AI targeting a path_wait and then a path_corner. I don't want the AI to start his path_wait until triggered, however.

 

I put wait_for_trigger 1 on the AI, and targetted the AI with a trigger_once entity. However, it doesn't appear to work. The AI just starts his path_wait without waiting for the trigger.

 

I guess this is simply not implemented, please file a tracker entry.

 

It could be solved with the "retarget AI at path node", too, because then you could simply start him without any patrol path and add it later. But this isn't implemented either AFAIK.

"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

Aren't there triggered sequences with AI in existing maps? What about grayman's

priest setting off that explosion.

That must have been triggered somehow. But wait_for_trigger doesn't seem to be a valid spawnarg for our AI.

 

What about teleporting the AI into place, along with his pathnodes, after being triggered? Has anyone successfully done that?

Link to comment
Share on other sites

Aren't there triggered sequences with AI in existing maps? What about grayman's

priest setting off that explosion.

That must have been triggered somehow.

 

Maybe via the conversation system?

 

But wait_for_trigger doesn't seem to be a valid spawnarg for our AI.

 

No, I think it is only for triggers.

 

What about teleporting the AI into place, along with his pathnodes, after being triggered? Has anyone successfully done that?

 

I am not sure it would work, but worth a try.

 

These issue could really be handled easier for mappers, but at the moment I do not want to dive into AI coding. Maybe if grayman has his pathing changes ready, he could take a break and work on changing path_nodes of AI dynamically? It seems to be a popular request atm.

"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 just found a "path_waitfortrigger" entity...I'll see if I can get that to work.

Link to comment
Share on other sites

Ah, cool, that does it! The "path_waitfortrigger" basically operates like a wall, blocking the AI from proceeding until triggered.

 

Here are the steps for future reference. Let's say you want an AI to stand somewhere until a player triggers him, then you want him to walk to path_corner 1.

 

1. Make a "path_waitfortrigger" pathnode, and have it target "path_corner_1".

 

2. Have the AI target the "path_waitfortrigger" pathnode.

 

3. The AI will stand where they are at map start and behave as if there are no pathnodes set (ie, he plays idle animations and can be alerted).

 

4. Create a trigger_once entity, and target the AI.

 

5. When the player goes through the trigger, the "path_waitfortrigger" is cleared and the AI will proceed to path_corner_1.

Link to comment
Share on other sites

Ah, very cool. Need to add this to the AI artikle on the wiki.

"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

It seems to work reasonably well so far, though I have noticed an oddity or two. I'll have to play with it some more to see if it's reliable.

Link to comment
Share on other sites

  • 3 years later...

To take an AI out of the map ...

 

Put him on a path.

 

Create a func_remove with this spawnarg:

 

"target" "<AI's name>"

 

At the point in his path where you want him to disappear, place a trigger_once_entityname with these spawnargs:

 

"entityname" "<AI's name>"

"target" "<func_remove's name>"

 

When the AI walks through the trigger_once_entityname, it recognizes him, triggers the func_remove, and that takes the AI out of the game.

ive just done the above the Ai isnt being removed, any idea's..?

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

      The FAQ wiki is almost a proper FAQ now. Probably need to spin-off a bunch of the "remedies" for playing older TDM versions into their own article.
      · 1 reply
    • 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 )
      · 3 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
       
      · 7 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
×
×
  • Create New...