Extensions, how they work?

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

Moderators: Lapo, Bax

maxxsby
Posts: 22
Joined: 09 Jan 2023, 07:23

Extensions, how they work?

Postby maxxsby » 02 Feb 2023, 09:22

Hi, I wanted to ask about extension. Are the room extension and the zone extension two separate files? I was trying to create a RoomVar class similar to World class and wanted to add player into it by getting it from the World class but it returned to null. I checked the world class player list if it is empty or not and it returned true even tho I already added a player into its list before I joined into the room.

Yes, it is similar to the FPSExtension world class. The main difference in mine is that I wanted the World class exclusive to the zone and the RoomVar class exclusive to the room.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Extensions, how they work?

Postby Lapo » 02 Feb 2023, 10:18

Yes Extensions are deployed as separate .jar files.
Think of an Extension as a "controller" that can be attached to a Room or Zone. The controller receives commands from the client and process them, sometimes sending updates back.

In other words it can handle the custom logic of your game, and you can have different Extensions for different Rooms, representing different types of games.
For more details check documentation here:
http://docs2x.smartfoxserver.com/Extens ... uick-start

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 61 guests