Is there a way to know if an actor can be replicated?

Discussions about Coding and Scripting

Is there a way to know if an actor can be replicated?

Postby PrinceOfFunky » Sat Oct 08, 2016 9:18 pm

Is there a way, in UnrealScript, to check if an actor can be replicated?
Image
User avatar
PrinceOfFunky
Inhuman
 
Posts: 991
Joined: Mon Aug 31, 2015 10:31 pm

Re: Is there a way to know if an actor can be replicated?

Postby EvilGrins » Sat Oct 08, 2016 9:23 pm

I may be oversimplifying this (or possibly not understanding the question) but it seems the simplest way to go would be to find the actor, right click on said actor, and hit "duplicate".

If nothing happens... then it can't be replicated.
http://unreal-games.livejournal.com/
Image
medor wrote:Replace Skaarj with EvilGrins :mrgreen:
User avatar
EvilGrins
Godlike
 
Posts: 6122
Joined: Thu Jun 30, 2011 8:12 pm
Location: Palo Alto, CA
Personal rank: God of Fudge

Re: Is there a way to know if an actor can be replicated?

Postby PrinceOfFunky » Sat Oct 08, 2016 9:26 pm

EvilGrins wrote:I may be oversimplifying this (or possibly not understanding the question) but it seems the simplest way to go would be to find the actor, right click on said actor, and hit "duplicate".

If nothing happens... then it can't be replicated.

PrinceOfFunky wrote:in UnrealScript

:/
Image
User avatar
PrinceOfFunky
Inhuman
 
Posts: 991
Joined: Mon Aug 31, 2015 10:31 pm

Re: Is there a way to know if an actor can be replicated?

Postby EvilGrins » Sat Oct 08, 2016 9:55 pm

PrinceOfFunky wrote::/

Yes, I saw the script part but I don't know script.
http://unreal-games.livejournal.com/
Image
medor wrote:Replace Skaarj with EvilGrins :mrgreen:
User avatar
EvilGrins
Godlike
 
Posts: 6122
Joined: Thu Jun 30, 2011 8:12 pm
Location: Palo Alto, CA
Personal rank: God of Fudge

Re: Is there a way to know if an actor can be replicated?

Postby Wormbo » Sat Oct 08, 2016 10:30 pm

PrinceOfFunky wrote:Is there a way, in UnrealScript, to check if an actor can be replicated?

Look at my signature. There's a link to an article about replication, which mentions the conditions any actor must satisfy to be replicated. Pretty much all of them can be checked in UnrealScript. Leave out the location-based tests and you have a generic "might be replicable" check. (The bare minimum is a RemoteRole > ROLE_None, but maybe you want other verifications as well.)

EvilGrins wrote:I may be oversimplifying this (or possibly not understanding the question)

Replication and duplication are entirely unrelated topics.
User avatar
Wormbo
Adept
 
Posts: 258
Joined: Sat Aug 24, 2013 6:04 pm

Re: Is there a way to know if an actor can be replicated?

Postby PrinceOfFunky » Sat Oct 08, 2016 11:27 pm

Wormbo wrote:
PrinceOfFunky wrote:Is there a way, in UnrealScript, to check if an actor can be replicated?

Look at my signature. There's a link to an article about replication, which mentions the conditions any actor must satisfy to be replicated. Pretty much all of them can be checked in UnrealScript. Leave out the location-based tests and you have a generic "might be replicable" check. (The bare minimum is a RemoteRole > ROLE_None, but maybe you want other verifications as well.)

EvilGrins wrote:I may be oversimplifying this (or possibly not understanding the question)

Replication and duplication are entirely unrelated topics.

If an actor has RemoteRole > than ROLE_None, couldn't it just mean it replicates just its variables and probably not itself?
Image
User avatar
PrinceOfFunky
Inhuman
 
Posts: 991
Joined: Mon Aug 31, 2015 10:31 pm

Re: Is there a way to know if an actor can be replicated?

Postby sektor2111 » Sun Oct 09, 2016 12:16 am

SwarmSpawn is an actor used in server spawned/attached client doesn't know to much about, it is only feeling consequences (stuff spawned), I'm guessing, else No Guess > LiftCenter has RemoteRole = ROLE_None but being part of Level Player can figure it's existence but not changes to actor occurred in game > In client doesn't move with Lift it's completely stuck.
For the rest:
Code: Select all
//=============================================================================
// Actor: The base class of all actors.
// This is a built-in Unreal class and it shouldn't be modified.
//=============================================================================
class Actor extends Object
   abstract
   native
   nativereplication;
