boring times - not enough memory

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!
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

boring times - not enough memory

Post by bongobeat »

so much time passed on modding, improwing, removing, reducing wallset, textures, I simply cannot test my mod with textures resolution set to max.

In high settings, when starting the mod, the game load and load things, the memory used get up to 1 696 Mb then the game crash and give me this:
SpoilerShow
Image
The mod is about:
105 levels, I planed 150 levels
117Mo (the exported mod take only 71Mb)
23,6 Mb of musics, I recently export all musics with 96Kbps ogg quality
4 Mb of sounds
49Mb of custom textures
33Mb of custom or modified log2 models
6,5Mb of lua files
Thousands of thousands lines in the dungeon.lua
Thousands of models spawned

71 Mb and it's the end of all! I'm pissed off and don't know what to do now, except going to make me a cup of tea.

log2 assets:
I have removed approx, 12Mb of textures (that I don't need)
About the models, I don't know how much but maybe 30Mb of model are removed
Also I have modified some textures size to 256x256 (items that have texture > 256x256), removed all specular textures of the item and replaced them by the black material. <--- 20Mb gained

Most of my custom assets use log2 models, some are loaded from the mod_assets but most of them are loaded from the asset pack, using custom or log 2 material, directly with the

Code: Select all

			material = "zo_pillar",
command line in the model class.

e.g:
SpoilerShow

Code: Select all

defineObject{
	name = "zo_tomb_pillar",
	baseObject = "base_pillar",
	components = {
		{
			class = "Model",
			model = "assets/models/env/tomb_pillar_01.fbx",
			material = "zo_pillar",
			staticShadow = true,
		}
	},
	minimalSaveState = true,
}
defineMaterial{
	name = "zo_pillar",
	diffuseMap = "assets/textures/common/black.tga",
	specularMap = "assets/textures/env/tomb_pillar_spec.tga",
	normalMap = "assets/textures/env/tomb_pillar_normal.tga",
	doubleSided = false,
	lighting = true,
	alphaTest = false,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 20,
	depthBias = 0,
}
I made it this way because I think that it's better to improve mod size or memory usage, to not reload same models or texture under a different name twice. Of course, if the game act so.
I load all log2 assets in my init.lua, has to be done to remove some of the asset that are no longer needed.

So much improvement, small size wallset 2 to 10Mb. My modified, black tomb wallset takes only 2,3 Mb, and this is only with log2 models, no new textures. The city wallset of EW, which takes only 9,7 Mb now, reduced a lot. Most of the texture were replaced by log2 textures. A custome ice wallset, amethyst mines, imperial marble palace, Oddinball sci-fi stuff, dwarf wallset based on the castle wallset (not implemented, what's the point now?), all of this takes only 30 to 40 mb (40 with the dwarf wallset).

Tons of textures, normal or specular are no more used or are replaced by other textures, I have count 125Mb of textures no more loaded.
And I still have "not enough memory"! I figured that so, at least, things will be ok, and I can use any other custom wallset, like Phitt's asian tileset.
While trying to save memory usage at the expense of global graphic quality, I thought that will be great to remove lot's of things of the memory, but.. No! All this work for nothing!

Tested without any heavy scripts, not something like

Code: Select all

hudprint ("WTF")
or

Code: Select all

playSound("lock_incorrect")
, like fw hooks, mam or npcscript , don't work!
Tested without using some wallset, don't work!
Tested with 4 levels only (removed all other), works! OMG! :shock:
Tested with all settings to max, except texture resolution set to medium, works!
Strangely I simply removed 3 wallset, I don't know how many, let's say that make 20Mb of things removed, the mod wouldn't show itself with high resolution textures. Is the number of levels that is too big? the number of lines loaded in the dungeon.lua? the number of model spawned? Is there a limit? WTF! :evil:

wrong textures?
wrong models?
too much levels?
too much item in my gfx atlas?
wrong script?
wrong guy?

If someone got any idea of what's going wrong, you are welcome. :?:
Anyway, I will not continu that mod, I'm simply bored. I don't want to play/test it with medium texture resolution or I can throw away my computer! :evil:
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: boring times - not enough memory

Post by JKos »

It's really hard to guess what's wrong without seeing the sources. But one possible cause could be some recursive or looping script which stores something in memory.
And 105 levels is a lot, the original dungeon has 34 levels, so maybe you just have too much stuff(objects) in your dungeon.

Here is a simple script which prints out the amount of objects in your dungeon. Copy paste this to a script entity named debug (or whatever)

Code: Select all

function countObjects(componentName,callback)
    local objectCount = 0
    for mapIndex =1, Dungeon.getMaxLevels() do
	    for ent in Dungeon.getMap(mapIndex):allEntities() do
			objectCount = objectCount + 1 
	    end
    end
    print(objectCount)
end
Start your dungeon and type in console: debug.script.countObjects()
For a reference the original dungeon has 58922 objects (just tested it).
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: boring times - not enough memory

Post by Isaac »

It also sounds like this is the kind of mod that should be divided into parts 1, 2 , and 3, not at all unlike the three LOTR movies; and books. It's just one book, but it's bound as three volumes.

The ORRR2 mod had just ten levels, but we had to jump through several memory management hoops to allow that mod to be playable at a decent frame rate. (The comparison isn't 1:1 accurate, but the point is that the engine loads up all of the assets at the start... when it could be setup such that all of the maps in part 3, are not present until part 3, and not bogging down part 1.)

A cave-in or even just a pitfall ~for instance, can plausibly cut off part one from part two.
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: boring times - not enough memory

Post by kelly1111 »

are you saying that for instance it is possible in a 30 level dungeon to load level 1,2,3,4,5,6,7 ... and the rest later on when they player for instance activates a floortrigger --> script that loads level 7+ untill level 30 ?

and how would you do that?
Azel
Posts: 808
Joined: Thu Nov 06, 2014 10:40 pm

Re: boring times - not enough memory

Post by Azel »

Why not make it 1,000 levels? Go for the Gold! :mrgreen:
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: boring times - not enough memory

Post by Isaac »

kelly1111 wrote:are you saying that for instance it is possible in a 30 level dungeon to load level 1,2,3,4,5,6,7 ... and the rest later on when they player for instance activates a floortrigger --> script that loads level 7+ untill level 30 ?

and how would you do that?
No... I was saying that such a large story could by split into more than one mod, and the party imported from part 1 to part 2, and so on. Saying that a mod that starts near an Ocean, but ends in a desert... perhaps... need not even include the desert and tomb tilesets in part 1 of the mod.
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: boring times - not enough memory

Post by Drakkan »

thats quite sad to hear, as I am expecting the same sooner or later :/
As for now my dungeon crashes with the same problem after loading about two dungeon areas when playing on high and about loading five areas on medium setting.
edit: it only convinces me not to edit fully what I wanted but better to finish my mod sooner but functional... quite sad.
Breath from the unpromising waters.
Eye of the Atlantis
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: boring times - not enough memory

Post by kelly1111 »

@drakkan:

How many levels do you have?
How many objects?

I'm just curiuous as to what the limit is.

My mod is 28 levels in size
mod assets folder 510 mb
game objects 18050

but it is still working when I export it and play on high details (everything)

So ... what is the difference here with the mod from bongobeat? Is it levels ? objects?
User avatar
Eleven Warrior
Posts: 744
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: boring times - not enough memory

Post by Eleven Warrior »

Damm that's sad Bongo really mate :( I think I will have to consider change as well.

Issac how is it possible to check what items the party has at the end of Mod 1? So when the player goes to Mod 2 they have the same items from Mod 1??

Ok then to all the Coders out there. Is there a way when the player finishes Mod 1 that the save file is loaded into the second chapter Mod 2 etc.... Like the Bauldur's Gate series and others. I think I remember someone writing some code in LOG 1 that can do this.

The last save game would have to be called a certain name eg: LastSave then the 2nd Mod would look for this file and load what it needs I guess, I am not sure how this would work lol

Then you could make a Mod with many chapters and each one could be 30 levels big and not one Mod that's 100 or so levels big. This would be good for adventure type game with lots of open outside area etc..... I want to create a adventure mod but realize now it may be impossible with the amount of levels I need to complete it.
Last edited by Eleven Warrior on Mon Apr 13, 2015 9:55 am, edited 1 time in total.
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: boring times - not enough memory

Post by minmay »

No.

However, you can abuse the party import feature to store arbitrary information. E.g. use Champion:setName() to encode all champions' inventories, game statistics, and whatever else you want to transfer, then have the player import the party into the next mod. I tested with a 1 MB name and it saved and loaded just fine, so there is plenty of space available. So if you want players to be able to go back and forth between two or more dungeons and have arbitrary persistence, it can be done. Whether this would actually be a good design is debatable, however.
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