DistanceLightning tweaking

Search, find and discuss about Mutators!
Post Reply
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

DistanceLightning tweaking

Post 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.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: DistanceLightning tweaking

Post 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]
Attachments
With_Mutator02.png
Original_02.png
With_Mutator.png
Original.png
LightningTw_2.zip
(1.62 MiB) Downloaded 110 times
Last edited by sektor2111 on Sun Mar 27, 2016 10:02 am, edited 2 times in total.
User avatar
papercoffee
Godlike
Posts: 10443
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.
Contact:

Re: DistanceLightning tweaking

Post by papercoffee »

Dude this is neat ...So, this is a server only mutator?
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: DistanceLightning tweaking

Post 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')
	[..]
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: DistanceLightning tweaking

Post 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.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: DistanceLightning tweaking

Post 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 ?
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: DistanceLightning tweaking

Post 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
}
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: DistanceLightning tweaking

Post 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.
Post Reply