UnrealSP.org, now with 100% more Web 2.0!

Destructible Lights Mutator (Online/Multiplayer Update)

For questions and discussion about UnrealEd, UnrealScript, and other aspects of Unreal Engine design.

Moderators: Semfry, ividyon

User avatar Shivaxi
Gilded Claw Gilded Claw
Posts: 1916
Joined: 24 Jun 2008, 19:51
Location: Behind You! =P
Contact:

Subject: Destructible Lights Mutator (Online/Multiplayer Update)

Post Posted: 06 Mar 2014, 01:54

Ever wanted to break and destroy every light in a level before? Cause who doesn't love darkness!

[227 ONLY] Destructible Lights v2.4

v2.4 changelog:

-Fixed bug where trigger would trigger other trigger and repeat causing a massive duplication of effects spawning and killing your framerate/sometimes crashing servers and clients. Performance is INCREDIBLY increased now.
-Now works online 100%
-Fixed damage threshold so dealing at least 5 damage to a light will cause it to flicker and spark


DOWNLOAD >>> https://www.dropbox.com/s/6nqayop1peddr ... .zip?raw=1

MEDIA >>> http://www.twitch.tv/shivaxi/b/508581972 - short video showing off the mutator

How To:

INT file included as to show up in your Mutators list, titled "Destructible Lights" or by command line, Mutator = DestructibleLights.DestructibleLights

It's highly recommended you turn permanent decals on by going to Options, Advanced Options, Decals, Config, and set DecalLifeSpan to 0. This will ensure the burn mark does not disappear, which is actually spawned to darken unlit textures =P Yes, kinda hacky I know. I'd also recommend turning off UseAA and setting NumAASamples to FALSE in your rendering options, as this seems to have a performance impact on the particle emitters, and Destructible Lights may lag at times when blowing up lights.

Again, this is for Single Player only! Will not work correctly online!

Works online now!

Features:

-Every light totally destructible! (Disclaimer: Some lights, especially those in custom maps, may not fully be breakable)
-Flicker and spark effects when light is damaged
-Shatter and electric sounds when light destroyed
-Sparks, glass, and electric effects when light destroyed
-Exploding lights cause damage in a small nearby radius
-Burn mark decal when lights explode


Right, some of you may have already seen this, as originally this is a part of RLCoop. Releasing this now as a standalone mutator for those who want to enjoy this silly little mod. Yes, every light is now breakable, shatterable, destructible, and so forth. "But shiv! what about lights that aren't supposed to be destructible? Like ambient lighting or lava, etc" So glad you (didnt) asked! For anyone who cares how the mod works, read the following. If not, tldr.

================================

The Science!
(and mostly backstory)

Alright so, this is really simple actually, and honestly I'm surprised that nobody has thought of this before, as this literally took me maybe 10 to 20 minutes to fully script (at least the initial part in order to make lights destroyable). If somebody has thought of this before and there's another mod out that does the same thing, then apologies. Also, I must give some credit to Cheese for inspiring the idea. Several years ago, we made a halloween mutator for my server, which essentially killed all the lights in levels, making it pitch black, and lighting up the skybox orange. And in order for that to work, Cheese made the mutator call the "flush" command to every client who joined the server so that the lighting would update. And only now did that get me thinking, and actually to realize that destructible lights could be possible with that very "flush" command.

This is a simple mutator which spawns a special custom trigger on top of every single light actor. Mutator checks "is this a light?" if yes, spawn this trigger, and set the trigger's Event to the lights name (ex., light23), and set the light's Tag to the light's name (ex. light23). So now the trigger is where the light is, and it triggers the light when triggered...which is triggered by damage of course. What the custom trigger does, is set the light's brightness to 0 when triggered, to whatever light it's attached to. It also sets the light's DrawScale to 0, which makes Corona effects disappear. Now as I mentioned earlier, in order to see that the light's brightness has changed, the "flush" command must be called every time a light trigger is triggered. This way everyone can see the updated lighting. Pretty simple. And since I'm changing light's tags and such, obviously I can't make this work for TriggeredLights, as I'd break some scripted scene stuff.

