question about memory usage

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

question about memory usage

Post by bongobeat »

If I have 2 material names, with same textures defined, are the textures loaded twice or just once?

e.g: materials cemetery_stone_tile and cemetery_stone_tile2 have the same textures.
SpoilerShow

Code: Select all

defineMaterial{
	name = "cemetery_stone_tile",
	diffuseMap = "assets/textures/env/cemetery_stone_tile_dif.tga",
	specularMap = "assets/textures/env/cemetery_stone_tile_spec.tga",
	normalMap = "assets/textures/env/cemetery_stone_tile_normal.tga",
	doubleSided = false,
	lighting = true,
	alphaTest = false,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 20,
	depthBias = 0,
}
SpoilerShow

Code: Select all

defineMaterial{
	name = "cemetery_stone_tile2",
	diffuseMap = "assets/textures/env/cemetery_stone_tile_dif.tga",
	specularMap = "assets/textures/env/cemetery_stone_tile_spec.tga",
	normalMap = "assets/textures/env/cemetery_stone_tile_normal.tga",
	doubleSided = false,
	lighting = true,
	alphaTest = false,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 20,
	depthBias = 0,
}
I'm asking that, because I use custom wallset, with their own materials. But I have replaced some of the materials by log2 materials (texture).
Is it better to rename the material name of the model in the GMT?
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: question about memory usage

Post by JohnWordsworth »

The textures are only loaded into the game engine once, so sharing textures (especially with those packaged with the game) is a very good idea where it looks good.

Edit: Obviously, you should only actually provide the texture once. If you bundle a copy of a game texture in your mod and load it in your own material, the engine won't know that it's the same texture - it only knows it's the same texture if the path is the same.
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
User avatar
THOM
Posts: 1280
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: question about memory usage

Post by THOM »

I have a question, too:

I am loading in my mod all original LoGII materials, models and definitions from my mod_assets folder. In this way I can change things in the scripts etc.

Is it a necessary to eleminate all textures, that I do not use, to shrink the size of the dat-file or are all assets of the orignal included either? (or : aren't they included in the dat-file because they are already in the game-installation of the player?)
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
User avatar
Isaac
Posts: 3190
Joined: Fri Mar 02, 2012 10:02 pm

Re: question about memory usage

Post by Isaac »

THOM wrote:I have a question, too:

I am loading in my mod all original LoGII materials, models and definitions from my mod_assets folder. In this way I can change things in the scripts etc.

Is it a necessary to eleminate all textures, that I do not use, to shrink the size of the dat-file or are all assets of the orignal included either? (or : aren't they included in the dat-file because they are already in the game-installation of the player?)
You should be able to define custom materials, that use the built in assets. While the definitions may be in 'mod_assets/scripts/' folder, the official sounds and images referenced in them should be in "assets/" ~plus the folder & filename where you find them in the asset pack. Everything in the asset pack (and more), need not be included in the data, because it's already in the base game, and everyone has that installed.

For the ORRR2, I made many custom models for the mod, and used the official textures for them any time that I could.
User avatar
THOM
Posts: 1280
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: question about memory usage

Post by THOM »

ah - Thanks.

so it helps at no point if I remove any definition I don't use?
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
User avatar
Isaac
Posts: 3190
Joined: Fri Mar 02, 2012 10:02 pm

Re: question about memory usage

Post by Isaac »

THOM wrote:ah - Thanks.

so it helps at no point if I remove any definition I don't use?
An effect on DAT size? Not by much, I would think. It's just a small text file, and those can compress pretty well.
[AFAIK] nothing in the 'assets/' folder gets included in the exported dat.
User avatar
THOM
Posts: 1280
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: question about memory usage

Post by THOM »

Does is affect the size of the used computer memory/CPU performance?

I think, I am one of this modders that tend to fill up their mod with too much stuff and at the end I would like to lighten it up as much as possible.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
User avatar
Isaac
Posts: 3190
Joined: Fri Mar 02, 2012 10:02 pm

Re: question about memory usage

Post by Isaac »

THOM wrote:Does is affect the size of the used computer memory/CPU performance?

I think, I am one of this modders that tend to fill up their mod with too much stuff and at the end I would like to lighten it up as much as possible.
That would be my assumption anyway...

You could (I suppose) attempt to trim down the standard_assets.lua, and replace it in your init.lua file. Carefully commenting out what you would guess isn't going to be used; and restoring what turns out to be still called by the game, (scripts within scripts).

Edit:
This seems to have the potential for quite an effect; if used carefully. I made two instance of the editor running the default new map. One with the default standard assets, the other with a trimmed down bare bones version of the standard assets. Then I ran the previews; see for yourself:
Image
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: question about memory usage

Post by msyblade »

Now that's news. Good work Isaac!
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
User avatar
THOM
Posts: 1280
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: question about memory usage

Post by THOM »

Great. That's what I expected and what supports my plan.

Thanks Isaac.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
Post Reply