New Events and private lobbies

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
LordDawn
Posts: 42
Joined: 15 Apr 2019, 08:36

New Events and private lobbies

Postby LordDawn » 15 Apr 2019, 12:13

What is the preferred method for adding new Events that I can listen for with addEventListener?

I'd like to have a new set of events for character management post login and before entering the game, so the user can request a list of all available characters for the account, as well as the usual creation and deletion of characters.

This might also be a good time to ask if I'm on the right lines thinking of this character management area as a private lobby room that the user lands in before selecting a character and moving on to an mmo-room?

Many thanks.
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: New Events and private lobbies

Postby Lapo » 16 Apr 2019, 09:33

Hi,
you can create custom events via Extensions.
What happens in practice is that you exchange custom commands with the server side code and then handle them on the client side.

So, you will be listening to a single event called --> SFSEvent.EXTENSION_RESPONSE.
This will provide you with a specific "command" which identifies the custom action/event that you should handle.

If you're not familiar with any of this, fear not :) We have lots of documentation in both Java and Javascript which are the two languages you can use on the server side to implement your custom logic.

Take a look here for Java:
http://docs2x.smartfoxserver.com/Extens ... uick-start

Here for Javascript:
http://docs2x.smartfoxserver.com/Extens ... uick-start

And also we have videos on our YT channel:
https://www.youtube.com/smartfoxserver
https://www.youtube.com/watch?v=nKGxhwJ0Ccc

This might also be a good time to ask if I'm on the right lines thinking of this character management area as a private lobby room that the user lands in before selecting a character and moving on to an mmo-room?

You don't necessarily need to join a Room in order to interact with the server.
Rooms are useful if you need players to interact together. If a player only needs to exchange commands with the server in order to customize or manage data in his/her profile, you can skip joining any specific Room and just send those commands to the server. Once the player is done with the avatar customization he will join the MMORoom to play with other people.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
LordDawn
Posts: 42
Joined: 15 Apr 2019, 08:36

Re: New Events and private lobbies

Postby LordDawn » 16 Apr 2019, 13:18

Thanks Lapo, that's all excellent.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 77 guests