Override bStatic or bNoDelete from default value False to True

Discussions about Coding and Scripting
Post Reply
Buggie
Godlike
Posts: 2698
Joined: Sat Mar 21, 2020 5:32 am

Override bStatic or bNoDelete from default value False to True

Post by Buggie »

Why all so fear override bStatic or bNoDelete from default value False to True?

As I see, it is completely safe operation for network play.

Opposite is not true of course.

If bStatic or bNoDelete default values is true, you need subclass Actor and set it to False.
Explanation why
Why?
Because when map start, on client all actors without bStatic or bNoDelete will be delete.
https://github.com/TheBearProject/Unrea ... e.cpp#L715

Code: Select all

// Handle network issues.
if( !GLevel->IsServer() )
{
	// Kill off actors that aren't interesting to the client.
	for( INT i=0; i<GLevel->Num(); i++ )
	{
		AActor* Actor = GLevel->Actors(i);
		if( Actor )
		{
			if( Actor->bStatic || Actor->bNoDelete )
				Exchange( Actor->Role, Actor->RemoteRole );
			else
				GLevel->DestroyActor( Actor );
		}
	}
}
So your actor with overridden bStatic or bNoDelete will be deleted for be spawned on runtime by server send.
So when actor become relevant to client, server send it to client for spawn local copy.
https://github.com/TheBearProject/Unrea ... ct.cpp#L19

Code: Select all

//
// Create a new actor. Returns the new actor, or NULL if failure.
//
AActor* ULevel::SpawnActor
(

Code: Select all

	else if( !GIsEditor && (Class->GetDefaultActor()->bStatic || Class->GetDefaultActor()->bNoDelete) )
	{
		debugf( NAME_Warning, "SpawnActor failed because class %s has bStatic or bNoDelete", Class->GetName() );
		return NULL;		
	}
But because of this check, spawn on client failed and network play is broken.
As I see, if we override bStatic or bNoDelete from default value False to True:
1. Actor not deleted on map start on client.
2. Actor exists on server with same state of bStatic or bNoDelete.
3. Nothing prevent work network play as it must be.

So why all fear override bStatic or bNoDelete from default value False to True?
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Override bStatic or bNoDelete from default value False to True

Post by Barbie »

Who says this? Only changing from TRUE to FALSE does not work online.
Do you remember the vases where shooting with miniguns creates hundreds of fragments? IMO these vases have a changed property bStatic from FALSE to TRUE.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
Buggie
Godlike
Posts: 2698
Joined: Sat Mar 21, 2020 5:32 am

Re: Override bStatic or bNoDelete from default value False to True

Post by Buggie »

Hmm. Possible my memory failed me.

Also. Second question:
What about change default value bStatic from default true to false WHILE bNoDelete (default or not, does not matter) is True?

As for me it is look like safe change, because bNoDelete actors not spawn on clients. Just replicate it fields.

Also some question for case when change default value bStatic from default true to false WHILE RemoteRole (default or not, does not matter) is ROLE_None?
There no any replication. Actor exists on server only no any network issues.
This can be useful for some things, which need for server only.
Barbie wrote: Tue May 11, 2021 11:39 am Do you remember the vases where shooting with miniguns creates hundreds of fragments? IMO these vases have a changed property bStatic from FALSE to TRUE.
Possible. It is not a Silver bullet of course.
But if I want change bStatic on Panel (which not used for Fade or move) then this change save network bandwidth and reduce channels count. No need mess with subclass here.
Barbie wrote: Wed Oct 21, 2020 12:48 am MH-TheFifthVortexBeta4.KHMBase0.ReportNoneDefault_bStatic LOG_Error: ObjectPath1.bStatic=False is not the default value
Also in this case change is fine, because this actor not need on client side, and if leave bStatic True (as default) Tick on it not called on server side and things stop work.
It is EPIC mistake. This class must be bStatic = False and RemoteRole to ROLE_None. They just extends it from Keypoint which set bStatic=True (and not override bMovable=True and RemoteRole=ROLE_DumbProxy from Actor :pfff: ).
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Override bStatic or bNoDelete from default value False to True

Post by sektor2111 »

Static decorations supposed to stay can be a sort of BllockAll actors not hidden, having a mesh, changed DrawType. This is what one of my patches does turning a spammer "Vase" into a nice one very relaxed and happy when you are firing it.
bNodelete returned good results at those waves (Dynamic water more exactly) keeping a perfect alignment.
Buggie wrote: Tue May 11, 2021 11:27 am Why all so fear override bStatic or bNoDelete from default value False to True?
This is not doing major damage, it can even be more helpful, but things are not nice in reverse -> True to False.
MapGarbage has warnings for some of these checks but this doesn't means that they are always issues generators. I changed checker code based on my notes and logs collected.
Eternity
Skilled
Posts: 166
Joined: Sat Nov 30, 2019 10:56 pm

Re: Override bStatic or bNoDelete from default value False to True

Post by Eternity »

Buggie wrote: Tue May 11, 2021 11:27 amoverride bStatic or bNoDelete from default value False to True
In some rare cases this results in random crashes at the client side. I still don't have an answer why does this happen.
Buggie
Godlike
Posts: 2698
Joined: Sat Mar 21, 2020 5:32 am

Re: Override bStatic or bNoDelete from default value False to True

Post by Buggie »

This is not an answer. "There lives Dragons".
If you not know reason or exact way how this happen - reason can be any. Not necessary this one.
"After" not mean "by reason".
post hoc ergo propter hoc
Last edited by Buggie on Thu May 13, 2021 3:42 pm, edited 1 time in total.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Override bStatic or bNoDelete from default value False to True

Post by sektor2111 »

I would like to know more about client settings and examining log. Perhaps I cannot say that something can be done, but... I might be aware about crusher stage, recording bad occurrence and trying a mitigation or solving problem other way.
Post Reply