[Update] Serverside MMO room creation.

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

Moderators: Lapo, Bax

User avatar
meanvel
Posts: 129
Joined: 19 Jan 2017, 14:06

[Update] Serverside MMO room creation.

Postby meanvel » 11 Mar 2017, 10:23

Update: Well, this works... But, it's still kinda odd that getParentZone().createRoom() still creates the room, but with many variables missing?

//Works
getApi().createRoom(getParentZone(),Cfg,null);

//Creates room, but half the variables missing...
//getParentZone().createRoom(Cfg);


Only like half the room settings are being set properly. No errors in the log... Marked are the ones not set properly. Odd...
Image

Code: Select all

11 Mar 2017 | 02:31:42,711 | INFO  | SFSWorker:Ext:2 | Extensions |     | {Gooberland}: Create room
11 Mar 2017 | 02:31:42,730 | INFO  | SFSWorker:Ext:2 | entities.managers.SFSRoomManager |     | Room created: { Zone: Gooberland }, [ MMORoom: Test, Id: 8, Group: default, AOI: (14, 14, 0) ], type = MMORoom
11 Mar 2017 | 02:31:42,993 | INFO  | main | jetty.util.log |     | Logging initialized @2160ms
Attachments
roomCreation.png
(18.56 KiB) Not downloaded yet
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: [Update] Serverside MMO room creation.

Postby Bax » 13 Mar 2017, 10:02

You are not supposed to use the "createRoom" method on the Zone object. In fact in the API doc, that method has no description (which indicates you should not use it). Always use the methods on the SFSApi class to interact with SFS in your Extension.
The reason why it doesn't work is that the API class adds more logic to set everything up (for example notify the clients, but not only) before calling the Zone.createRoom method internally.
Paolo Bax
The SmartFoxServer Team
User avatar
meanvel
Posts: 129
Joined: 19 Jan 2017, 14:06

Re: [Update] Serverside MMO room creation.

Postby meanvel » 15 Mar 2017, 11:29

Ah, sorry. My IDE just pulls code suggestions out and I assumed that the available methods it shows me are good.

Image

Bax wrote:You are not supposed to use the "createRoom" method on the Zone object. In fact in the API doc, that method has no description (which indicates you should not use it).
Attachments
methods.png
(12.81 KiB) Not downloaded yet
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: [Update] Serverside MMO room creation.

Postby Bax » 15 Mar 2017, 15:01

Yes, that's unfortunate. There's no way to hide methods you are not supposed to use. The only way we could figure out is not to comment them, but this forces you to check the API doc.
Paolo Bax
The SmartFoxServer Team

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Stevenor and 49 guests