Understanding SFSTris example

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

Moderators: Lapo, Bax

Post Reply
haplo
Posts: 78
Joined: 08 Jun 2010, 13:32

Understanding SFSTris example

Post by haplo »

Hey, im trying to understand the logic of the example provided.
It seems i have a basic problem understanding how you guys separate the game logic between each room.

you declare few variables under the main class SFSTrisGame
one of them is a single instance of the gameboard

Code: Select all

private TrisGameBoard gameBoard;

under the init function you instantiate the board which mean we only have 1 instance of that board

Code: Select all

	public void init()
	{

		gameBoard = new TrisGameBoard();
        }


now i guess what im trying to understand is this : When users create different room games, they use the same gameBoard instance in the server? or this variable is initiated for each room?
sHTiF
Posts: 102
Joined: 30 Sep 2010, 20:14

Post by sHTiF »

SFSTrisGame is a room extension so a new instance of the extension class is created each time a room is created therefore a new instance of the board as well.
Pushing the limits of flash platform at http://blog.flash-core.com
haplo
Posts: 78
Joined: 08 Jun 2010, 13:32

thank you

Post by haplo »

Thank you for your answer now i start to understand the logic behind the server.

I have one more problem regarding that. Is it correct to assume that as soon as the user join a room he will use the extension attached to that room. if a user is not joined to any room he will use the extension attached to the zone? Is that correct?

We would like to implement a shop system which is independent from room logic. Is there any way a user can send() to the zone extension while connected to a room ?
sHTiF
Posts: 102
Joined: 30 Sep 2010, 20:14

Post by sHTiF »

User is using the zone extension the whole time he is in the zone, he can be in any number of rooms with various extensions and still use zone extension. Its like global vs local extensions ;)

So yes you can still send to zone extension.
Pushing the limits of flash platform at http://blog.flash-core.com
Post Reply