Mod assets folder questions (please help)

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Mod assets folder questions (please help)

Post by kelly1111 »

I have a few newbie questions concerning memory usage on exporting a map (compiling). Currently I am putting alot of time into my dungeon, but I don't want to find out to late that I have to change everything or start over, because it won't export (memory wise)

1. Is there a max size to your mod assets folder ? At what size will it become troublesome ?
I am asking this because I keep adding tilesets and my mod asset folder size is getting rather big "480mb"

A: What sizes are your mod assets folders / so I could get a rough estimate on what is normal

B: Does it matter what size the mod assets folder is performance wise? I noticed that I get an error when exporting the map at around memory ussage 1600mb "40%" of the processor

C:when I turn the graphic settings to low detail and export it works fine, but is this method valid or will it break the game later on when you try to play it?

2. What things will hinder the exporting proces? (alot of textures? , alot of objects in your dungeon?, to many levels?, to many scripts / or to large scripts? )

3. the .dat file size / is there a maximum for that too ?

4. I have turned off some standard assets (like for instance the castle materials and objects... but do not notice any difference in .dat file size of mod assets size. Am I looking at it wrong here?
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Mod assets folder questions (please help)

Post by minmay »

The Windows version of Grimrock 2 is a 32-bit application without the large address aware flag. This means that it gets 2 GiB of address space, no matter how much RAM your computer actually has. Furthermore, it uses DirectX 9 which reserves a bunch of additional address space for itself, and stores copies of textures in the main application's address space, not just VRAM. That means that most of your address space will be occupied by textures, and when you get the out of memory error, it will mainly be because of a combination of 2 things:
1. you have too much texture data
2. the save game code causes a large memory balloon, especially if your dungeon is not using minimalSaveState properly
Because of memory fragmentation and DirectX 9 reserving a bunch of address space without telling you, you can expect imminent crashes at around 1.5 GiB of reported RAM usage (in Task Manager), and imminent crashes upon saving much earlier than that, depending on how much crap has to be saved in your dungeon.
You can, of course, flip the large address aware bit in your own grimrock2.exe to give it 4 GiB of address space instead, which will make editing and exporting more convenient, but this won't help you when other people play your dungeon and get an out of memory error.

The Mac version always gets at least 3 GiB of address space, so it is a lot harder to run out of memory there.

Your settings do not matter for exporting the dungeon. All that exporting does is combine all the files in mod_assets with certain extensions into a .dat file, plus some metadata (the name of the dungeon, game version, etc.). Because, again, textures get stored in main memory, setting your texture resolution to Low will free up memory for exporting without affecting the exported file. Exporting uses a lot of memory because compression uses a lot of memory.
kelly1111 wrote:1. Is there a max size to your mod assets folder ? At what size will it become troublesome ?
The size of your mod_assets folder can be used as an approximation for your additional memory usage, but it will not be very accurate for the memory used by models, and of course it won't tell you about the memory used by your dungeon for Lua (all the objects and components etc) at all.
You're better off looking at the, well, actual memory usage in Task Manager.
However, the size of your .wav and .dds files on disk are a good approximation of memory usage ingame since each sound and texture file gets loaded exactly once* and RIFF wav and DDS file formats are almost identical to how the texture is stored in memory.
*(unless of course you never define a sound or material using it or draw the texture with gui functions, in which case it is loaded exactly zero times)

If by "performance" you mean "framerate", in practice the performance difference between a dungeon that uses 1 GiB of assets and a dungeon that uses 100 MiB of assets is basically nonexistent, unless the user has less memory than the game's listed minimum system requirements or something like that. If by "performance" you mean "load time", dungeons that use more assets take somewhat longer to load (but not to save in, since assets don't get saved, it would be ridiculous if they did).

The size of the .dat file is not a good approximation of anything because it is compressed. Like how a .zip file's size isn't a good approximation of the size of the files inside it.
kelly1111 wrote:4. I have turned off some standard assets (like for instance the castle materials and objects... but do not notice any difference in .dat file size of mod assets size. Am I looking at it wrong here?
The dungeon editor doesn't copy the standard assets into your mod_assets folder or the exported .dat file. What would the point of that be? They're the standard assets, they're already in grimrock2.dat! Excluding standard assets won't affect the size of your .dat. However, it WILL reduce your memory usage, because assets loaded from grimrock2.dat use just as much memory as assets loaded from the mod's .dat.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: Mod assets folder questions (please help)

Post by kelly1111 »

Thanks Minmay
That helped explain a few things for me.
I am at the threshold for memory usage, like you mentioned at around 1500mb

I have another few questions:

1. When making a mod/dungeon in respect to memory usage: Is it better to script all your tilesets, objects, items.. in your own scripts?
What I mean is, only script in the things your need, although that will take alot of work - I ask this because the way I am doing it now is adding tilesets on the go "winter tileset, germanny's tileset, dark-elf tileset, etc.... and alot of stuff from these sets I don't even use

A: Do you have any tips on how to do this? (is it better to start over fresh or use my existing dungeon mod and work backwards removing stuff I don't need from the scripts, texture folders, model folders... ?

B: Any tips on how to best structure my folders and scripts?
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Mod assets folder questions (please help)

Post by minmay »

You should certainly not be loading textures/sounds if you do not actually use them. So including sets wholesale when you only use parts of them is a bad idea. That goes for the standard assets too. How you do that is a matter of personal preference.
Also PLEASE don't use that Temple conversion, it's godawful and broken and breaks your mod.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Post Reply