Page 1 of 1

DistanceLightning tweaking

Posted: Fri Mar 04, 2016 6:03 pm
by sektor2111
I cannot be sure if this issue is well known or not (for me was annoying for a long time).
Many maps had "Storm-Coming" like stuff and being pretty well designed but Playing them on servers is a mess as long as DistanceLightning do sucks at net stuff in original.
To mention several titles (list is longer): DM-Traitorsgate.unr, DM-Wheel.unr, DM-WZ5-Revolution.unr, DM-WZ2-AdDominus.unr, DM-Waterplace.unr, MH-[SP]ColdSteel.unr, DOM-Storm.unr, DM-UnderGround.unr, etc.
Net Stuff is doable in MyLevel directly or using brute-force VIA game-type (my case) or an evil mutator able to ruin crap out even if is set to bNoDelete (default).
Here I'm introducing a mutator supposed to solve this stuff for a better On-Line playable Level. For sure if other needs are encountered, source-code is there for analyzing/adds/changes/removals/etc.
LightningTw.zip
(71.68 KiB) Downloaded 104 times
Long name (umm...) "Lightning Tweaker" - shortly called "LightningTw".
Technical explanations goes bellow if are needed by coders (even if I'm not a coder I'll try to point out how works this stuff).
Document included contains setup explanations.

Re: DistanceLightning tweaking

Posted: Sat Mar 26, 2016 3:16 pm
by sektor2111
Bump, speaking about Lights we can debate some... sort of lamps which looks stupid as dead bodies making light around. In client we can toy a bit as long as client is able to SEE things, server doesn't care how these things look. Update + ScreenShots examples.
[attachment=4]LightningTw_2.zip[/attachment]

Reduced size sample:
[attachment=3]Original.png[/attachment]
Original ^
___
[attachment=2]With_Mutator.png[/attachment]
Using this Mutator ^
Edit:
Sample Number 2 - perhaps more relevant
[attachment=1]Original_02.png[/attachment]
VS
[attachment=0]With_Mutator02.png[/attachment]

Re: DistanceLightning tweaking

Posted: Sat Mar 26, 2016 9:32 pm
by papercoffee
Dude this is neat ...So, this is a server only mutator?

Re: DistanceLightning tweaking

Posted: Sat Mar 26, 2016 9:54 pm
by Barbie
Just a note: you can optimize the code by skipping never true conditions. Instead of

Code: Select all

if (Other.Class == Class 'Lamp1')
	[..]
if (Other.Class == Class 'Lamp4')
	[..]
this one skips other tests if one condition is successful:

Code: Select all

if (Other.Class == Class 'Lamp1')
	[..]
else if (Other.Class == Class 'Lamp4')
	[..]

Re: DistanceLightning tweaking

Posted: Sun Mar 27, 2016 3:25 am
by sektor2111
papercoffee wrote:Dude this is neat ...So, this is a server only mutator?
It works in any environment, including OFF-Line for those lamps. Aside, DistanceLightning is a fix for servers, because Net Code is trash for that class - and it was used in mapping... anyone playing such DM/CTF/MH/etc. maps OFF-Line doesn't need this mutator 100%... it looks functional for those lamps. DistanceLighning is fully operational OFF-Line and it doesn't really need a fix, for Lamps things are tweaked.
Barbie wrote:Just a note: you can optimize the code by skipping never true conditions
I'm appreciating observations but... I'm not concerned about server's performance. Those codes belongs to client, you don't have to believe me, just add logs and see where are executed. Be my guest to use/improve them as you want if you like this lightning deal.

Re: DistanceLightning tweaking

Posted: Sun Apr 03, 2016 5:02 pm
by sektor2111
Because we seems to hunt some speed let's see LightNotify different done:

Code: Select all

	ForEach Allactors(class'actor',other)
	{
		switch(Other.Class)
		{
			case Class 'DistanceLightning':
				...
				break;

			case Class 'Lamp1':
				...
				break;

			case Class 'Lamp4':
				...
				break;

			case Class 'Lantern':
				...
				break;

			case Class 'Lantern2':
				...
				break;

			case Class 'TubeLight':
				...
				break;

			case Class 'TubeLight2':
				...
				break;
		}
	}
Is this faster enough right now ?

Re: DistanceLightning tweaking

Posted: Sun May 15, 2016 5:14 pm
by Barbie
I have another approach to have this nice lamp glowing on clients: On client login, spawn an Actor there that checks and switches on the glowing of lamps. The disadvantage is that you need control over the client's login - I use it in a GameInfo's child; maybe it works also in Mutators ModifyClient(), I didn't test that.

Code: Select all

event PostLogin(playerpawn NewPlayer) {
[...]
	if (spawn(class'MakeLanternsGlow', NewPlayer) == None)
		warn("class'MakeLanternsGlow' could not be spawned on" @ NewPlayer);
}
and

Code: Select all

class MakeLanternsGlow expands Actor;

simulated function PostBeginPlay() {
local Decoration deco;

	super.PostBeginPlay();
	//log(self $ ".PostBeginPlay DEBUG: function entered, Level.NetMode=" $ GetEnum(enum'ENetMode', Level.NetMode));
	if (Level.NetMode != NM_DedicatedServer)
	{
		foreach AllActors(class 'Decoration', deco)
			if (Lantern(deco) != None || Lantern2(deco) != None || Lamp4(deco) != None)
				if (deco.LightRadius > 0 && deco.LightBrightNess > 0)
					if (deco.AmbientGlow == 0)
						deco.AmbientGlow = 254;
		Destroy();
	}
}

defaultproperties {
	bHidden=true
	CollisionRadius=0
	CollisionHeight=0
}

Re: DistanceLightning tweaking

Posted: Mon May 16, 2016 6:24 am
by sektor2111
Client login doesn't really need a hook, exist a simple method to gain new player, yes there are always multiple solutions for the same thing. See topic with "Player On-Line" by Loathsome. Similar code has been already used. Not sure if is faster because involves server participation.