Page 1 of 2

Darker world

Posted: Tue Oct 06, 2015 5:41 am
by Emera Nova
During one of my fights I'm looking to darken the screen of the player to make it harder for them to see. Just making the room dark doesn't work right since we have a soft natural blue glow that gives some light to the party. Anyone know of a script I could run during a fight that would just darken up the screen some more?

Re: Darker world

Posted: Tue Oct 06, 2015 6:58 am
by minmay
I don't think this is a good idea in the first place, since your players' displays are going to have varying brightness levels, and what's "hard to see" is going to vary a great deal between them. Also, the way Grimrock renders shadows has an extreme color depth problem such that sufficiently dark places are going to look awful - or be completely black - anyway.

But that aside, in Grimrock 2 that blue glow is from a LightComponent attached to the party object named "torch". You can disable it and add your own LightComponent with the brightness/color/etc that you want. (Changing the brightness/color of torch doesn't work very well because the game just overwrites it with new values immediately.)

Someone will probably suggest drawing a translucent rectangle in PartyComponent.onDrawGui, but onDrawGui doesn't execute if the player is free-looking, the game is paused, etc., which makes it pretty unsuitable for this sort of thing.

Re: Darker world

Posted: Tue Oct 06, 2015 8:04 am
by Azel
Emera Nova wrote:During one of my fights I'm looking to darken the screen of the player to make it harder for them to see. Just making the room dark doesn't work right since we have a soft natural blue glow that gives some light to the party. Anyone know of a script I could run during a fight that would just darken up the screen some more?
Just spawn some Dark Bolts, it does a great job of darkening the screen. I like to spawn the occasional eyctopus, who casts Dark Bolt by default.

Re: Darker world

Posted: Wed Oct 07, 2015 5:17 pm
by kelly1111
Minmay or anyone:
I need an example of this lightsource torch thing: cant seem to find it in the scripting reference ... what and how do I need to change class "light" to get a darker lightsource?

defineObject{
name = "party",
components = {
{
class = "Party",
},
{
class = "Light",
name = "torch",
range = 12,
},
},
editorIcon = 32,
placement = "floor",
}

Re: Darker world

Posted: Wed Oct 07, 2015 5:41 pm
by Azel
Here is the code for the Torch particle (the "glow" section is in it) :

Code: Select all

defineParticleSystem{
	name = "torch",
	emitters = {
		-- smoke
		{
			emissionRate = 5,
			emissionTime = 0,
			maxParticles = 50,
			boxMin = {-0.03, 0.1, -0.03},
			boxMax = { 0.03, 0.1,  0.03},
			sprayAngle = {0,30},
			velocity = {0.1,0.5},
			texture = "assets/textures/particles/smoke_01.tga",
			lifetime = {1,1.75},
			color0 = {0.15, 0.15, 0.15},
			opacity = 1,
			fadeIn = 0.5,
			fadeOut = 0.5,
			size = {0.3, 0.6},
			gravity = {0,0,0},
			airResistance = 0.1,
			rotationSpeed = 0.6,
			blendMode = "Translucent",
		},

		-- flames
		{
			emissionRate = 50,
			emissionTime = 0,
			maxParticles = 100,
			boxMin = {-0.03, -0.03, 0.03},
			boxMax = { 0.03, 0.03,  -0.03},
			sprayAngle = {0,10},
			velocity = {0.2, 1},
			texture = "assets/textures/particles/torch_flame.tga",
			frameRate = 35,
			frameSize = 64,
			frameCount = 16,
			lifetime = {0.25, 0.85},
			colorAnimation = true,
			color0 = {2, 2, 2},
			color1 = {1.0, 1.0, 1.0},
			color2 = {1.0, 0.5, 0.25},
			color3 = {1.0, 0.3, 0.1},
			opacity = 1,
			fadeIn = 0.15,
			fadeOut = 0.3,
			size = {0.35, 0.015},
			gravity = {0,0,0},
			airResistance = 1.0,
			rotationSpeed = 1,
			blendMode = "Additive",
			depthBias = 0.1,
		},

		-- glow
		{
			spawnBurst = true,
			emissionRate = 1,
			emissionTime = 0,
			maxParticles = 1,
			boxMin = {0,0,-0.1},
			boxMax = {0,0,-0.1},
			sprayAngle = {0,30},
			velocity = {0,0},
			texture = "assets/textures/particles/glow.tga",
			lifetime = {1000000, 1000000},
			colorAnimation = false,
			color0 = {0.23, 0.11, 0.08},
			opacity = 1,
			fadeIn = 0.1,
			fadeOut = 0.1,
			size = {2, 2},
			gravity = {0,0,0},
			airResistance = 1,
			rotationSpeed = 0,
			blendMode = "Additive",
			depthBias = 0.1,
		}
	}
}

Re: Darker world

Posted: Wed Oct 07, 2015 7:27 pm
by minmay
...That is completely and utterly unrelated to everything in this thread. We're talking about the LightComponent on the party called "torch". Not the particle system that happens to be called "torch" or the object that happens to be called "torch".
kelly1111 wrote:I need an example of this lightsource torch thing: cant seem to find it in the scripting reference ... what and how do I need to change class "light" to get a darker lightsource?
It's just a regular LightComponent like any other, with the exception that the game changes its brightness/color/range automatically every frame. You can find the LightComponent methods here, but again, you probably just want to disable torch (just use the disable() method that all components have) and add your own LightComponent instead, because you can't usefully change the brightness/color/range of torch.

Re: Darker world

Posted: Wed Oct 07, 2015 7:37 pm
by Azel
minmay wrote:That is completely and utterly unrelated to everything in this thread. We're talking about the LightComponent on the party called "torch". Not the particle system that happens to be called "torch" or the object that happens to be called "torch".
minmay wrote:It's just a regular LightComponent like any other
mmhhmm, is it one specific thing or is it like any other thing? lol

I posted it because it has script for addressing the color and frame properties which may help kelly1111 in her task. It may not, but it is certainly far from "completely and utterly unrelated to everything in this thread." Although I do like how you completely and utterly contradicted yourself.

Re: Darker world

Posted: Wed Oct 07, 2015 7:48 pm
by minmay
Ffs. A particle system is not a LightComponent. It's not even a component. None of those fields correspond in any useful way to any field on any component, let alone LightComponent.

Re: Darker world

Posted: Wed Oct 07, 2015 8:40 pm
by Azel
Do you mean to say that the frame and color properties of the Particle System cannot be applied to a Light Component?

Re: Darker world

Posted: Thu Oct 08, 2015 12:13 am
by minmay
Yes!