GithubHelp home page GithubHelp logo

gtav_audio_occlusion_documentation's Introduction

Audio Occlusion in FiveM

This is an example set up for a 247 store. These files were exported from codewalker and then commented to create these instructions.

Importing these files in to the game will most likely not work, since the 247 store is already there.

You can reverse the 247 file contents and values using the below formulas to see and recognize patterns, and create your own custom interior audio files.

All Integers greater or lesser than Int32.Max/Int32.Min must be converted to Int32.

You can use the following: $number & 0xffffffff

Below are references to comments in the files and their purpose.

We've found ntOffset to not matter, set it to 0.

References

    stream/1690616543.ymt.pso.xml

OcclusionHash

The formula to generate an unsigned occlusion hash is:

    {$archetypeName.Hash} ^ ({$mlo.pos.x} * 100) ^ ({$mlo.pos.y} * 100) ^ ({$mlo.pos.z} * 100)

Then use whatever to get it signed.

FileName

File name is the Occlusion Hash

RoomIdx

This is the source room ID index as seen in the <rooms> key in the ytyp file.

DestRoomIdx

This is the destination room ID index as seen in the <rooms> key in the ytyp file.

PortalIdx

This is the portal ID based on the index of the <portals> key in the ytyp file.

Important note: this is the index of the <portals> list AFTER it has been filtered based on RoomIdx.

MaxOcclusion

Range from 0.0 to 1.0.

hash_E3674005

Entity hash, of the door, window, etc.

If there is no objects attached then the PortalEntityList needs to be empty.

PathNodeList

The PathNodeList is used describe audio paths between two rooms. That can be rooms directly connected such as Room1 -> Portal0 -> Room2 (direct link) or rooms connected through multiple rooms and portals like Room1 -> Portal0 -> Room2 -> Portal1 -> Room3 (bridge link). We'll call each entry in this list a PathNode.

A "direct link" only links rooms together explicitly, meaning that even if you create Room 0 -> Room 1 and Room 1 -> 2, audio is not routed from Room 0 -> Room 2 as there is no direct link or a bridge link.

PathNodeList > Key

This key is unique per direction and is generated by using this formula: (StartRoomHash - EndRoomHash).

Below you can find a list of examples of key generation for
Room 0 -> Room 1
Room 1 -> Room 0
Room 1 -> Room 2
Room 2 -> Room 1


NOTE: WHEN GETTING JOAATS - ALWAYS USE LOWER CASE!


PathNodeList > Key - Generation

GTA V uses 1-5 "channels" between each room, so the actual value you'll be using in the PathNodeList.Key is whatever the result of (StartRoomHash - EndRoomHash) is + 1 ... 5. That means that you'll have to create N amount of PathNodes of each PathNodeList.Key. We usually just create three nodes. That means that for Outside -> Room 1 which is 2124924645, you'll have three PathNodes, with the PathNodeList.Keys [2124924646, 2124924647, 2124924648].

Room definitions

Name Ytyp Name joaat
Outside limbo joaat("outside") = 3086856661
Room 1 V_66_ShopRm joaat("V_66_ShopRm") = 1569794095
Room 2 V_66_BackRm joaat("V_66_BackRm") = 462608346

This is from the outside to the first room

  room1Hash = occlusionHash ^ Room 1

            => 1690616543 ^ 1569794095

            = 961932016

  PathNodeList.Key = Outside - room1Hash

            => 3086856661 - 961932016

            = 2124924645

This is from the first room (the actual shop) to the outside

    room1Hash = occlusionHash ^ Room 1

              => 1690616543 ^ 1569794095

              = 961932016

    PathNodeList.Key = room1Hash - Outside

              => 961932016 - 3086856661

              = -2124924645

This is from the first room to the back room

    room1Hash = occlusionHash ^ Room 2

              => 1690616543 ^ 1569794095

              = 961932016

    room2Hash = occlusionHash ^ Room 2

              => 1690616543 ^ 462608346

              = 2136347909

    PathNodeList.Key = room1Hash - room2Hash

              => 961932016 - 2136347909

              = -1174415893

This is from the back room to the first room

    room2Hash = occlusionHash ^ Room 2

              => 1690616543 ^ 462608346

              = 2136347909

    room1Hash = occlusionHash ^ Room 1

              => 1690616543 ^ 1569794095

              = 961932016

    PathNodeList.Key = room2Hash - room1Hash

              => 2136347909 - 961932016

              = 1174415893

When using and adding these keys, you will increment by 1 from the base value. They also need to be in an order where a key must be declared before it can be referenced in PathNodeKey.

PathNodeList > PathNodeChildList

As previously mentioned, a PathNodeList.Key must be unique Add <Items> in to this list to create multiple audio sources (in and out) for the same room.

PathNodeList > PathNodeChildList > PathNodeKey

If this value is 0, its a direct reference to the PortalInfoIdx entry.

