fake "Dynamics" shadows again..

Discussions about Coding and Scripting
User avatar
Daewon
Novice
Posts: 19
Joined: Sun Jan 04, 2009 4:57 pm
Location: Czech Republic

fake "Dynamics" shadows again..

Post by Daewon »

Chain of light's idea (faster switching that TriggerLight).
btw if you set DynamicLight view, UE crashes (there is more that thousand light sources in small area :omfg: )
https://wetransfer.com/downloads/1ad421 ... 901/76c4fc

Code: Select all

//=============================================================================
// LightPath. by Daewon
//=============================================================================
class LightPath expands Light;

var()   float DistanceBetween, ChangeTime; // distance to next Light
var   float InitialBrightness, RadiusCheck; // Initial brightness.
var   float Alpha, Direction;
var()   byte ChainNum;  // chain id
var()   bool bshowLight; // debug
var()   vector SkipToLocation;
var   vector NextLoc;

simulated function BeginPlay()
{
	Disable( 'Tick' );
	InitialBrightness = LightBrightness;
	Alpha     = 0.0;
	Direction = -1.0;
	RadiusCheck = DistanceBetween/2;
	if(SkipToLocation==vect(0,0,0))
		NextLoc = Location + DistanceBetween * Vector(Rotation);
	else
		NextLoc = SkipToLocation;
	if(!bshowLight)
		DrawType = DT_None;
}

function Tick( float DeltaTime )
{
	Alpha += Direction * DeltaTime / ChangeTime;
	if( Alpha > 1.0 )
	{
		Alpha = 1.0;
		Disable( 'Tick' );
	}
	else if( Alpha < 0.0 )
	{
		Alpha = 0.0;
		Disable( 'Tick' );
	}	
	LightBrightness = Alpha * InitialBrightness;
}

// Trigger turns the first light on.
auto state PathLightTriggerON
{
	function Trigger( actor Other, pawn EventInstigator )
	{
		GoToState('PathLightON');
	}
}

state PathLightON
{
	function BeginState()
	{	
		Direction = 1.0; // light turns on
		Enable( 'Tick' );
		SetTimer (ChangeTime, false);
	}
	function Trigger( actor Other, pawn EventInstigator )
	{
	}
	function Timer () {
		local LightPath N;
		foreach RadiusActors( class 'LightPath', N, RadiusCheck, NextLoc ){
			if(N.ChainNum==ChainNum) // same chain
				N.Trigger(self, self.instigator);
		}
		GoToState('PathLightOFF');
	}

}

state PathLightOFF
{
	function BeginState()
	{
		Enable( 'Tick' );
		Direction = -1.0; // light turns off
		SetTimer (ChangeTime, false);
		if(bshowLight)
			DrawScale = 0.5;		
	}
	function Timer () {
		if(bshowLight)
			DrawScale = Default.DrawScale;
		GoToState('PathLightTriggerON');
	}
}
ShaiHulud
Adept
Posts: 459
Joined: Sat Dec 22, 2012 6:37 am

Re: fake "Dynamics" shadows again..

Post by ShaiHulud »

That creates a really cool effect, nicely done.

...I like the music too.
Last edited by ShaiHulud on Fri Oct 23, 2020 3:17 am, edited 1 time in total.
User avatar
Deepu
Adept
Posts: 353
Joined: Mon Nov 11, 2013 7:56 am
Personal rank: Average
Location: India
Contact:

Re: fake "Dynamics" shadows again..

Post by Deepu »

😲😲😲
User avatar
UnrealGGecko
Godlike
Posts: 2904
Joined: Wed Feb 01, 2012 11:26 am
Personal rank: GEx the Gecko
Location: Kaunas, Lithuania
Contact:

Re: fake "Dynamics" shadows again..

Post by UnrealGGecko »

Nice to see ya here again Daewon, hoping to use your dynamic water script soon :)

And yea looking really good here as well!
User avatar
Leo(T.C.K.)
Inhuman
Posts: 875
Joined: Sat Aug 13, 2011 10:26 pm

Re: fake "Dynamics" shadows again..

Post by Leo(T.C.K.) »

