sfs 2x i don't understend why a dedicated line

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

DarkGon
Posts: 20
Joined: 25 Apr 2021, 21:54

sfs 2x i don't understend why a dedicated line

Postby DarkGon » 27 Apr 2021, 21:31

I don't understand why a dedicated line of code is needed.
This is taken from your example on the site (fps example), as I understood this line checks whether we are a player and if not, then we do the action of creating an instance of the enemy (user)
But why do this if it is done in other instances of the code, such as NetworkManager

P.S. again google translate

P.S. again google translate

https://imgur.com/a/KGZO12e - url screenshot
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: sfs 2x i don't understend why a dedicated line

Postby Lapo » 28 Apr 2021, 07:19

Hi,
the server sends updates to clients with an ID representing the player, so the client must check whether the ID matches the current player or the opponent and apply the update.

In other words, when I get an update from the server we must check if the ID sent from the server matches the player himself or a remote player. Then we proceed with applying the update to the correct game object.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 53 guests