You don't need frames to view this website. Flash communication server. Flash mx xml socket server.
Home
Main Menu
Home
- - - - - - -
What is Palabre ?
Features
News
FAQ
Forum
DEMO
- - - - - - -
Downloads !
Browse SVN
- - - - - - -
Search
Contact Us
- - - - - - -
Sourceforge Project Page
Python
Links
Palabre on Facebook






Actionscript for Multiplayer games
 
Download Palabre Flash Xml Socket Server DOWNLOAD Download Palabre Flash Xml Socket Server FORUM Download Palabre Flash Xml Socket Server FAQ Download Palabre Flash Xml Socket Server WHAT IS IT
 



Using Palabre ? Coming here for Support ? Please consider making an (even small) donation :)
Palabre Forum  


::post new topic::
Forcing Clients into Rooms - 2008/06/02 06:02 Hi guys,

Currently working on a module which I'll share on it's completion. I've hit a slight snag.

I would like to limit the amount of clients per room at any one time.

For example, if room 1 has 50 users, then create a room 2.

What do you recommend?

I would like this to be seamless, and I'm thinking to get the module to handle the client count and room instead of the flash.

Or, when Flash connects, have it get a room total and create a second room?

It would be nice for Palabre to do the counting and forcing to help with the connectivity speed rather than breaking down XML in flash and evaluating.

The part where I'm stuck is forcing a client into any particular room I set in the module.

Is this possible?
  reply | quote
Re:Forcing Clients into Rooms - 2008/06/02 06:07 Actually, I just realized we can send the client any XML message want.

Ooops.


Code:

 #client.clientSendMessage("<join room='what-room-i-set'/>")

  reply | quote
Re:Forcing Clients into Rooms - 2008/06/02 07:23 I'm about to wrap up for the day, wondering if anyone can help with how to get number of clients in a room python side?
  reply | quote
Re:Forcing Clients into Rooms - 2008/06/03 22:36 Hi Karl,

I think the variable you want to look at is: self.allParams.items()

Accessed from a module, I think it would look something like this:

Code:

 numberInRoom len(client.allParams.items())



or possibly:

Code:

 numberInRoom len(client.server.allParams.items())




You 'd have to play with it a bit, I've been working on game logic for a while now, and I'm getting rusty with rooms...};^)

When you get it working, post and let us know how you did it.

-Sean
  reply | quote
Re:Forcing Clients into Rooms - 2008/06/03 23:49 Hi Sean,

Thanks for getting back to me.

The idea is to setup an overflow method for room connections. ie: When the room reaches a connection limit, create a new room.

My limit for example is 10. When the room has 10 clients, we spawn a new room and fill that until 10, then repeat.

My code so far:

Code:

          # count existing rooms         roomID 0         for p in self.server.allRooms.values():             roomID roomID+1         # if a room exists         if roomID 0:             # count clients             for p in self.server.allRooms.values():                 if len(p.allNickNames) < MaxPerRoom:                     # force client to join room                     client.clientSendMessage('<join room="'+p.name+'" />')         else:             # no rooms are created, make the first room             client.clientSendMessage('<join room="r'+str(roomID)+'" />')



I'm relatively new to Python so please excuse my code structure. It will be refined as I learn.
  reply | quote
Re:Forcing Clients into Rooms - 2008/06/04 03:36 Looks great. There's one way to save a bit of typing:

Code:

 roomID roomID+1



can be replaced with

Code:

 roomID += 1



Handy if you're doing a lot of incrementing.

-Sean
  reply | quote
Re:Forcing Clients into Rooms - 2008/06/05 00:43 Hi!

I get a syntax error if I attempt +=, must be using an older version of python.

Code:

 Python 2.3.5 (#1, Dec  7 2006, 14:50:51)  [GCC 4.0.1 (Apple ComputerIncbuild 5363) (+4864187)] on darwin Type "help""copyright""credits" or "license" for more information.

  reply | quote
Re:Forcing Clients into Rooms - 2008/09/17 22:55 Hey,

Can we use the method registerAction with "roomAddClient" in my own module

like
Code:

          self.server.registerAction('onStartup',self.name)         self.server.registerAction('isAuthorized',self.name)         self.server.registerAction('roomAddClient',self.name)




Else i have to modify the source code of palabre (roomPalabre.py)

I just want to add a new property : room.maxClients
And check this property when a client join a room
In order to force client to stay into a room.
  reply | quote
::post new topic::