I'll try this later when I get a chance. Though maybe it would be also cool to create the scriptedlights from unreal 2 alpha (most of it is native code unfortunately, but the source code for that is avaiable somewhere (I can provide a link)) but instead in unrealscript so that more accurate conversion of the maps could be made. It allowed for greater control than triggerlights and could even be used in avp-like situations where you'd shoot down the lightsources and all that. The Unreal 2 2000 alpha also had its own implementation of dynamic water, called wavymesh, but I used daewon's dynamic water quickly as a replacement although the wavymesh didn't need you to create duplicates of it so much as dynamicwater does if you want to make it realistic (that's why it isn\t realistic for the shian conversion).

The ligthing system was also reworked in the alpha, allowing for things like u2flashlight having stacked on light, which doesn't work in regular engine and not even in released unreal 2 where if you'd use u2flashlight it would instead flood the entire area with light which wasn't the intended behavior but u2flashlight was just a leftover there in the released game, not meant to be used anymore.

Here is how it worked originally:

FlashLight video
That was shown on the earliest draft of the drakk levels which was instead in concept more similar to Jupiter(a cut map using special decayeds textures not used in the original Unreal game) than anything else.

There's also another video of this early unreal 2 running on heavily modified ut engine.
other video

Sorry for the low res, I don't have youtube anymore.
User avatar
Gustavo6046
Godlike
Posts: 1462
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Resident Wallaby
Location: Porto Alegre, Brazil
Contact:

Re: fake "Dynamics" shadows again..

Post by Gustavo6046 »

Aa this looks so cool!

Does someone have the file? The original download link is expired. I want to check this map too!
"Everyone is an idea man. Everybody thinks they have a revolutionary new game concept that no one else has ever thought of. Having cool ideas will rarely get you anywhere in the games industry. You have to be able to implement your ideas or provide some useful skill. Never join a project whose idea man or leader has no obvious development skills. Never join a project that only has a web designer. You have your own ideas. Focus on them carefully and in small chunks and you will be able to develop cool projects."

Weapon of Destruction
User avatar
Leo(T.C.K.)
Inhuman
Posts: 875
Joined: Sat Aug 13, 2011 10:26 pm

Re: fake "Dynamics" shadows again..

Post by Leo(T.C.K.) »

Unfortunately I didn't get it in time either. I was mostly responding to the script that was posted. It was a really bad idea using such a host.

He should have attached it instead.
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: fake "Dynamics" shadows again..

Post by sektor2111 »

LightPath_02.zip
(375.15 KiB) Downloaded 34 times
User avatar
Leo(T.C.K.)
Inhuman
Posts: 875
Joined: Sat Aug 13, 2011 10:26 pm

Re: fake "Dynamics" shadows again..

Post by Leo(T.C.K.) »

Thanks sector. Much appreciated. Daewon doesn't seem to be around now though. Hope I didn't scare him away.
User avatar
PrinceOfFunky
Godlike
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

Re: fake "Dynamics" shadows again..

Post by PrinceOfFunky »

Light settings can be changed at run-time? Aren't lights baked??
"Your stuff is known to be buggy and unfinished/not properly tested"
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: fake "Dynamics" shadows again..

Post by sektor2111 »

If I understand well the code first thing which I'm saying is: RESPECT ! This dude has addiction for doing goodies, I used that dynamicwater as well - tuned for networking of course. All waves would be pointed to Client, not Server and consuming less network resources.

These lights do look like "triggeredlights" but chained and a bit modified. Previous is turned off while is activating next in chain. The only problem is that you cannot see well how does it looks like in run-time from Editor, because in Editor so much lightning in spot is hazard for viewport... But it works in Texture View mode. Interesting concept for Level-Design enthusiasts. The only dynamic lightning which I did in UT was some torches flickering, some train-lights - no shadows like here, and the rest was Paths blabbering. Some project which I would like to do in whatever good disposition state, would be some Traffic-Lights but... I need an environment, time, design skill (I don't have too much). These are things which I find toward creativity subject... operational not only as beta or another state.
User avatar
PrinceOfFunky
Godlike
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

Re: fake "Dynamics" shadows again..

Post by PrinceOfFunky »

Wait a second... If the only problem for this new light is the fact that it doesn't affect direct lighting but only indirect, then there may be a workaround. A TriggerLight does the exact opposite, it only affects indirect lighting. Did you try using this new light in conjunction with a TriggerLight?

Edit: Just noticed that the new light affects BSP only, not just indirect lighting. But still, a TriggerLight affects meshes too.
"Your stuff is known to be buggy and unfinished/not properly tested"
User avatar
Gustavo6046
Godlike
Posts: 1462
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Resident Wallaby
Location: Porto Alegre, Brazil
Contact:

Re: fake "Dynamics" shadows again..

Post by Gustavo6046 »

Well, thanks for the download! I am excited, I can't wait to play with this!
sektor2111 wrote: Wed Nov 04, 2020 9:29 pm If I understand well the code first thing which I'm saying is: RESPECT ! This dude has addiction for doing goodies, I used that dynamicwater as well - tuned for networking of course. All waves would be pointed to Client, not Server and consuming less network resources.
Of course! This is pretty clever. Although I don't think it's necessarily incredibly genius, it's still witty to use the built-in dynamic lights provided in Actors (LightType != LT_None, etc) to sample points in a path and light them up accordingly. I have my questions about performance, though.

It also appears that you're quite obsessed with "tuning" other people's code. You probably adjust replication parameters, adding client-side code (checking for Level.NetMode != NM_DedicatedServer) and all. I'd suggest against doing so, not to preserve the original code just for the sake of it, but rather so players can receive assistance from people who have the same original version of the code (arguably more common than some random Nelsona edits), and, consequently, so bug fixes can apply to that common version as well. Don't let your qualms, even valid or reasonable ones, become tragedy of the commons.
and the rest was Paths blabbering
Ah yes, sektor's trademark. Honestly I prefer you that way, your rambling gives a unique sense of 'you' to your posts! :D
"Everyone is an idea man. Everybody thinks they have a revolutionary new game concept that no one else has ever thought of. Having cool ideas will rarely get you anywhere in the games industry. You have to be able to implement your ideas or provide some useful skill. Never join a project whose idea man or leader has no obvious development skills. Never join a project that only has a web designer. You have your own ideas. Focus on them carefully and in small chunks and you will be able to develop cool projects."

Weapon of Destruction
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: fake "Dynamics" shadows again..

Post by sektor2111 »

Gustavo6046 wrote: Fri Nov 06, 2020 12:46 am adding client-side code (checking for Level.NetMode != NM_DedicatedServer) and all. I'd suggest against doing so, not to preserve the original code just for the sake of it,
When you will host/maintain servers perhaps you'll switch thinking other way. Yes, changing code doesn't affect original package because... it goes in MyLevel and server has no deal with client stuff - like I said before. In ages of battery powered devices, useless processing it's the last thing to do. Why server would need to render what nobody can see there ? Why server should load more in memory when it doesn't need those things. Why not getting over replication limitations and writing more real Net stuff ? Any reason for keep working at amoeba level like in years 2000 ? Or because people are not understanding how to keep server things in server and client things in client ? Servers configured by me don't even have defined a render class or audio drivers and those client specific lines - because a server is NOT USING them at all.
And no, I don't have plans for releasing any conformed versions, just MyLevel where they have to be.
User avatar
Gustavo6046
Godlike
Posts: 1462
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Resident Wallaby
Location: Porto Alegre, Brazil
Contact:

Re: fake "Dynamics" shadows again..

Post by Gustavo6046 »

Hardware nowadays is begging to be used, and such mostly superficial optimizations for code target for decades old platforms like Unreal Engine 1 are usually not necessary. Even network optimization like Replication becomes less and less relevant, although I agree Replication is awesome, and ESPECIALLY good if you have a flaky Latin American ADSL2 like mine.

It is always good network software engineering practice to keep client-side and server-side code separate. I never denied that. But it's often easier not to bother, especially in this day and age where it is becoming increasingly inconsequential to neglect these things. Even a shitty old PC can run an Unreal Tournament dedicated server just fine.

Also, even if the code is in MyLevel, by changing it you implicitly assume responsibility for fixing any bugs other people find in it. No programmer is ever perfect, not even you, not even myself. UnrealScript might not have null-terminated strings addressed by char* pointers, but it sure has a heck of a lot of its own ways to break stuff anyway. If the original version is more popular, it's far more likely to be more actively supported, including bugfixes and even improvements. If you use Git, you can at least merge them. But who uses Git in the Unreal Tournament modding scene? Apart from Higor?

Dude, Higor's the man. He's super, super awesome. If I ever see him on the streets I'll have to run back home to change my pants.... AHEM! Back on topic.

I still agree with you, sektor. I just find that you are often a tiny little bit too concerned about code quality! In real life, especially in the trade, like in companies and whatnot, the best code is code that does what it's supposed to do, and people don't really care how it looks like from the inside. Of course this leads to shitty things, *coughcough*Minecraft*cough*shitty netcode*cough*, but the reality is it usually doesn't really matter. Even some random sidewalk change, like a few bucks from even a third-world economy's currency, can get you a processor nowadays. Sure, that's not a computer, but it's halfway there, and today's cheap processors are much more powerful than back then's expensive ones, like the NEC 65c02 or the Motorola 68000.

But netcode is important. And, even today, we see some cases of exceptional neglect sometimes. *cough*Minecraft*cough*.
"Everyone is an idea man. Everybody thinks they have a revolutionary new game concept that no one else has ever thought of. Having cool ideas will rarely get you anywhere in the games industry. You have to be able to implement your ideas or provide some useful skill. Never join a project whose idea man or leader has no obvious development skills. Never join a project that only has a web designer. You have your own ideas. Focus on them carefully and in small chunks and you will be able to develop cool projects."

Weapon of Destruction
Post Reply