Page 1 of 1

Chat / Message channels

Posted: 16 Apr 2018, 05:01
by tanu1215
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?

Re: Chat / Message channels

Posted: 16 Apr 2018, 08:22
by Lapo
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

Re: Chat / Message channels

Posted: 17 Apr 2018, 01:28
by tanu1215
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?

Re: Chat / Message channels

Posted: 17 Apr 2018, 09:14
by Lapo
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