If this value is not 0, it is a direct reference to another PathNodeList.Key value. This is used to link audio through multiple portals.

PathNodeList > PathNodeChildList > PortalInfoIdx

Reference to a PortalInfoList entry by index.

Garbage

Native GTA uses the same files for multiple interiors. You only want to reference the ones you are interested in.

Dat15

This is very straight forward.. 

File: audio/v_shop_247_mix.dat15.rel.xml

Scene

Set <Name>$Dat15_Scene_Name</Name> to whatever

Set <Patch>$Dat15_Patch_Name</Patch> to whatever

Patch

Set <Name>$Dat15_Patch_Name</Name> to the value you set in Scene.

In  you can add definitions for ambient zone sound (limits or boosters(?)) - Check existing .dat15 for all the different variants you can use.

Dat151

AmbientZoneList <Item type="AmbientZoneList">

Create an <Item>$AmbientZoneName</Item> with a name for the AmbientZone and add it to 

AmbientZone <Item type="AmbientZone">

You can basically use most of whatever is in the template, but you'll have to change a few things.

Set OuterPos and InnerPos to the position the Ytyp and then you can use the following formula to calculate the size OuterSize (You should probably pad this with with 1.0) and InnerSize. Get the Minimum and Maximum Extents and use it to calculate the size of the box.

Set the name of the <Name>$AmbientZoneName</Name> to the name you decided in the AmbientZoneList($AmbientZoneName)

Set the name of <UnkHash1>$Dat15_Scene_Name</UnkHash1> to a name you set in Dat15

    

    Vector3 boxSize = extentsMax - extentsMin;

    Vector3 center = new Vector3(extentsMin.X + boxSize.X / 2, extentsMin.Y + boxSize.Y / 2, extentsMin.Z + boxSize.Z / 2)

    <OuterPos x="center.X" y="center.Y" z="center.Z" />

    <OuterSize x="boxSize.X" y="boxSize.Y" z="boxSize.Z" />

    <InnerPos x="center.X" y="center.Y" z="center.Z" />

    <InnerSize x="boxSize.X" y="boxSize.Y" z="boxSize.Z" />

Hashes contains the hashes of the staticEmitters - I wont go into detail about them.

Interior <Item type="Interior">

Name needs to be the archetype (e.g. v_shop_247)

For each room in your interior you'll need to add an $WhateverYouWantAsANameForYourRoom in , the name you choose however has to be the same name in "InteriorRoom".

InteriorRoom <Item type="InteriorRoom">

File: audio/v_shop_247_game.dat151.rel.xml

For each room you have in your interior you have to create an entry with this (use this template basically and change anything with $)

      <Item type="InteriorRoom">

      <Name>$WhateverYouWantAsANameForYourRoom (from Interior)</Name>

      <Flags0 value="0xAAAAAAAA" />

      <MloRoom>$MloRoomName</MloRoom>

      <Hash1>$AmbientZone</Hash1>

      <Unk02 value="0" />

      <Unk03 value="0.5" />

      <Unk04 value="0" />

      <Unk05 value="0" />

      <Unk06>null_sound</Unk06>

      <Unk07 value="0" />

      <Unk08 value="0" />

      <Unk09 value="0" />

      <Unk10 value="0.55" />

      <Unk11 value="0" />

      <Unk12 value="50" />

      <Unk13 />

      <Unk14>hash_D4855127</Unk14>

    </Item>

You can tinker with the values, we haven't had the time to note down what they do exactly.

Unk04 Reverb?

Unk05 Echo

Unk06 is the "room sound" or whatever (tone master?)

Unk13 is the static emitter hash

Credits (In no particular order)

Blade
xIAlexanderIx
Dwjft
GottfriedLeibniz
Everyone else that answered my questions :slight_smile:

gtav_audio_occlusion_documentation's People

Contributors

nikez avatar robwhitewick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

gtav_audio_occlusion_documentation's Issues

Crash on load with .dat files

My game crash when i load .dat15 and .dat151 files.
I tried all day yesterday to find out why it does that, but no hope..
It could be greate if anyone wanna explain why it does that, because i have now spent many hours and no luck..

Map download
https://forum.cfx.re/t/mlo-secret-weapons-room/1877982

Files (github only allowes .txt)
fxmanifest.lua.txt
gigz_shell_weapon_room_col_game.dat151.rel.txt
gigz_shell_weapon_room_col_mix.dat15.rel.txt
gigz_int_weapon_room_milo_.ymap.txt

Native Voice doesn't work in addon interior room of native MLO

Hello, I'm trying to get occlusion working in the La Fuenta Blanca. This interior is in GTA natively, but there is an interior from UncleJust, that expands that interior to few more rooms (room4, room7...) etc. I've linked the rooms with portals (going to rework that tomorrow, because works only one-way for some reason), so the voice flows between rooms.

