Class in __lib__

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

Moderators: Lapo, Bax

Lucas
Posts: 27
Joined: 29 Jul 2011, 08:04

Class in __lib__

Postby Lucas » 07 Jul 2019, 09:56

Hi!
I create MMORoom in Zone Extension

Code: Select all

            CreateMMORoomSettings cfg = new CreateMMORoomSettings();

            cfg.setName("Planet"+res.getString("id"));
            cfg.setMaxUsers(1000);
            cfg.setDynamic(false);
            cfg.setGame(true);
            cfg.setHidden(false);
            cfg.setAutoRemoveMode(SFSRoomRemoveMode.DEFAULT);
            cfg.setDefaultAOI(new Vec3D(4000,4000,0));
            cfg.setUserMaxLimboSeconds(30);
            cfg.setProximityListUpdateMillis(20);
            cfg.setSendAOIEntryPoint(false);

            cfg.setExtension( new CreateRoomSettings.RoomExtensionSettings("__lib__", "sfs2x.extensions.games.spacewar.SpaceWarRoomExtension"));

But I receive error

Code: Select all

Error while creating Room: Planet1 -> Room Extension creation failure: SpaceWar - Extension boot error. Unexpected: no jars were located! - Room: [ MMORoom: Planet1, Id: 0, Group: default, AOI: (4000, 4000, 0) ]

SpaceWarExtension.jar file in extensions/__lib__
If I replace SpaceWarExtension.jar into extensions/SpaceWar and hand setup Room with extension sfs2x.extensions.games.spacewar.SpaceWarRoomExtension, all work good.
Lucas
Posts: 27
Joined: 29 Jul 2011, 08:04

Re: Class in __lib__

Postby Lucas » 09 Jul 2019, 10:40

I solved this problem. Create of rooms at the request of the player, and not at the time of initialization in the zone. The extensionis right attached to the room.
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Class in __lib__

Postby Lapo » 09 Jul 2019, 14:16

Hmm... that's a strange error though. We'll have to investigate.
As regards creating the Rooms at initialization: you can do it if you inhibit the fireClientEvent parameter. This is because all Extensions are initialized before the server engine is ready, therefore causing an Exception (though a different one) if you attempt to send an update to clients.

To avoid this there are two ways:

1- set the fireClientEvent param to false in the createRoom() invocation
or
2 - listen for the SERVER_READY event and run your Room creation code there (without setting the fireClientEvent to false)

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Lucas
Posts: 27
Joined: 29 Jul 2011, 08:04

Re: Class in __lib__

Postby Lucas » 09 Jul 2019, 14:23

Lapo wrote:Hmm... that's a strange error though. We'll have to investigate.
As regards creating the Rooms at initialization: you can do it if you inhibit the fireClientEvent parameter. This is because all Extensions are initialized before the server engine is ready, therefore causing an Exception (though a different one) if you attempt to send an update to clients.

To avoid this there are two ways:

1- set the fireClientEvent param to false in the createRoom() invocation
or
2 - listen for the SERVER_READY event and run your Room creation code there (without setting the fireClientEvent to false)

Cheers

Thank you, but I was satisfied with my path.
I was also surprised that when initialization starts in the zone extension, not all jar from __lib__ may be loaded.
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Class in __lib__

Postby Lapo » 10 Jul 2019, 08:31

Lucas wrote:Thank you, but I was satisfied with my path.
I was also surprised that when initialization starts in the zone extension, not all jar from __lib__ may be loaded.

Well, technically classes are loaded lazily, meaning that a class is loaded the first time it is encountered bu the JVM.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 66 guests