That was the initial stage and everything worked hunky dory. The hard part comes when differentiating between ambient lighting that isn't supposed to be killed, and light's that should shatter. This is where Bleeder came in and helped me write a tracer code, in which every trigger that spawns on a light, sends out a tracer in every direction, and looks for the nearest light texture. It does this by basically searching for "light" in the texture name. Surprisingly, this works extremely effectively, and most maps (and all stock as far as I've tested) work perfectly. Of course the tracer has a limited range and such as to not attach to some light 50 miles away, and if the tracer finds nothing, the trigger kills itself.


================================

So yeah, that's the core of it essentially. Later on I was thinking about making a customizable mutator to go along with this, where you could specify trigger locations and their attachments to lights for custom levels that don't work 100% with this mutator. But that will be in the future.

I also want to eventually get a multiplayer version working. Right now, the "flush" command does not work online for players...god knows why. I welcome anyone to try and figure that part out, as both Bleeder and I have tried everything, and we're stumped. The only reason it works online in RLCoop, is because we implemented the "flush" command to be called directly from our RLPlayer class. Obviously that's not an acceptable solution for the standalone version here.

Works online now!
Last edited by Shivaxi on 10 Aug 2015, 18:31, edited 8 times in total.
http://img836.imageshack.us/img836/9950/shivavatar2.jpg Image

Waffnuffly: If there is any purpose for the god damned ocean, it is for us to eat it.
Jet_v4.3.5: I want to be Lincoln and kick Satan's ass. Emancipate and Proclimate on his ass.

User avatar SteadZ
Skaarj Warlord Skaarj Warlord
Posts: 883
Joined: 04 Mar 2012, 10:52
Location: An error occurred. Please try again later.
Contact:

Subject: Re: Destructible Lights Mutator

Post Posted: 06 Mar 2014, 02:13

Noice, been waiting for this release for a while :D

(though for some reason I already seem to have a version of this... strange...)

.......
SZ
.......
Image

User avatar Shivaxi
Gilded Claw Gilded Claw
Posts: 1916
Joined: 24 Jun 2008, 19:51
Location: Behind You! =P
Contact:

Subject: Re: Destructible Lights Mutator

Post Posted: 06 Mar 2014, 02:18

SteadZ wrote:Noice, been waiting for this release for a while :D

(though for some reason I already seem to have a version of this... strange...)

.......
SZ
.......



Maybe you cache ripped it from when you played one of the RLCoop events with us =P. That version won't work though without all the RLCoop packages as well, since it's tied to RLPlayers. And actually, you'd have to play as the RLPlayer pawn for that version to work right xD

Essentially, destructible lights can be done in a just simple mutator, and wouldn't even require being in server packages if I didn't build some custom effects. I wanna make a non-227 version that just uses stock effects, and can run on servers without needing to be in server packages.
http://img836.imageshack.us/img836/9950/shivavatar2.jpg Image

Waffnuffly: If there is any purpose for the god damned ocean, it is for us to eat it.
Jet_v4.3.5: I want to be Lincoln and kick Satan's ass. Emancipate and Proclimate on his ass.

User avatar Dr.Flay
Skaarj Lord Skaarj Lord
Posts: 222
Joined: 23 Aug 2012, 06:24
Location: Kernow, UK
Contact:

Subject: Re: Destructible Lights Mutator

Post Posted: 10 Mar 2014, 03:26

Possibly some of the coding nerds at ut99.org can help with the multiplayer update.
This is a mod I have suggested before.
My previous option was to add destroyable light-bulb decos, and set their properties to what the invisible light is.
This is perfect for stealth matches.

User avatar Shivaxi
Gilded Claw Gilded Claw
Posts: 1916
Joined: 24 Jun 2008, 19:51
Location: Behind You! =P
Contact:

Subject: Re: Destructible Lights Mutator (Multiplayer Update)

Post Posted: 19 Mar 2014, 00:05

Updated first post to V2 which supports online & multiplayer now, working 100% as far as I've tested.

EDIT: Updated to v2.1 Accidentally did not fix the threshold thing, so now it works. Minor bug.
http://img836.imageshack.us/img836/9950/shivavatar2.jpg Image

Waffnuffly: If there is any purpose for the god damned ocean, it is for us to eat it.
Jet_v4.3.5: I want to be Lincoln and kick Satan's ass. Emancipate and Proclimate on his ass.

User avatar Shivaxi
Gilded Claw Gilded Claw
Posts: 1916
Joined: 24 Jun 2008, 19:51
Location: Behind You! =P
Contact:

Subject: Re: Destructible Lights Mutator (Online/Multiplayer Update)

Post Posted: 14 Feb 2015, 20:28

updated to version 2.2
http://img836.imageshack.us/img836/9950/shivavatar2.jpg Image

Waffnuffly: If there is any purpose for the god damned ocean, it is for us to eat it.
Jet_v4.3.5: I want to be Lincoln and kick Satan's ass. Emancipate and Proclimate on his ass.

User avatar Shivaxi
Gilded Claw Gilded Claw
Posts: 1916
Joined: 24 Jun 2008, 19:51
Location: Behind You! =P
Contact:

Subject: Re: Destructible Lights Mutator (Online/Multiplayer Update)

Post Posted: 27 Feb 2015, 21:40

v2.3 update:

fixes a big performance issue for online play, especially with huge maps that have a lot of light actors (Attacked4[wtf].unr for example) which previously would cause the map to be virtually unplayable due to all the DLTriggers being bAlwaysRelevant. There would be so many that effects and players and monsters would be invisible basically and pretty much break servers =P

Now DLTriggers are bAlwaysRelevant = False by default until shot and triggered, becoming bAlwaysRelevant = True in order for the flush and lighting to work and update for all players.
http://img836.imageshack.us/img836/9950/shivavatar2.jpg Image

Waffnuffly: If there is any purpose for the god damned ocean, it is for us to eat it.
Jet_v4.3.5: I want to be Lincoln and kick Satan's ass. Emancipate and Proclimate on his ass.

User avatar []KAOS[]Casey
Skaarj Berserker Skaarj Berserker
Posts: 426
Joined: 25 Sep 2008, 07:25

Subject: Re: Destructible Lights Mutator (Online/Multiplayer Update)

Post Posted: 01 Mar 2015, 07:11

Just be sure to set always relevant false after a second or two. You wouldn't want to hit the actor channel limit; someone can probably easily (but tediously) poke all the lights to flood the limit, assuming you don't set always relevant back to false.

p.s.: you could use a replicated function to a simulated actor that is on both the client and server that contains a reference to the actor that is being modified so that you don't need to use balwaysrelevant, but that's a bit more involved.

User avatar Shivaxi
Gilded Claw Gilded Claw
Posts: 1916
Joined: 24 Jun 2008, 19:51
Location: Behind You! =P
Contact:

Subject: Re: Destructible Lights Mutator (Online/Multiplayer Update)

Post Posted: 10 Aug 2015, 18:30

CRITICAL UPDATE:

Updated first post, released version 2.4 which addresses and fixes a bug where trigger would trigger other trigger and repeat causing a massive duplication of effects spawning and killing your framerate/sometimes crashing servers and clients. Performance is INCREDIBLY increased now.

Download v2.4 - https://www.dropbox.com/s/6nqayop1peddr ... .zip?raw=1
http://img836.imageshack.us/img836/9950/shivavatar2.jpg Image

Waffnuffly: If there is any purpose for the god damned ocean, it is for us to eat it.
Jet_v4.3.5: I want to be Lincoln and kick Satan's ass. Emancipate and Proclimate on his ass.


Who is online

Users browsing this forum: No registered users and 32 guests

Copyright © 2001-2024 UnrealSP.org

Powered by phpBB® Forum Software © phpBB Limited