Page 1 of 2

Grimrock 2 and memory usage/limits

Posted: Mon Dec 01, 2014 12:12 pm
by Phitt
For my mod I'm planning to add quite a lot of custom assets and since Grimrock 2 is a 32 bit application and already has a lot more assets and data than Grimrock 1 I'm wondering whether it's possible to run out of memory. Well, of course it's possible, but what I mean is possible with a large, but still reasonable amount of custom assets. Tbh I only know how to look at the task manager and I'm not 100% sure how ram usage works in combination with other apps like the OS (which is 64 bit Windows 8.1 in my case). I don't even know how much ram exactly a 32 bit app can use, on Wikipedia they say that it can only use 2 gb maximum per app unless you use a 3 gb switch/flag to remove ram normally reserved for the OS. And I also don't know if Grimrock 2 automatically loads all assets, including assets from the original game that may not be used in the mod. Couldn't you prevent assets from loading in Grimrock 1? I vaguely remember something like that, but it may have been another game.

If I load a save game from the original game Grimrock 2 has ~1.1 gb memory usage, if I load a test dungeon with a few custom assets I made it uses ~0.9 gb. If this was the true amount of ram used and if I could make full use of 2 or maybe even 3 gb then it wouldn't be a problem - a set of 1024x1024 textures (dif, normal, spec) has ~2.7 mb, so I could easily add 300+ of them without any problems (don't think I'll even come close to that, I'd be surprised if I needed more than 100).

Could anyone enlighten me what I have to expect? Thanks!

Re: Grimrock 2 and memory usage/limits

Posted: Mon Dec 01, 2014 12:20 pm
by OGDA
I had problems with adding 3 different new tilesets and assets for them.
The editor would crash if the file size of the exported file was something over 250 MB.
I removed one of the tileset packs and now the exported file is about 150 MB.

Re: Grimrock 2 and memory usage/limits

Posted: Mon Dec 01, 2014 1:12 pm
by Drakkan
I do not have any custom tileset, just few custom objects (about 50mb) and it happened to me around 4-times that editor crashed because memory lack :/
So I am in the same expectation as you are, hope it will not be happening more and more often with dungeon (objects) size :/

Re: Grimrock 2 and memory usage/limits

Posted: Mon Dec 01, 2014 1:21 pm
by kelly1111
Same problem here, cannot export my mod, getting memory error. first mod I tried was fine, it was about 160mb..
but this new one with more tilesets is around 540mb ... (and I already deleted some tilesets to get to 450mb)
So I am guessing, it is way to large ???

