Forum ActionScript 3.0 edit roomdata - current players - private messages

Problems and discussions relating to ActionScript 3.0 here.

edit roomdata - current players - private messages

Postby mark.knol » August 14th, 2010, 8:11 pm

For some background info about my project :

Alright, PlayerIO rocks. I have created a very simple setup using the bouncer, where I already have a difference between an host- and normal player. I started using the 'newgame'-template which is very clear and gives me a nice kickstart. Now I have some actionscript related questions about it. Maybe you can help. My goal now is to use the almighty bouncer only :) I think it is very awesome how you can do lots of stuff from the client side. :!:

When creating a room, you can add some default room data. I already found out that every player can acces this data using the client.multiplayer.listRooms function. This returns all rooms and its data. Now I wonder how to modify the roomdata using actionscript? I noticed you can use connection.send to send messages to everyone, but I dont think this is the way to edit the room data object is it?

Another question, when you receive answer from the listRoom function, a room-item contains the variable onlineUsers. Is it possible to detect which users are currently in the room? Do I have to listen to a 'join'-message for new players, and then dispatched the current player userinfo to the new player?

Another question (but I already think I know the answer) The bouncer dispatches messages to everybody, right? Is it possible to send a 'private' message to other users, where the other users don't notice this? Or does this require c#? My idea (now) is to send a message with the variables fromUserId and toUserId. At the side of the receivers, I'll check if client.connectedUserId equals the toUserId. Is this the only way?


BTW I think there is a little syntax bug inside the 'newgame' template. When a new user arrives, the bouncer dispatches a message with the type='Join', but the examplefile uses the type='JoinUser'. This also applies 'LeftUser', which should be 'Left'.
Another thing that I found interesting, is that the Join message contains an userid, which is an uint, but client.connectUserId is a String. Am I wrong when I say client.connectUserId should be an uint too? :idea:


I know; these are a lot of questions, but I want to say It is very cool+fun too experiment with PlayerIO. :D
Posts: 3
Joined: February 19th, 2010, 10:16 am

Re: edit roomdata - current players - private messages

Postby SeriousWorm » August 15th, 2010, 3:56 am

Pretty much all of the things you described require you to code them serverside. They are relatively simple to do, however.
Posts: 9
Joined: August 5th, 2010, 1:02 pm

Re: edit roomdata - current players - private messages

Postby Oliver » August 16th, 2010, 11:41 am

Hey Mark,

There's no way around it, you'll have to write some serverside code. Don't sweat it though, it's fairly easy to get started.

First of all have a look at one of the video tutorials to see how to get the development server up and running. Once you're up and running you'll realise that as3 and C# are not that different language-wise. You'll also realize how nice and comforting it is to have this entity, the server, that "owns and controls" a room independent of who's actually in it at any given time.

I've pasted in the code for the bounce server below, as a starting point for you:
Code: Select all
   public class DefaultGame : Game<BasePlayer>{
      public override void GameStarted() {

      public override void  GameClosed(){

      public override void UserJoined(BasePlayer player) {
         Broadcast("Join", player.Id, player.ConnectUserId);

      public override void UserLeft(BasePlayer user) {
         Broadcast("Left", user.Id);

      public override void GotMessage(BasePlayer user, Message message) {
         Console.WriteLine("defaultgame.gotmessage: " + message.Type);
         if(message.Type == "DisconnectMe") {
         } else {

Best of luck,
User avatar
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Return to ActionScript 3.0