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 a new message in "Default Forum"
Name:
Subject:
topic icon:
no
boardcode:
 Colour:  Size:   Close all tags
Message:
CAPTCHA: How much is 0 added to 3

Topic History of: Forcing Clients into Rooms
Max. showing the last posts - (Last post first)
Author Message
badben 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.
karl 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.

chromecow 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
karl 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.
chromecow 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
karl 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?
SORRY, website is currently mostly broken due to software changes on the server.
Hope to fix it soon ...

In the meantime you may still download palabre or use the forum