Room and Static Variable

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

jianzhi
Posts: 1
Joined: 16 Jan 2020, 06:18

Room and Static Variable

Postby jianzhi » 16 Jan 2020, 06:41

This's my first post in this forum. I'm newbie for smartfoxserver.
English is not my native language, but I try to post my problem for answer. :oops:

Recently, I found an interesting thing about "static variable". I have only one extension as room extension and the client (unity engine) would send "room creation request", in order to create the room for playing game. Originally, I think if I set a static variable such as "game time", this variable is shared in each room. But it's not truth, the static variable in each room is independent.

I try to google the reason, I supposed that server create a thread when creating a room. Is it right? :?
User avatar
Lapo
Site Admin
Posts: 21286
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Room and Static Variable

Postby Lapo » 16 Jan 2020, 08:50

Hi,
no worries, English is not our first language too :)

Originally, I think if I set a static variable such as "game time", this variable is shared in each room.

I am not sure what you mean by "static variable".
Room Variables are custom values that you can add to any Room to set properties that are relevant to your game. They can have different attributes such as: private, persistent, global etc... but there's no such thing as "static". At lest in the context of Room Variables.

Are you referring to something else?
Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 3 guests