The main problem now is that, when I enter room4 or room7 with another person and door fully closes, the voice slowly cuts out. When someone opens the door, we can hear each other again. I've succesfully linked room4 with the corridor, so we can hear each other through the door, but it when both of us get inside, the voice cuts out.

I'm clueless where the problem might be. Is it something in ytyp or ymap? Maybe the ymt is missing something. Any help would be appreciated.

Thanks.

795232540.ymt.pso.xml.txt
v_int_56.ytyp.xml.txt
apa_ch2_03c_interior_v_ranch_milo_.ymap.xml.txt

(GitHub doesn't support XML, had to upload it in TXT)

Occlusion Hash: *.ymt file doesn't load

Hey,
i am trying to implement the Audio Occlusion files for this interior: https://github.com/Evgenius33/Pillbox-Hospital-Interior

The dat151 and dat15 files are already working thanks to your documentation and Codewalker. I already tested them and I got reverb/echo in the hospital rooms.

My problem is, that the *.ymt file doesn't even get downloaded by fivem, because (my guess) I think the game doesn't request these files from streaming?

What I have done:

  1. Calculate the Occlusion Hash
    1. Get the coordinates and the Archetype from the .ymap
    2. Archetype: phxlsmc_interior_col (hash: 85189926)
    3. Coords: 327.6865, -580.5995, 60.59223
    4. I tried both calculations: (the second gives a different result, because I tried to just cut the decimal numbers.
      85189926 ^ Math.floor((327.6865 * 100)) ^ Math.floor((-580.5995 * 100)) ^ Math.floor((60.59223 * 100)) & 0xffffffff
      = -85168199
      85189926 ^ 32768 ^ -58059 ^ 6059 & 0xffffffff
      = -85168200
  2. Created the -85168199.ymt file. For now, just the connection between 0 (outside) and 1 (entrance). Full file attached as xml.
<Item>
 <InteriorProxyHash value="-85168199" />
 <PortalIdx value="0" />
 <RoomIdx value="0" />
 <DestInteriorHash value="-85168199" />
 <DestRoomIdx value="1" />
 <PortalEntityList itemType="hash_F6624EF9" />
</Item>
<Item>
 <Key value="-575889495" />
  <PathNodeChildList itemType="hash_892CF74F">
  <Item>
   <PathNodeKey value="0" />
   <PortalInfoIdx value="0" />
  </Item>
  <Item>
   <PathNodeKey value="0" />
   <PortalInfoIdx value="1" />
  </Item>
 </PathNodeChildList>
</Item>
  1. Tried the same files with -85168198, -85168199, -85168200 as Occlusion Hash (and InteriorProxyHash, DestIneriorHash)
  2. Loaded into Fivem, opened strlist and searched for these files. They never showed up and never got added to the cache index.

Maybe important info:

  • I looked up other *.ymt files in update\update.rpf\x64\audio\occlusion.rpf. None of them has a filename with a negative number?
  • Each .ymt file has multiple entries with different InteriorProxyHashes. Maybe same archetype at different locations?
  • When I rename my .ymt file (with the InteriorProxyHash from above) to a original gta file that gets loaded by the game (search for .ymt in strlist), my .ymt file gets downloaded by FiveM, gets added to the cache index and shows up in the strlist. - But doesn't have any effect.

Files (these are xml files, but Github only allows them as .txt)

phxlsmc_interior_col_mix.dat15.rel.xml.txt
phxlsmc_interior_col_game.dat151.rel.xml.txt
-85168198.ymt.pso.xml.txt

I hope you have an idea, what I am doing wrong. When I figured everything out, I plan to extend this documentation with my findings and to upload the audio files to the hospital repository.
Thanks.

FiveM Crash when streaming dat151

I've followed this guide and i keep checking and comparing it with all the documentation and everything seems like it should work. However when i attempt to stream the file, using the correct fxmanifest (as given in the documentation) the game crashes as it loads giving an error message stating :

"class audMetadataDataFileMounter." linking to the dat151 file.

Not working

TownHall.zip
Hello, I've been trying to get Gabz Townhall working with occlusion, but it seems like something isn't working somewhere. I really don't know to who seek the help from, whether its you or gabz. This may even be the tool since it hasn't been updated within the past two months so not sure if its even working properly anymore. I thought about sending you a dm on discord about it but decided this would most likely be better.

Small edit: The door occlusion/echo/reverb effects are the things that don't seem to be working anymore.

FiveM can only run occlusions for a single map

So when you use this method to make another set of audio occlusions for another map so for example I have:
MLO - Warehouse
MLO - Mafia

And we make occlusions for Warehouse and run it they work, then we make it for Mafia and start that resource 2nd in the config, Occlusions will work for Warehouse but not mafia, if we disable warehouse and its occlusions then occlusions will work for Mafia. Is there a way to run both sets of audio occlusions?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.