Jump to content
Sign in to follow this  
Takbal

what does attach/detach and synchronize do for a game logic?

Recommended Posts

I have seen this technique, namely attaching/detaching logic to objects in the official scripts. Also noticed that many logics need to be some objects to be synchronized to it to work properly, like the SecOps module needs the player, but I could not find any description about what do these commands actually do to abstract things like a game logic.

To my understanding, a logic is practically an object without physical entity ordered to it. It is "sideless" in that sense that it has "sideLogic" side, but otherwise it behaves like a normal object does, so it can be PublicVariable'd or can co-exist on clients/server.

I am not sure about their purpose next to serving as a namespace, but what I see as a potential useful feature is to actually serve as a "switchyard" for scripts in MP, if some of their functions can be called even when they are remote, but executing those scripts only on those instance where they are local. I suspect that attach actually does that: it *transfers* ownership of an object to that instance which has the object which you are attaching to. So it probably behaves as a virtual "transferOwner" command, but not sure about that. As it is not transferring those functions which are compiled into the global namespace in the client of the original owner when the logic was initialized, it does not make sense without an actual running instance (or at least an initialization) on the new owner as well...

I have even less idea about synchronizing. With triggers, I can understand that you can create a condition list with them. But for logic? Do they guarantee that, for example, the objects synchronized will be accessible somewhere to the scripts in the logic? Or are they serving as a replacement for PublicVariable, and keep updating the data of the synchronized objects to the client owning the logic?

I could start experimenting on my own, but somebody may already figure out what do attach/detach and synchronize do for logics at the game engine level. Please share it with us.

Share this post


Link to post
Share on other sites

I just found an interesting remark in the arty module:

As of the time of this writing, synchronizedObjects only seems to work on the server.

And also this:

Warning: Group used to refer to battery with scope %1. Use sync to avoid deprecation.

And then in the script synchronization is truly processed on the server side only. I do not see any special to it rather than using the synchronized objects as a (static) array, but according to the second remark, "deprecation" migh occur, whatever the hell it means...

Are the logics server side only? If I remember correctly I was able to create them on clients. They were not showing up as remote.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×