custom portaits in my mod

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!
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: custom portaits in my mod

Post by FeMaiden »

this is what my init.lua looks like.

Code: Select all


import "mod_assets/scripts/items.lua"
import "mod_assets/scripts/monsters.lua"
import "mod_assets/scripts/objects.lua"
import "mod_assets/scripts/tiles.lua"
import "mod_assets/scripts/recipes.lua"
import "mod_assets/scripts/spells.lua"
import "mod_assets/scripts/materials.lua"
import "mod_assets/scripts/sounds.lua"
import "mod_assets/dmcsb_pack/scripts/objects/base.lua"
import "mod_assets/dmcsb_pack/scripts/objects/misc.lua"
import "mod_assets/dmcsb_pack/scripts/objects/surfaces.lua"
import "mod_assets/dmcsb_pack/scripts/materials/env.lua"
import "mod_assets/dmcsb_pack/scripts/materials/items.lua"
import "mod_assets/ext/grimtk/init.lua"

are you saying that any file that is not in this list, i can safely remove from my mod assets to reduce the size of my mod?
User avatar
Dr.Disaster
Posts: 2876
Joined: Wed Aug 15, 2012 11:48 am

Re: custom portaits in my mod

Post by Dr.Disaster »

You need to find the definitions for the used objects, include only those and remove everything else. The beds and tables are defined in mod_assets/dmcsb_pack/scripts/objects/surfaces.lua and mod_assets/dmcsb_pack/scripts/materials/env.lua.

taken from surface.lua:

Code: Select all

defineObject{
	name = "dm_surface_table_square",
	baseObject = "base_altar",
	components = {
		{
			class = "Model",
			model = "mod_assets/dmcsb_pack/models/env/dm_table_square.fbx",
			staticShadow = true,
		},
		{
			class = "Surface",
			offset = vec(0, 0.88, 0),
			size = vec(2.5, 2),
		},
		{
			class = "Clickable",
			offset = vec(0, 0.88, 0),
			size = vec(2.5, 0.88*2, 2),
			maxDistance = 1,
		},
		{
			class = "Obstacle",
			hitSound = "impact_blunt",
		},
	},
	automapIcon = 152,
	tags = {"dm","dm_user","surface"},
}
defineObject{
	name = "dm_surface_table_round",
	baseObject = "dm_surface_table_square",
	components = {
		{
			class = "Model",
			model = "mod_assets/dmcsb_pack/models/env/dm_table_round.fbx",
			staticShadow = true,
		},
		{
			class = "Surface",
			offset = vec(0, 0.88, 0),
			size = vec(math.sqrt(2), math.sqrt(2)),
		},
		{
			class = "Clickable",
			offset = vec(0, 0.88, 0),
			size = vec(math.sqrt(2), 0.88*2,math.sqrt(2)),
			maxDistance = 1,
		},
	},
}
defineObject{
	name = "dm_surface_bed_brown",
	baseObject = "dm_surface_table_square",
	components = {
		{
			class = "Model",
			model = "mod_assets/dmcsb_pack/models/env/dm_bed_brown.fbx",
			staticShadow = true,
		},
		{
			class = "Surface",
			offset = vec(0.417, 0.46, 0),
			size = vec(1.54, 1.2),
		},
		{
			class = "Clickable",
			offset = vec(0.417, 0.46, 0),
			size = vec(1.54, 0.46*2, 1.2),
			maxDistance = 1,
		},
	},
}
defineObject{
	name = "dm_surface_bed_grey",
	baseObject = "dm_surface_bed_brown",
	components = {
		{
			class = "Model",
			model = "mod_assets/dmcsb_pack/models/env/dm_bed_brown.fbx",
			material = "dm_bed_grey",
			staticShadow = true,
		},
	},
}
taken from materials.lua:

Code: Select all