Damn this is a setback for me, if this is indeed the problem (large mb's on all the different tilesets), then I have to redo my dungeon from scrap

Or could there be another problem with this memory issue ? Kinda hard way to find out, so late....
Anyone know what the size can be of the mod assets file in total before the editor crashes / or won't export it anymore?
I have a high end pc.. (that shouldn't be the problem right?)

deleted more stuff... at 420mb it worked... still wondering what max mod asset folder size can be ?

Re: Grimrock 2 and memory usage/limits

Posted: Mon Dec 01, 2014 2:07 pm
by petri
One simple way to get more memory is to rip out Grimrock 2 assets that you are not using. Grimrock 2 assets are loaded to the dungeon by importing standard_assets.lua script in dungeon's init file. If you remove this import you should get a really bare bones dungeon. You should then be able to import only the stuff that you need. For example, if you add a new wallset, you could leave away e.g. castle wallset if you are not using it in your mod.

Here is the contents of the standard_assets.lua where you can find all the assets imported.

Code: Select all

import "assets/scripts/objects/base.lua"
import "assets/scripts/tiles.lua"
import "assets/scripts/spells.lua"
import "assets/scripts/recipes.lua"
import "assets/scripts/sounds.lua"
import "assets/scripts/ambient_tracks.lua"
import "assets/scripts/races.lua"
import "assets/scripts/char_classes.lua"
import "assets/scripts/skills.lua"
import "assets/scripts/traits.lua"

-- import objects
import "assets/scripts/objects/generic.lua"
import "assets/scripts/objects/dungeon.lua"
import "assets/scripts/objects/tomb.lua"
import "assets/scripts/objects/mine.lua"
import "assets/scripts/objects/forest.lua"
import "assets/scripts/objects/beach.lua"
import "assets/scripts/objects/castle.lua"
import "assets/scripts/objects/swamp.lua"
import "assets/scripts/objects/cemetery.lua"
import "assets/scripts/objects/breakable.lua"
import "assets/scripts/objects/portal.lua"
import "assets/scripts/objects/beacon_tower.lua"
import "assets/scripts/objects/pushable_block.lua"
import "assets/scripts/objects/water.lua"
import "assets/scripts/objects/sky.lua"
import "assets/scripts/objects/magic_bridge.lua"
import "assets/scripts/objects/stone_philosophers.lua"

-- import items
import "assets/scripts/items/accessories.lua"
import "assets/scripts/items/armors.lua"
import "assets/scripts/items/clothes.lua"
import "assets/scripts/items/containers.lua"
import "assets/scripts/items/food.lua"
import "assets/scripts/items/herbs.lua"
import "assets/scripts/items/keys.lua"
import "assets/scripts/items/swords.lua"
import "assets/scripts/items/axes.lua"
import "assets/scripts/items/maces.lua"
import "assets/scripts/items/daggers.lua"
import "assets/scripts/items/misc_weapons.lua"
import "assets/scripts/items/throwing_weapons.lua"
import "assets/scripts/items/missile_weapons.lua"
import "assets/scripts/items/firearms.lua"
import "assets/scripts/items/misc.lua"
import "assets/scripts/items/potions.lua"
import "assets/scripts/items/scrolls.lua"
import "assets/scripts/items/shields.lua"
import "assets/scripts/items/staves.lua"
import "assets/scripts/items/tomes.lua"
import "assets/scripts/items/crystal_shards.lua"

-- import monsters
import "assets/scripts/monsters/crowern.lua"
import "assets/scripts/monsters/wyvern.lua"
import "assets/scripts/monsters/herder.lua"
import "assets/scripts/monsters/herder_small.lua"
import "assets/scripts/monsters/herder_big.lua"
import "assets/scripts/monsters/spider.lua"
import "assets/scripts/monsters/skeleton_archer.lua"
import "assets/scripts/monsters/cave_crab.lua"
import "assets/scripts/monsters/shrakk_torr.lua"
import "assets/scripts/monsters/green_slime.lua"
import "assets/scripts/monsters/forest_ogre.lua"
import "assets/scripts/monsters/mummy.lua"
import "assets/scripts/monsters/giant_snake.lua"
import "assets/scripts/monsters/rat_swarm.lua"
import "assets/scripts/monsters/medusa.lua"
import "assets/scripts/monsters/sand_warg.lua"
import "assets/scripts/monsters/fjeld_warg.lua"
import "assets/scripts/monsters/dark_acolyte.lua"
import "assets/scripts/monsters/turtle.lua"
import "assets/scripts/monsters/zarchton.lua"
import "assets/scripts/monsters/eyctopus.lua"
import "assets/scripts/monsters/mosquito_swarm.lua"
import "assets/scripts/monsters/skeleton_knight_trooper.lua"
import "assets/scripts/monsters/skeleton_knight_commander.lua"
import "assets/scripts/monsters/undead.lua"
import "assets/scripts/monsters/twigroot.lua"
import "assets/scripts/monsters/air_elemental.lua"
import "assets/scripts/monsters/fire_elemental.lua"
import "assets/scripts/monsters/magma_golem.lua"
import "assets/scripts/monsters/swamp_toad.lua"
import "assets/scripts/monsters/ice_guardian.lua"
import "assets/scripts/monsters/uggardian.lua"
import "assets/scripts/monsters/trickster.lua"
import "assets/scripts/monsters/wizard.lua"
import "assets/scripts/monsters/summon_stone.lua"
import "assets/scripts/monsters/viper_root.lua"
import "assets/scripts/monsters/turtle_diving.lua"
import "assets/scripts/monsters/zarchton_diving.lua"
import "assets/scripts/monsters/mimic.lua"
import "assets/scripts/monsters/ratling.lua"
import "assets/scripts/monsters/ratling_boss.lua"
import "assets/scripts/monsters/xeloroid.lua"
import "assets/scripts/monsters/lindworm.lua"
import "assets/scripts/monsters/spore_mushroom.lua"

-- import spells
import "assets/scripts/spells/fireburst.lua"
import "assets/scripts/spells/shockburst.lua"
import "assets/scripts/spells/frostburst.lua"
import "assets/scripts/spells/poison_cloud.lua"
import "assets/scripts/spells/ice_shards.lua"
import "assets/scripts/spells/fireball.lua"
import "assets/scripts/spells/frostbolt.lua"
import "assets/scripts/spells/poison_bolt.lua"
import "assets/scripts/spells/lightning_bolt.lua"
import "assets/scripts/spells/dark_bolt.lua"
import "assets/scripts/spells/blob.lua"
import "assets/scripts/spells/thorn_wall.lua"
import "assets/scripts/spells/wasp_swarm.lua"
import "assets/scripts/spells/dispel.lua"
import "assets/scripts/spells/runes.lua"
import "assets/scripts/spells/wall_fire.lua"
import "assets/scripts/spells/open_door.lua"
import "assets/scripts/spells/force_field.lua"

-- import materials
import "assets/scripts/materials/generic.lua"
import "assets/scripts/materials/dungeon.lua"
import "assets/scripts/materials/tomb.lua"
import "assets/scripts/materials/mine.lua"
import "assets/scripts/materials/forest.lua"
import "assets/scripts/materials/castle.lua"
import "assets/scripts/materials/beach.lua"
import "assets/scripts/materials/items.lua"
import "assets/scripts/materials/monsters.lua"
import "assets/scripts/materials/swamp.lua"
import "assets/scripts/materials/cemetery.lua"

-- import particle systems
import "assets/scripts/particles/crystal.lua"
import "assets/scripts/particles/cube.lua"
import "assets/scripts/particles/damage_screen.lua"
import "assets/scripts/particles/death.lua"
import "assets/scripts/particles/death_icy.lua"
import "assets/scripts/particles/earthquake_dust.lua"
import "assets/scripts/particles/frost_arrow.lua"
import "assets/scripts/particles/glitter.lua"
import "assets/scripts/particles/hit_wood.lua"
import "assets/scripts/particles/hit_blood.lua"
import "assets/scripts/particles/hit_blood_black.lua"
import "assets/scripts/particles/hit_dust.lua"
import "assets/scripts/particles/hit_flame.lua"
import "assets/scripts/particles/hit_goo.lua"
import "assets/scripts/particles/hit_slime.lua"
import "assets/scripts/particles/hit_firearm.lua"
import "assets/scripts/particles/hit_ice.lua"
import "assets/scripts/particles/party_crush.lua"
import "assets/scripts/particles/prison_ceiling_lamp.lua"
import "assets/scripts/particles/teleporter.lua"
import "assets/scripts/particles/torch.lua"
import "assets/scripts/particles/dungeon_wall_lantern.lua"
import "assets/scripts/particles/tomb_wall_lantern.lua"
import "assets/scripts/particles/portal_effect.lua"
import "assets/scripts/particles/hit_terracotta_jar.lua"
import "assets/scripts/particles/meteor_hammer.lua"
import "assets/scripts/particles/mine_support_lantern.lua"
import "assets/scripts/particles/mine_ceiling_pit_light.lua"
import "assets/scripts/particles/mine_support_ceiling_lantern.lua"
import "assets/scripts/particles/mine_crystal.lua"
import "assets/scripts/particles/forest_falling_leaves.lua"
import "assets/scripts/particles/forest_pit_fog.lua"
import "assets/scripts/particles/forest_fireflies.lua"
import "assets/scripts/particles/forest_lantern.lua"
import "assets/scripts/particles/castle_window_dust.lua"
import "assets/scripts/particles/castle_pillar_candles.lua"
import "assets/scripts/particles/floor_vent_steam.lua"
import "assets/scripts/particles/damage_fire.lua"
import "assets/scripts/particles/damage_shock.lua"
import "assets/scripts/particles/uggardian_flames.lua"
import "assets/scripts/particles/poisoned_monster.lua"
import "assets/scripts/particles/blinded_monster.lua"
import "assets/scripts/particles/stunned_monster.lua"
import "assets/scripts/particles/power_gem.lua"
import "assets/scripts/particles/power_gem_item.lua"
import "assets/scripts/particles/forest_underwater_bubbles.lua"
import "assets/scripts/particles/forest_underwater_plankton.lua"
import "assets/scripts/particles/witch_lantern.lua"
import "assets/scripts/particles/castle_wall_text.lua"
import "assets/scripts/particles/castle_wall_text_long.lua"
import "assets/scripts/particles/castle_button.lua"
import "assets/scripts/particles/beacon_crystal.lua"
import "assets/scripts/particles/beacon_furnace_text_glow.lua"
import "assets/scripts/particles/essence_water.lua"
import "assets/scripts/particles/essence_fire.lua"
import "assets/scripts/particles/essence_earth.lua"
import "assets/scripts/particles/essence_air.lua"
import "assets/scripts/particles/essence_balance.lua"
import "assets/scripts/particles/swamp_fume.lua"
import "assets/scripts/particles/dungeon_fire_pit.lua"
import "assets/scripts/particles/catacomb_alcove_candles_01.lua"
import "assets/scripts/particles/catacomb_alcove_candles_02.lua"
import "assets/scripts/particles/potion_of_vitality.lua"
import "assets/scripts/particles/potion_of_strength.lua"
import "assets/scripts/particles/potion_of_willpower.lua"
import "assets/scripts/particles/potion_of_dexterity.lua"
import "assets/scripts/particles/dummy_light.lua"
import "assets/scripts/particles/ethereal_blade.lua"
import "assets/scripts/particles/etherweed.lua"
import "assets/scripts/particles/castle_ceiling_light.lua"

Re: Grimrock 2 and memory usage/limits

Posted: Mon Dec 01, 2014 2:10 pm
by petri
Also if you have a wallset that is 540 MB you are doing something wrong. The assets of the entire game (textures, models, animation and sound effects) is around 800 MB.

Make sure you are using texture compression properly.

Re: Grimrock 2 and memory usage/limits

Posted: Mon Dec 01, 2014 5:00 pm
by msyblade
Also, in LoG1 it was a good idea to change your video settings to low quality before exporting a large dungeon from the editor.

Re: Grimrock 2 and memory usage/limits

Posted: Mon Dec 01, 2014 5:08 pm
by Phitt
Thanks! By removing the castle, beacon tower and tomb objects and materials (all of which don't fit into my mod) I could reduce the memory usage by more than 200 mb. That combined with kelly1111's findings (about 420 mb in the assets folder before problems start to appear - at least with already compressed textures since my assets folder is around 800 mb and exports without problems, but 95% of it are psd and fbx files I need to remove) should give me more than enough room for any amount of custom assets I could possibly think of.

Re: Grimrock 2 and memory usage/limits

Posted: Mon Dec 01, 2014 10:22 pm
by kelly1111
Phitt: how did you manage to still export your mod with an mod-assets folder that is 800mb?
What is the difference between mine that is not working that is 580 mb?

Re: Grimrock 2 and memory usage/limits

Posted: Mon Dec 01, 2014 10:30 pm
by Phitt
kelly1111 wrote:Phitt: how did you manage to still export your mod with an mod-assets folder that is 800mb?
What is the difference between mine that is not working that is 580 mb?
I assume the size of the dat file is what matters. Most of the files in my assets folder are uncompressed psd and fbx files, so the size of the exported dat file is only 120 mb (since they can be compressed a lot when the dat file is generated). In your case you probably have a large amount of heavily compressed dds files and thus the size of the dat file is not much less than the size of the assets folder.