Page 1 of 2

question about memory usage

Posted: Sat Apr 04, 2015 7:37 pm
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?

Re: question about memory usage

Posted: Sat Apr 04, 2015 7:39 pm
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.

Re: question about memory usage

Posted: Sat Apr 04, 2015 8:05 pm
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?)

Re: question about memory usage

Posted: Sun Apr 05, 2015 4:02 am
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.

Re: question about memory usage

Posted: Sun Apr 05, 2015 10:08 am
by THOM
ah - Thanks.

so it helps at no point if I remove any definition I don't use?

Re: question about memory usage

Posted: Sun Apr 05, 2015 4:51 pm
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.

Re: question about memory usage

Posted: Sun Apr 05, 2015 5:13 pm
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.

Re: question about memory usage

Posted: Sun Apr 05, 2015 6:18 pm
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

Re: question about memory usage

Posted: Sun Apr 05, 2015 6:27 pm
by msyblade
Now that's news. Good work Isaac!

Re: question about memory usage

Posted: Sun Apr 05, 2015 7:35 pm
by THOM
Great. That's what I expected and what supports my plan.

Thanks Isaac.