Page 1 of 1

client limit for displayed avatars on maps

Posted: 28 Jan 2012, 11:03
by radiateur
Hi,

I'm working hard on a game with openspace 2 with flash ans smartfox 2.X, i work with the limited free version, but if the experience is good enough i will certainly buy it.
Everythings are going fine, i'm starting to work on avatar's interaction, and i think i will have to come back later for further questions, but for now i have one main question.

As i see it, a high number of users in a room (map) is ok for the server, we can increase allocated java memory for smartfox as much as we want, and i think that it can be ok up to a high amount of users (smartfox 2X is good).

But the main problem with a high number of users in a room, will come with the number of visible avatars on the client side, for performance (too many users will desperately decrease the display flash performances as i use vector graphics), and for gaming experience too : As an example, if a player need to talk to a NPC, if there is 30 others players talking to this NPC, the gaming exeperience might be strange.

The only good solution i see is to set a maximum number of visible avatars on the client side.

So i wanted to know if there is a way to set other player's avatars for the client (and ghost avatars) visible to false, and if there is not a buit in solution (as i think ;) ), what could be the as3 / openspace way to achieve that.

EDIT : please excuse my poor english, i'm not english native ;)

Posted: 28 Jan 2012, 11:09
by Bax
I don't understand what is the point in hiding the other avatars... you will end up having a single player game...
In my opinion it would be best to have a limit on the max number of users who can join the room, and then implement a system which is capable of spawning new rooms identical to the first one in case more users want to join it.

Posted: 28 Jan 2012, 12:00
by radiateur
I understand and i also thought about alternative rooms, but it also mean a lot of work on a server extension for a simple flash client issue of avatars displayed on screen.

And that would result in an other problem, some players would not see their buddies when changing map and could not retrieve them if they want, whereas they could easily set to visible=true the players they want in a list, the client itself could also do it automatically.
Doing the same thing in a server extension would give again a lot of work on server side for a simple client issue.

And you are right, there is some rooms where one player sight could be needed, cause in my game a player follow a big one-player story next to others multiplayers quests, so there is a quest system with some NPC' quest givers for the one player adventure, and others for multiplayers adventures.
That's why i was speaking about 30 players around a NPC as a strange gaming experience.

So what are the informations i would need to achieve this ?

I think about number of users and users id present in a room just after the map loading.
But what kind of method should i send to set visible=false to a foreign user's avatar ?
What kind of method would i need to get a list of user's present in a room ?

Posted: 30 Jan 2012, 16:53
by radiateur
Well somebody could help for this ?
what kind of method should i send to set visible=false to a foreign user's avatar ?
What kind of method would i need to get a list of user's present in a room ?

Posted: 01 Feb 2012, 08:53
by Bax
You can get a reference to the avatar and ghost of any user by means of the IOpenSpaceAPI.getAvatarById and IOpenSpaceAPI.getGhostAvatarById methods.
You can then set the visibility. Hopefully this should work without breaking the OpenSpace functioning.

As it regards the list of users in a Room, check the Room class API in the SFS documentation.

Posted: 01 Feb 2012, 09:02
by radiateur
Thanks a lot Bax, i will look at these carefully :)

Posted: 01 Feb 2012, 15:08
by radiateur
working like a charm, no i just need to fire the function on room events :

Code: Select all

var room:Room = smartFox.lastJoinedRoom;
         var users:Array = room.userList;
         var ignored:Array = MyGlobal.Ignored;
         
         for (var u:int = 0; u < users.length; u++)
         {
            var userId:int = users[u].id;
            var userName:String = users[u].name;
            
            for (var v:int = 0; v < ignored.length; v++)
            {
               var userIgnored:String = ignored[v];
               if (userName == userIgnored) {
                  var IgnoredGhost:Avatar = openSpace.getGhostAvatarById(userId);
                  var IgnoredAvatar:Avatar = openSpace.getAvatarById(userId);
                  IgnoredAvatar.visible = false;
                  IgnoredGhost.visible = false;
               }
            }
         }


I will use it as an mute system too ;)