defineMaterial{ -- good normalmap
	name = "dm_bed_brown",
	diffuseMap = "mod_assets/dmcsb_pack/textures/env/dm_bed_brown_dif.tga",
	specularMap = "mod_assets/dmcsb_pack/textures/env/dm_bed_spec.tga",
	normalMap = "mod_assets/dmcsb_pack/textures/env/dm_bed_normal.tga",
	doubleSided = false,
	lighting = true,
	alphaTest = false,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 40,
	depthBias = 0,
}

defineMaterial{ -- good normalmap
	name = "dm_bed_grey",
	diffuseMap = "mod_assets/dmcsb_pack/textures/env/dm_bed_grey_dif.tga",
	specularMap = "mod_assets/dmcsb_pack/textures/env/dm_bed_spec.tga",
	normalMap = "mod_assets/dmcsb_pack/textures/env/dm_bed_normal.tga",
	doubleSided = false,
	lighting = true,
	alphaTest = false,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 40,
	depthBias = 0,
}
defineMaterial{ -- degraded normalmap
	name = "dm_table_round",
	diffuseMap = "mod_assets/dmcsb_pack/textures/env/dm_table_round_dif.tga",
	normalMap = "mod_assets/dmcsb_pack/textures/env/dm_table_round_normal.tga",
	specularMap = "mod_assets/dmcsb_pack/textures/env/dm_table_round_spec.tga",
	doubleSided = false,
	lighting = true,
	alphaTest = false,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 50,
	depthBias = 0,
}

defineMaterial{ -- degraded normalmap
	name = "dm_table_square",
	diffuseMap = "mod_assets/dmcsb_pack/textures/env/dm_table_square_dif.tga",
	normalMap = "mod_assets/dmcsb_pack/textures/env/dm_table_square_normal.tga",
	specularMap = "mod_assets/dmcsb_pack/textures/env/dm_table_square_spec.tga",
	doubleSided = false,
	lighting = true,
	alphaTest = false,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 60,
	depthBias = 0,
}
This defintions and the files mentioned should be all you need for the beds and tables.
Last edited by Dr.Disaster on Thu Nov 12, 2015 4:08 pm, edited 1 time in total.
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: custom portaits in my mod

Post by FeMaiden »

Dr.Disaster wrote:You need to find the definitions for the used objects, include only those and remove everything else. The beds and tables are defined in mod_assets/dmcsb_pack/scripts/objects/surfaces.lua and mod_assets/dmcsb_pack/scripts/materials/env.lua.

taken from surface.lua:

Code: Select all

defineObject{
	name = "dm_surface_table_square",
	baseObject = "base_altar",
	components = {
		{
			class = "Model",
			model = "mod_assets/dmcsb_pack/models/env/dm_table_square.fbx",
			staticShadow = true,
		},
		{
			class = "Surface",
			offset = vec(0, 0.88, 0),
			size = vec(2.5, 2),
		},
		{
			class = "Clickable",
			offset = vec(0, 0.88, 0),
			size = vec(2.5, 0.88*2, 2),
			maxDistance = 1,
		},
		{
			class = "Obstacle",
			hitSound = "impact_blunt",
		},
	},
	automapIcon = 152,
	tags = {"dm","dm_user","surface"},
}
defineObject{
	name = "dm_surface_table_round",
	baseObject = "dm_surface_table_square",
	components = {
		{
			class = "Model",
			model = "mod_assets/dmcsb_pack/models/env/dm_table_round.fbx",
			staticShadow = true,
		},
		{
			class = "Surface",
			offset = vec(0, 0.88, 0),
			size = vec(math.sqrt(2), math.sqrt(2)),
		},
		{
			class = "Clickable",
			offset = vec(0, 0.88, 0),
			size = vec(math.sqrt(2), 0.88*2,math.sqrt(2)),
			maxDistance = 1,
		},
	},
}
defineObject{
	name = "dm_surface_bed_brown",
	baseObject = "dm_surface_table_square",
	components = {
		{
			class = "Model",
			model = "mod_assets/dmcsb_pack/models/env/dm_bed_brown.fbx",
			staticShadow = true,
		},
		{
			class = "Surface",
			offset = vec(0.417, 0.46, 0),
			size = vec(1.54, 1.2),
		},
		{
			class = "Clickable",
			offset = vec(0.417, 0.46, 0),
			size = vec(1.54, 0.46*2, 1.2),
			maxDistance = 1,
		},
	},
}
defineObject{
	name = "dm_surface_bed_grey",
	baseObject = "dm_surface_bed_brown",
	components = {
		{
			class = "Model",
			model = "mod_assets/dmcsb_pack/models/env/dm_bed_brown.fbx",
			material = "dm_bed_grey",
			staticShadow = true,
		},
	},
}
taken from materials.lua:

Code: Select all

defineMaterial{ -- good normalmap
	name = "dm_bed_brown",
	diffuseMap = "mod_assets/dmcsb_pack/textures/env/dm_bed_brown_dif.tga",
	specularMap = "mod_assets/dmcsb_pack/textures/env/dm_bed_spec.tga",
	normalMap = "mod_assets/dmcsb_pack/textures/env/dm_bed_normal.tga",
	doubleSided = false,
	lighting = true,
	alphaTest = false,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 40,
	depthBias = 0,
}

defineMaterial{ -- good normalmap
	name = "dm_bed_grey",
	diffuseMap = "mod_assets/dmcsb_pack/textures/env/dm_bed_grey_dif.tga",
	specularMap = "mod_assets/dmcsb_pack/textures/env/dm_bed_spec.tga",
	normalMap = "mod_assets/dmcsb_pack/textures/env/dm_bed_normal.tga",
	doubleSided = false,
	lighting = true,
	alphaTest = false,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 40,
	depthBias = 0,
}
defineMaterial{ -- degraded normalmap
	name = "dm_table_round",
	diffuseMap = "mod_assets/dmcsb_pack/textures/env/dm_table_round_dif.tga",
	normalMap = "mod_assets/dmcsb_pack/textures/env/dm_table_round_normal.tga",
	specularMap = "mod_assets/dmcsb_pack/textures/env/dm_table_round_spec.tga",
	doubleSided = false,
	lighting = true,
	alphaTest = false,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 50,
	depthBias = 0,
}

defineMaterial{ -- degraded normalmap
	name = "dm_table_square",
	diffuseMap = "mod_assets/dmcsb_pack/textures/env/dm_table_square_dif.tga",
	normalMap = "mod_assets/dmcsb_pack/textures/env/dm_table_square_normal.tga",
	specularMap = "mod_assets/dmcsb_pack/textures/env/dm_table_square_spec.tga",
	doubleSided = false,
	lighting = true,
	alphaTest = false,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 60,
	depthBias = 0,
}


you mean, i have to find the definitions in the dmcsb pack and then copy paste them into my custom definitions files? what about all the textures and images and stuff?
User avatar
gambit37
Posts: 218
Joined: Fri Mar 02, 2012 3:40 pm

Re: custom portaits in my mod

Post by gambit37 »

You only need the object and material definitions for the items you want to use. Currenty, you're importing hundreds of MBs of stuff you don't need.

This is a good argument for mod makers to define their work on a "module by module" basis. So rather than doing it the Grimrock way and separating things out into the relevant folders, it would make more sense for all the files required for say, the DM bed, to be supplied in a self contained "bed" folder. That would make it much easier for other modders to then selectively include just a few items from a resource pack. (Of course, that brings its own maintenance overhead...)
Last edited by gambit37 on Thu Nov 12, 2015 4:15 pm, edited 1 time in total.
User avatar
Dr.Disaster
Posts: 2876
Joined: Wed Aug 15, 2012 11:48 am

Re: custom portaits in my mod

Post by Dr.Disaster »

FeMaiden wrote:you mean, i have to find the definitions in the dmcsb pack and then copy paste them into my custom definitions files?

Yes, use only them instead of the .lua files that define the entire tileset.

