# UDP server for a multiplayer game using socketserver

I am making a multiplayer platforming game, and currently there are server performance issues once I have about 7+ clients connected. I was told earlier last week that I should investigate socketserver since previously I had been writing my own server using merely socket.

Well, after 6 hours of implementation I've got my server working with the new code.

As it stands now, I've seen no performance increase, but that's not surprising. I'm hoping that someone here could point me in the right direction and show me how to get more performance out of this thing.

The server is currently 600 lines of code, but I believe the bottleneck is the socketserver stuff.

So here is (hopefully) the relevant stuff. And as always... thank you very much :)

import socket
import sys
import time
import pygame
import random
import json
import levels
import socketserver

class MyUDPHandler(socketserver.BaseRequestHandler):
def handle(self):
data = self.request[0].strip()
socket = self.request[1]

pass

class GameServer():
def __init__(self):
self.message_count = 100000
self.message_dump = None
self.text_block = []
self.client_list = []
self.client_hero_dict = {}
self.client_obj_dict = {}
self.queue = []

Client(addr, self.dataHandler(data)) #Makes a client object for future reference
print("List of all connections: " + repr(self.client_list))

for line in servermap.map: #This sends the map to the newly connected client
line = "TILE" + line
for obj in identifier.object_dict:

def textHandler(self, data):
if data:
data = "^^%s^^" % str(self.message_count) + data
self.message_count += 1

data = data.decode()
if data[0:2] == "^^": # if data is a chat message
self.textHandler(data[2:])
if data[0:2] == "*^": # if data is a movement request
if data[0:6] == "**UN**": #if data is a username
return data[6:]

I'm using threads but I'm not sure about the best way to utilize them. Having said that, I've also called socketserver.ThreadingMiIn but I not sure how to utilize it.