Chat / Message channels

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

Moderators: Lapo, Bax

tanu1215
Posts: 4
Joined: 16 Apr 2018, 04:54

Chat / Message channels

Postby tanu1215 » 16 Apr 2018, 05:01

Hi, I am creating an MMO in Unity, and am a beginner in Smartfox.

I've created a system where players can send public messages in the open world using a chat box, but my mmo requires that players be able to change how they send messages. They can send global messages and messages to their team, and lastly party messages.

How would I go about doing this? I was considering setting a boolean in unity to decide what chat mode they were in and when to send messages, but should and can I handle this on the server?
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Chat / Message channels

Postby Lapo » 16 Apr 2018, 08:22

Hi,
there can be different ways to create this kind of interaction.

Generally speaking MMORooms work by sending events to players within user's AoI (area of interest), so you would not be able to chat with team members if, for instance, they are scattered in the game map and outside your view/AoI.

A good way to work around this could be to use the BuddyList, and populating each player's buddy list with the other team members so that they chat regardless of their location in the map.

There's also a simpler way to do this which is to create a private chat room for each team and join them there as well, in addition to the main game Room.

As regards global messages, I am not sure what you mean. If you mean sending a message to every player I am not sure it's a good idea. It basically depends on how many people can play the same game. If they can be a few hundreds it could still work, but when you get to 500 or more it becomes pretty heavy and impractical.

Heavy because it means every single message generates hundreds of copies of the same message, which uses significant resources, especially when the CCU is in the thousands.

Impractical because it's almost impossible to follow a global chat with hundreds or thousands of people as the messages will fly by too quickly.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
tanu1215
Posts: 4
Joined: 16 Apr 2018, 04:54

Re: Chat / Message channels

Postby tanu1215 » 17 Apr 2018, 01:28

So from what I understand, a user can only have one buddy list? In my game, I plan on still having a friends / buddy list where players can friend anyone from any team. Parties are just small groups that random players from the same team can join.

If I use the buddy list approach, I'm assuming there would be an issue where the party players and friends players would overlap, since I wouldn't be able to create multiple "buddy lists"?

And lastly, is there any disadvantage to using the multiple room approach?
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Chat / Message channels

Postby Lapo » 17 Apr 2018, 09:14

tanu1215 wrote:So from what I understand, a user can only have one buddy list?

Yes, that's correct.
In my game, I plan on still having a friends / buddy list where players can friend anyone from any team. Parties are just small groups that random players from the same team can join.

I see. Well then creating a dedicated chat Room only for the team is the best way to go.
You can use the invitation system to send people in the same private Room. ( http://docs2x.smartfoxserver.com/Advanc ... s/game-api )

And lastly, is there any disadvantage to using the multiple room approach?

No, I would not say there's a disadvantage.
Rooms are essentially tools to organize players, and they are very light (i.e. they don't use many server resources), you can run tens of thousands without issues (we've stress tested up to 2.5 million Rooms on a small laptop machine)

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 42 guests