Dynamic coronas have issues ?

Discussions about UT99
Post Reply
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Dynamic coronas have issues ?

Post by sektor2111 »

I was writing some lightning stuff but... something looks not that nice, for my surprise, ON-Line these things don't seems to have issues - at least I did not see any.
OFF Line in exchange sometimes they are gone until I walk back in other zone and I'm coming there again 3-4 times and then they are OK. I passed from both client and server this job and then only client and then back to both - OFF-Line do works more borked than ON-Line. I was trying to simulate a candle burning more closer to reality.
Speaking without to show anything means nothing. As a faster method I did an external Screen capture (I don't install stuff to slow me down) so I captured 10 seconds of sample archived on my GDrive.
I was using a subclass of Light with small fine tuning at defaultproperties having some code (which I can change).
Spoiler

Code: Select all

//=============================================================================
// BurningLight.
//=============================================================================
class BurningLight expands Light;

var INT i;
var() Texture Sk1, Sk2;
var() float DScaleMin, DScaleMax;
/*
replication
{
	unreliable if (ROLE==ROLE_Authority)
		Sk1, Sk2, DscaleMin, DscaleMax, i;
}
*/
simulated state() Burning
{
Begin:
	if ( Sk1 == None || Sk2 == None )
		Goto('End');
LoopBurn:
	if ( bCorona )
	{
//		if (Level.NetMode != NM_DedicatedServer)
//		{
			i = Rand(2);
			if ( i <= 0 )
				Skin = Sk1;
			if (i >= 1)
				Skin = Sk2;
			DrawScale = RandRange(DScaleMin,DScaleMax);
//		}
		if ( FRand()<0.1 )
			Spawn (class'UT_BlackSmoke',,,Location+vect(0,0,10)).RemoteRole=ROLE_None;
	}
	Sleep(RandRange(0.1,0.16));
	GoTo ('LoopBurn');
End:
	Stop;
}
What do you think ?
nogardilaref
Masterful
Posts: 577
Joined: Tue Jun 20, 2017 1:00 pm
Personal rank: ⚋⚊⚌☰⚞⌖⚟☰⚌⚊⚋

Re: Dynamic coronas have issues ?

Post by nogardilaref »

Coronas in UT are quite buggy, in one moment they might work just fine, in another might simply not work at all.
Normally this only happens when there are too many coronas to render at once (the limit is very low, like about 8 or so I believe? I am not sure), but from there, anything you try out to do with them in terms of getting dynamic will end up stop working at any given moment (I've tried in the past, although I could have done something wrong too, it's not out of the realm of possibility).

The only solution which works 100% of the time is to build your own, or use an existing one which doesn't use the actual light coronas themselves.
It's not too complicated to do, you just need to either use an actor as a sprite and toy with SpriteProjForward depending on the player distance and view rotation, or render a sprite on the canvas directly as long as it's in view (FastTrace and FOV).

The first one has the advantage that you don't have to worry on how you're going to render it, but it's tricky to update it without bugs (go faster ahead, and it disappears, go backwards, and it will lag behind), although there are ways around this which work quite flawlessly, and you cannot colorize it.
While the second you can colorize (since it becomes a texture in the canvas) and doesn't suffer from the potential update bugs, but then you have to actually render it on the canvas yourself and do other kinds of graphical calculations, which may include perhaps injecting an HUD mutator or something similar exactly for this (although I am not sure how it would overlap the HUD itself).

From there, even other things like LensFlares, or even increasing the quality of the tracing (to become occluded by non-BSP actors for example), would be rather trivial to do.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Dynamic coronas have issues ?

Post by sektor2111 »

The fact is that ON-Line never stopped working, happens just OFF-Line but they recover when I leave direct view a few times (3-4 times) and then they stay properly. First I did a sprite animation but that was just too constant like a boring clock "tick-tock" with no random character at all, that's why I tried this, else because in Net games do works,,, I think I'll leave it as it is - but it will be restricted to run only in Player as it was initially and probably removing smoke - too many actors spawned is not my way of doing, I'll think about... Here also I was trying other animated stuff and even if I was scaling textures to a non standard surface size I did not see anything bad - not even in default D3D.
nogardilaref
Masterful
Posts: 577
Joined: Tue Jun 20, 2017 1:00 pm
Personal rank: ⚋⚊⚌☰⚞⌖⚟☰⚌⚊⚋

Re: Dynamic coronas have issues ?

Post by nogardilaref »

Yes, it's weird that online it works well, since what I referred tends to be a purely render problem and nothing else, but since I you didn't post the defaultproperties of the class you created (if there are any?) I am not sure if you changed anything which could affect the online relevancy of the actor, and thus "working well" only because the lights actually disappear from existence and reappear from time to time, clearing up any "cache" mechanisms they might have on whether the corona should be rendered or not (I don't know if there's any "caching" or so, but this is the only thing that comes to my mind atm).

Could you post a test map, with your actor MyLevel'd or so to check it out? That way, once I have a bit of time today, I can see exactly what you're seeing and help you try to figure it out (I am curious too :D ).
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Dynamic coronas have issues ?

Post by sektor2111 »

It will be public but I have to finish it first, I was thinking at some "bugs" to do. there is a a room having computers (with animated screen of course) and then assuming player could see some error and a trigger saying "I told them to not install last drivers" or something like that - inspired from real life followed by a blue screen of death.
Some BurningLight properties:
[attachment=0]BurnLight.PNG[/attachment]
Attachments
BurnLight.PNG
nogardilaref
Masterful
Posts: 577
Joined: Tue Jun 20, 2017 1:00 pm
Personal rank: ⚋⚊⚌☰⚞⌖⚟☰⚌⚊⚋

Re: Dynamic coronas have issues ?

Post by nogardilaref »

Well, at the first sight, everything seems to be fine there. You removed bStatic (which was expected) but you kept bNoDelete, so the light should always be relevant throughout the game no matter what, so it's clearly not a relevancy problem (or fix in this case).

However, it seems that your code is running both in the server and client, since you commented out the "Level.NetMode != NM_DedicatedServer" condition, which means that the drawscale is being updated both in the client and server, thus it gets updated twice in the server (once at the client itself, and another when it receives the change from the server) around every 0.1 seconds (the net frequency), give or take (due to your timer).

But since you commented it out, I imagine that you tried with it and you see the same behavior anyway? The frequency of update (not the net one, the change in drawscale itself) is the only thing I imagine that could influence that, although once again I am not entirely sure since coronas have always been extremely buggy in this engine.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Dynamic coronas have issues ?

Post by sektor2111 »

I was playing with them like I said, client-only and/or both, the same effects final code will be dynamic only in client. VIA server ON-Line issues are None. Probably some clamps are gone from renders when "Level.NetMode == NM_Client" because server doesn't render and so it will not cap nothing just telling to client: hey, dude, do this task - it's an order.
In "NM_StandAlone" all action is done by the same engine so it might be quit self spamming. This is my first time when I could see things working better ON-Line than OFF-Line :noidea , usually all borked things were having problems at ON-Line :lol2: .
Next 3 zones might not need super duper setup, monster in charge there is holding some strong weapon, battle is the goal, not every player is interested about tricks, too much load is useless. Now map has around 11 MB without ScreenShots just with new textures and some imports from other bugged map (brushes stripped/removed - probably fixing is nasty) but having a bit of quality here and there.
Post Reply