YMAP: Spawning bigger props and YTYP

Hi, I’m trying to create an YMAP file but I’m having some issues.

I use CodeWalker to create a new project and a new YMAP.

Adding entities will work most of the time and I will be able to see them in game.
But when I try to add buildings, thing doesn’t work as expected.

ie, let’s say I want to had this trailer on Michael’s tennis field:

I let CodeWalker calculate the extents as usual and I save my file:

I set this_is_a_map 'yes' in my resource and put test_trailer.ymap in the stream folder.
Then I call RequestIpl("test_trailer"); (C#).

In the end, the trailer won’t appear in game (but this time it matters).

CodeWalker also tells me this prop is bound to an YTYP file (country_06_metadata_008_strm.ytyp). It seems important but I still don’t understand what’s its purpose.

From what I saw with the interiors, I thought that:

  • YMAP tells the game where to place the main props and how should they behave (physics or not, etc.)
  • YTYP holds props collections with relative position to allow the devs to have an evolutive YMAP (you can swap between a clean map to a messy one just by changing the prop collection)

I guess I’m wrong since YTYP seems to have something to do with spawning bigger props.

Can someone explains what is missing to be able to see the trailer in game?

2 Likes

_manifest.ymf file that ties your ymap to a ytyp?

2 Likes

Hello, you have to force the loading of the corresponding ytyp which holds the archetype definition for the trailer because this one is loaded only when needed (when you are on the right place on the map).

RequestIpl is not required here if your ymap is not scripted.

There you go in your __resource.lua

data_file 'DLC_ITYP_REQUEST' 'x64u:/levels/gta5/_hills/country_06/country_06_metadata.rpf/country_06_metadata_008_strm.ytyp'

country_06_metadata_008_strm.ytyp contains the archetype defintion

  <Item type="CBaseArchetypeDef">
   <lodDist value="50" />
   <flags value="0" />
   <specialAttribute value="0" />
   <bbMin x="-5.132303" y="-9.107202" z="-2.345699" />
   <bbMax x="5.132334" y="9.107262" z="2.345698" />
   <bsCentre x="1.525879E-05" y="2.95639E-05" z="-4.768372E-07" />
   <bsRadius value="10.71376" />
   <hdTextureDist value="25" />
   <name>cs6_01_tmp_trailr01</name>
   <textureDictionary>cs6_01_tmp_trlr</textureDictionary>
   <clipDictionary />
   <drawableDictionary />
   <physicsDictionary />
   <assetType>ASSET_TYPE_DRAWABLE</assetType>
   <assetName>cs6_01_tmp_trailr01</assetName>
   <extensions />
  </Item>
4 Likes

Wow thank you, I didn’t know about RequestIpl either :slight_smile:

Forcing the game to load country_06_metadata_008_strm.ytyp works well:

I think I’m starting to figure out what’s going on:

  • myMapProps.ytyp is basically a list of models (each entry is called Archetype) and it can be used by any ymap as long as it is loaded (we can use _manifest.ymt to create a dependency and load the ytyp for a specific ymap).

  • myMap.ymap contains the locations where the entities will spawn. An entity must refers to a loaded Archetype declared in an ytyp file in order to know what model and textures to use.

  • _manifest.ymt creates a dependency between the ymap and the ytyp (it tells the game that this ymap needs this ytyp and it must be loaded).

  • If some prop can be spawned without loading an ytyp that’s because this ytyp is already loaded by another ymap.

Do I get it well?

Some values still bother me.
What is the purpose of bbMin, bbMax, bsCentre and bsRadius?
Is the GUID required and how could I generate a unique one? Leaving it to 0 seems to work but it must be useful to the game if it exists.
I wanted to use the timestamp but some GUID are a lot further than the current year so I could generate a GUID that is already in use.

And do we know what kind of data file we need to use in __resource.lua for _manifest.ymt?

Thanks a lot to you two! :smiley:

Glad to see it working :slight_smile:

The two most common archetypes I seen in an ytyp are :

  • CBaseArchetypeDef = Prop definitions
  • CMloArchetypeDef = Interior définitions

bbMin / bbMax = Boundig box min / max (in short, the ‘extents’ of the prop)

The GUID must be unique in the current file otherwise your props will disappear.

Manifests just need to be placed in /stream folder. And yes they can be used to create ymap / ytyp relationship.

The ytyp is not necessarily loaded by an ymap, it can be loaded directly as an DLC_ITYP_REQUEST (what we do the easy way with FiveM __resource.lua data_file entry).

In your case it is loaded by an ymap, thats why we proceed that way.

There is plenty of tiny details but your assumptions are correct.

1 Like

Ah and bsCentre = bouding center (the center of the prop)

bsRadius is the the boundig sphere radius, it is related to bbMin / bbMax (bounding box)

1 Like

I was able to spawn multiple props all with a GUID of 0 and I didn’t notice any issue. That’s why I find it kinda odd.
But anyway, if it has to be unique for the current file only, then it is easy to handle.

It doesn’t seems to be loaded when simply placed in the stream folder. I’m quite sure we need to add a data file line in __resource.lua.
I thought it would be cleaner to let the game load/unload the file as needed instead of forcing it to be loaded all the time :wink:

Thanks for the explanations about the bounding boxes size also, I didn’t understand why it was written here but I guess it is to calculate the entities extents (otherwise, it would cut to the center of the farest prop).

I’m still missing some parts but it is so much clearer now!

For interiors, duplicate guid failed for me. I may be wrong for manifests and it could explain why my last attempt with them was a failure. If you have any information about them please let me know ! I think force loading the ytyp is not a big issue, but you can also copy the archetype definition in a separate ytyp, remove it from the original by overriding it in stream and make a DLC_ITYP_REQUEST for the new ytyp (put it in stream too). This way you have ONLY the selected archetype definition loaded all the time. I guess it should still work with original ymap.

Kinda brutal but that would be one way to proceed :smile:

I will try some values from this documentation and see if it helps: https://docs.fivem.net/game-references/data-files/

Hello friends, I put the .ytyp, but it goes without collision, solutions?

same problem

I created a ymap file contains v_16_mid_shell prop and imported the ytyp:
data_file 'DLC_ITYP_REQUEST' 'x64h:/levels/gta5/interiors/v_int_16.rpf/v_int_16.ytyp'
But It doesn’t have collision.

So i found out that there is a file v_apart_midspaz.ybn that suppose to be the collision file, but how do i stream this file? I just added this file in stream folder but not working!