Pretty self explanatory... No ? Eh, it replicates itself but not all related visuals/variables, so it might be part of both client and server but some times client doesn't see all changes. Example ? Yes... Several light related craps.
So to speak I like more actors than objects subclassed in other sort of stuff...
User avatar
sektor2111
Godlike
 
Posts: 3774
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Is there a way to know if an actor can be replicated?

Postby PrinceOfFunky » Sun Oct 09, 2016 1:11 am

Well, thanks for the answers, but I just noticed, it may be another kind of problem. There are actors who get destroyed even if I didn't programmed them to be destroyed.

If you want know why I opened this topic, it was cause I thought the problem was related to this code:
Spoiler: show
Code: Select all
var Actor lastSpawn;

function Tick( float Delta ) {
   local Actor a;
   local bool lastSpawnReached;
   
   foreach AllActors(class'Actor', a) {
      if (bFirstIteration || lastSpawnReached) {
         GiveAMP(a);
         lastSpawn = a;
      } else {
         if (a == lastSpawn)
            lastSpawnReached = true;
      }
   }
   
   bFirstIteration = false;
}

The AllActors iterator iterates throught a chain of Actors where actors are added to the back of the chain. An AMP is spawned for every Actor, this means there will always be an AMP to the back of the Actors chain.

But I now understands it cannot be related to it, since Owner variable gets updated when a replicated actors "owning an actor" turns from being None to an actual Actor reference.

Now I just need to understand why those actors get Destroyed, and only when their Owner becomes None...
EDIT: Destroyed() is not even called, Expired() neither, so no one calls Destroy() or set a lifeSpan to the "AMP" actor.
EDIT2: I tried setting bNoDelete to true, they don't get deleted but of course I cannot use it since I couldn't destroy them anymore.