FeMaiden wrote:what about all the textures and images and stuff?
As minmay has pointed out earlier
minmay wrote:as long as a file is somewhere in the mod_assets folder and ends with .dds, .lua, .model, .animation, .wav, .ogg, or .ivf, it will be exported into the .dat
you need to remove all these files from your mod_assets folder or they will be exported, no matter if used or not. In other words: remove all files except those listed in those objects' definitions.
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: custom portaits in my mod

Post by FeMaiden »

you guys keep saying over and over "only keep the definitions for the objects i'm using"
but how do I do that?

all the stuff is jumbled up in this one big folder.

am I supposed to hunt and peck and find each individual texture file related to the object i'm using and then make a new folder to put them in and pull them out and then take the other folders out of my mod assets?
where do I put the defintiions, do I put them in the .lua files that i've been putting all my other custom definitions in? I thought the dmcsb pack had it's own .lua files with all the definitions in them already
User avatar
gambit37
Posts: 218
Joined: Fri Mar 02, 2012 3:40 pm

Re: custom portaits in my mod

Post by gambit37 »

FeMaiden wrote:am I supposed to hunt and peck and find each individual texture file related to the object i'm using and then make a new folder to put them in and pull them out and then take the other folders out of my mod assets?
Basically, yes. You could also comment out anything in the DM pack init.lua that you don't want, but you'd still be loading other stuff you don't need because many items are defined in one file.

It's a big old mess this modding, isn't it? :)
Dr.Disaster wrote:As minmay has pointed out earlier
minmay wrote:as long as a file is somewhere in the mod_assets folder and ends with .dds, .lua, .model, .animation, .wav, .ogg, or .ivf, it will be exported into the .dat
you need to remove all these files from your mod_assets folder or they will be exported, no matter if used or not. In other words: remove all files except those listed in those objects' definitions.
Is that true? Surely only stuff defined in a Lua file gets exported? Are you saying that the files merely need to exist and they STILL get exported, even if not defined anywhere?
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: custom portaits in my mod

Post by FeMaiden »

gambit37 wrote:
FeMaiden wrote:am I supposed to hunt and peck and find each individual texture file related to the object i'm using and then make a new folder to put them in and pull them out and then take the other folders out of my mod assets?
Basically, yes.
which means that the file paths in my init are going to be different?

I mean, like I have a file path going into

import "mod_assets/dmcsb_pack/scripts/objects/base.lua"

so I need to open that objects/base.lua
and then delete all the defintiions except the ones relevant to my items?
or do I take only the defintiions relevant to my items out of the lua file, and then put them into my other files that are in

mod_assets/scripts, and then I remove that whole line from my init?

I don't get it, why did this dmcsb pack have to be so confusing?
the readme made it sound all easy it says "all you have to do is this...but no you shouldn't do that you should do this instead, but actually you probably shouldn't do that either but this this and this instead, actually most of of what i told you do do up there actually didn't need to be done at all, only these things needed to be done...oh nevermind, all this is wrong because theres actually something totally godamned fucking different your supposed to do but I'm not gonna tell you what it is because i'm just gonna assume that you have a masters degree from MI fucking T and already know this shit and don't need to be told any of this
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: custom portaits in my mod

Post by FeMaiden »

sorry about that last rant...I know you guys are trying to help. I've been up all night testing my mod and I played through it so many times, I have a headache. and I'm just not understanding what you guys are telling me, maybe I just need some sleep
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: custom portaits in my mod

Post by Drakkan »

FeMaiden wrote:sorry about that last rant...I know you guys are trying to help. I've been up all night testing my mod and I played through it so many times, I have a headache. and I'm just not understanding what you guys are telling me, maybe I just need some sleep
actually dungeon optimization and cutting off what is not necessary is one of the most difficult (read time-consuming) part when you are finishing your mod. You should pay attention all the time WHAT exactly you are adding to your dungeon and keeping everything as low as possible. Perhaps you are not aware (and you should not fear about it now), but actually HUGE problems are occurring in case your dungeon is badly optimized.
Breath from the unpromising waters.
Eye of the Atlantis
Post Reply