Jump to content
The Dark Mod Forums

Location based Sound barks possible?


SeriousToni

Recommended Posts

Hi, I was recently thinking about the Thief 3 NPCs that had special voice lines "What are you doing in the bedroom?!" if you woke them up accidentally.

Would it be possible to enhance our TDM voice lines too with a location based system?

We already got the region system where you can setup specific background ambience and efx to regions in the maps. Is there a chance to also set a room attribute to the regions? Like inside / outside, or basement / living room area? So that the NPC knows in what kind of room / area it currently is and respond with more fitting voice line barks, if provided by the voice script?

Would be happy to read your feedback on this idea. Thanks a lot!

  • Like 4

"Einen giftigen Trank aus Kräutern und Wurzeln für die närrischen Städter wollen wir brauen." - Text aus einem verlassenen Heidenlager

Link to comment
Share on other sites

Thanks for this well elaborated answer. For me personally it makes totally sense to do a custom voice line and have the player trigger it in dark Radiant as I'm not a real coding person. This would be the easiest and safest way to make it work.

However if anyone with coding experience wants to dive deeper in extending the possibilities of AI barks, this would be a cool thing to try (if the engine itself allows). We had a small discussion on discord where another user wants to re edit the vocal scripts to improve their recognition of the environment. This would give the possibility of a more varied bark system in my opinion. But I see that it is not as easy doable as I was thinking with my little knowledge.

  • Like 1

"Einen giftigen Trank aus Kräutern und Wurzeln für die närrischen Städter wollen wir brauen." - Text aus einem verlassenen Heidenlager

Link to comment
Share on other sites

@demagogue is there a way to make sure that both, the ai and the player are inside the same room? Otherwise the boundary trigger triggers once and if the player isn't there he / she can't hear the bark.

Edited by SeriousToni
  • Like 1

"Einen giftigen Trank aus Kräutern und Wurzeln für die närrischen Städter wollen wir brauen." - Text aus einem verlassenen Heidenlager

Link to comment
Share on other sites

I also had a scenario in my current map where I wished the location system could be triggered by an AI (although I can't remember what it was now 😂).  Or maybe allow the location entity in the room target something once the location is entered by either the player or some other entity so no scripting required? Potential new feature request maybe?

Edited by Frost_Salamander
  • Like 1
Link to comment
Share on other sites

9 hours ago, SeriousToni said:

@demagogue is there a way to make sure that both, the ai and the player are inside the same room? Otherwise the boundary trigger triggers once and if the player isn't there he / she can't hear the bark.

This is the first idea that comes to me. The easiest thing you can getkey from the AI is the literal xyz coordinate location. So you could have a script make a simple distance check from that to the player's position via good old Pythagoras's Theorem. If you trigger a "nearby" state at a distance that's close enough, that will probably put them in the same room or anyway nearby. And you can get the player's location, so you can still modulate the barks based on that.

In the background of what you're talking about is that with the new text-to-voice AI they have now, we can make new barks that sound exactly like the original voice actor. That makes it possible to add to existing AI barks, so we can make convo barks in the same voice as the system barks, or we can make new system barks, etc. I think there's a lot of good potential with that for unique and more interesting AI interactions in FMs.

  • Like 2

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

Yes I would recommend to try that out if someone is going to add custom barks or conversations to their missions. Results are pretty good and you don't need to bother the original voice actor. Thanks for mentioning that. It was a discussion on the discord channel - I hope to see more conversations and custom audio with this tool on the future :)

Here's the link

https://beta.elevenlabs.io/speech-synthesis

  • Like 1

"Einen giftigen Trank aus Kräutern und Wurzeln für die närrischen Städter wollen wir brauen." - Text aus einem verlassenen Heidenlager

Link to comment
Share on other sites

Here is the script event which should work for AIs:

const idEventDef EV_GetLocation("getLocation", EventArgs(), 'e', 
	"Returns the idLocation entity corresponding to the entity's current location.\n" \
	"This was player-specific before, but is now available to all entities."); // grayman #3013

It works by traversing BSP tree from root to leaf according to the 3D point, so should be very quick.
If you query it once per frame for every AI, then you would probably notice performance impact 🤔

 

On 2/25/2023 at 5:32 AM, demagogue said:

A thing to keep in mind is that most AI are mostly frozen when you're not near them anyway.

This is not true in TDM usually.

Unseen AIs can switch to "interleaved thinking", i.e. move at something like 3-5 FPS rate instead of full rendering framerate. But they still do think and continue their patrols.

The original Doom 3 made all AIs go "dormant" when surely out of reach, but this was disabled in TDM because dormant AIs stop patrolling, and this is usually a problem for a mapper. Only a few TDM missions enable dormancy explicitly, perhaps because it improved performance on release date.

  • Like 2
Link to comment
Share on other sites

I really knew that & shouldn't have said it, but thank you for correcting that.

Oh wow, how did I not hear about EV_GetLocation() before? That's great!

As for the performance part, stgatilov makes a good point. If you want to keep running track of the AI's location, you have to keep the script running in a loop, which can really eat up up cycles. (Performance was one of our big concerns with the Location script itself because of that.)

One thing I'd think about is having the script or EV_GetLocation function called only when an AI is ready to make a bark, and it quickly gets its location from there and makes the bark, and then it's done. Then it's only a one-shot script or function call, which is always better if you can do it.

The catch there is I think that'd call for a custom AI script. The issue is if the a future version of the game ever updates that AI script, the custom scripts won't be updated in that version. But since AI scripts should be self-contained, I mean changes almost always take deprecated old stuff into account so it doesn't break old FMs, a custom AI script shouldn't break the FM with new versions of the game. Those AI just won't have any new bells or whistles, which may still be worth it. Or you just quickly add the new things in and kick out a new version if you need to.

Of course another option is that new functionality is added to the core game itself with some new spawnargs added to AI, where barks can be made Location specific. For that matter, the AI scripts might be updated to be more friendly to adding barks to existing AI generally, now that we have a good text-to-voice app to make them. Then all mappers get the ability to do this. That might be nice, if it isn't a big performance hit or otherwise troublesome.

  • Like 1

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

Just poll every second instead of every frame, and hopefully nobody would notice (also probably randomize offset uniformly up to 1 second to spread this polling uniformly).

The problem is that there is a whole matrix of AI - location pairs. If someone decides to implement such a system, how would mapper specify these settings?

Or you mean something like "location kitchen: want_to_eat_bark", and then add "want_to_eat_bark" to vocal set of a particular AI or a class of AIs. If AI has the corresponding entry, it is added to set of barks, otherwise it is not?

By the way, isn't there already some system to notify AIs near a spot about something and force them to say something specific?...

  • Like 1
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

    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
×
×
  • Create New...