EDIT3: Omg o.o I found out what's the problem... It's a None assignment!
This would even solve a problem I had with UnrealRace, and probably a problem you(sektor) had with your A.I. tweak tool, as you wrote here(https://ut99.org/viewtopic.php?f=15&t=11324):
sektor2111 wrote:The rest of spawning problems are similar with my little tiny A.I. tweak tool. In certain Level (Zone) actors (some types) are not spawning or are immediately in deletion process


Now, it's 7am and still have to go sleep, so maybe that's why I'm having the following question in my mind right now:
ActorA.ActorB = None; is the same of ActorB = None; ?
If yes, at this point I couldn't change the value of ActorB with another actor to change the position of an Actor chain that starts from ActorA, like "ActorA.ActorB = ActorC". Would it change the reference of ActorB into ActorC, or just the value?
Image
User avatar
PrinceOfFunky
Inhuman
 
Posts: 991
Joined: Mon Aug 31, 2015 10:31 pm

Re: Is there a way to know if an actor can be replicated?

Postby Wormbo » Sun Oct 09, 2016 10:49 am

PrinceOfFunky wrote:If an actor has RemoteRole > than ROLE_None, couldn't it just mean it replicates just its variables and probably not itself?

You clearly didn't read the article. All replication starts with the actor being replicated. WTF are the values replicated to if there's no actor to receive them!?
User avatar
Wormbo
Adept
 
Posts: 258
Joined: Sat Aug 24, 2013 6:04 pm

Re: Is there a way to know if an actor can be replicated?

Postby PrinceOfFunky » Sun Oct 09, 2016 6:07 pm

Wormbo wrote:You clearly didn't read the article




:|

Why should UT replicate the entire actor if it could replicate just the needed variables? I remember of reading about variables compression, which is used to save bandwith. An engine wouldn't rly need everything of the actor, it could easily save values and replicate them to the client actors, even if the server had no actors. But if you say even the server has the full actor and updates only the replicated variables then ok, but at first it sounds like a waste of space in the server.
Image
User avatar
PrinceOfFunky
Inhuman
 
Posts: 991
Joined: Mon Aug 31, 2015 10:31 pm

Re: Is there a way to know if an actor can be replicated?

Postby Wormbo » Sun Oct 09, 2016 6:48 pm

Replicating an actor means either "hey client, spawn an actor of this class at this location, then let's talk about it on channel number N" or, if the actor is either bStatic or bNoDelete, "hey client, you know this particular actor from the map you currently run? Let's talk about it on channel number N". The client then either spawns the actor of the specified class or just takes the actor as put into the level by the mapper and there you go, a replicated actor.
User avatar
Wormbo
Adept
 
Posts: 258
Joined: Sat Aug 24, 2013 6:04 pm

Re: Is there a way to know if an actor can be replicated?

Postby sektor2111 » Sun Oct 09, 2016 8:12 pm

@Funky...
Man, trust me, I'm not an expert from any kind but trying to work much simple as possible returns peacefully and friendly some understanding around how does engine work. In my theory actor has a lot of values and variables because... Actors are many types with many purposes, one is pawn, another is decoration, another is weapon, another is on purpose for replicate data, they are different having a common root - to be honest, there are accesible some default properties which Editor can alter with insane stupid results, I wouldn't create access at them because it opens ways in screwing Level but it was Epic decision to a nice mooing show. Leaving these, I'm using logs, I read info, I made temporary mutator tools for logging and debugging. Once I found a PathNode in Level (VIA Editor) but Out of Level in Game (VIA Tester - sounds insane but it was True) so I have concluded that Level is badly messed up (DevPath did not work anyway). By creating temporary mutators for logging purpose you figure a lot of problems. Right a few minutes ago I read that vectorial math topic, I'm not sure if all that noise is not useless, my Bots were able to quit hunting items in full load and start hunting player. I'll be I can "convice" a flier Camera to track player but... each of you if wants the hard way I don't have nothing against this coding spree...
Do not forget Actor's PreBeginPlay - there might occur a faster destruction if properties and codes are not done correctly, else if a karmic thing from Level ruins party at beginning then... wait 200 ms for finishing some random "storm", sometimes waiting is more wise than a PostBeginPlay with chances to conflict with another such occurrence.
One of decisions in getting rid of things in several moments without to screw their start is to put them a LifeSpan - it's a sort of sheduled Destroy(). There are ways to try with one single problem: TIME for trying every method, to not mention those with Special constants which needs a different Attack.
User avatar
sektor2111
Godlike
 
Posts: 3774
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Is there a way to know if an actor can be replicated?

Postby PrinceOfFunky » Sun Oct 09, 2016 8:19 pm

Wormbo wrote:Replicating an actor means either "hey client, spawn an actor of this class at this location, then let's talk about it on channel number N" or, if the actor is either bStatic or bNoDelete, "hey client, you know this particular actor from the map you currently run? Let's talk about it on channel number N". The client then either spawns the actor of the specified class or just takes the actor as put into the level by the mapper and there you go, a replicated actor.

I guess even if replicating the entire actor in the server would be a waste of space, it needs to do it since there are variables of an actor that are used to perform some replicated functions, and others that depend on other variables.

Anyway, about the problem, I found out that the the AMP disappears when the player dies only if it was in its Inventory, so I guessed it was cause a None assignment to the AMP, but I run this code:
Code: Select all
i1 = Spawn(class'AM_Pickup');
   i2 = Spawn(class'AM_Pickup');
   i3 = Spawn(class'AM_Pickup');
   
   i1.Inventory = i2;
   i3.Inventory = i2;
   i1.Inventory = None;
   Log(-1@i1.Inventory@i2@i3.Inventory);
   i2 = None;
   Log(-2@i1.Inventory@i2@i3.Inventory);

Logs say this:
Code: Select all
ScriptLog: -1 None DM-Prova.AM_Pickup1 DM-Prova.AM_Pickup1
ScriptLog: -2 None None DM-Prova.AM_Pickup1


So I guess nothing can be silently deleted by setting it to None. Like in the case above, "i2" value is set to None but the actor itself still exists.
I see when a pawn dies its Inventory is set to None and if the pawn gets destroyed, every item from its inventory gets destroyed. But Destroyed() is not called in the AMP and even if the Inventory would be set to None, I have the proof that even if you set an Actor variable to None, the Actor doesn't get deleted from the map.
I'm thinking that weapons get deleted in someway when the pawn dies, only code I read set weapons to None, so this means those weapons still exist in the map? I don't believe so.

EDIT: Into the simulated event Destroyed() from within Pawn.uc there's this line of code:
Code: Select all
for( Inv=Inventory; Inv!=None; Inv=Inv.Inventory )   
      Inv.Destroy();

If AMP's Destroyed() callback is not called, it means it gets deleted before of the line of code above, or just, that line is not called when the Pawn dies.

EDIT 2: FOUND IT OUT!
Destroyed() wasn't called cause I put the function into a state...
Actually, I didn't know there could have been some callbacks that are not called at all if in a state.
Image
User avatar
PrinceOfFunky
Inhuman
 
Posts: 991
Joined: Mon Aug 31, 2015 10:31 pm


Return to Coding, Scripting

Who is online

Users browsing this forum: No registered users and 1 guest