[Tutor] running a game server

nathan tech nathan-tech at hotmail.com
Sun Jan 6 09:14:10 EST 2019


Hello all,

Above all I am a game developer and I want to make multi player games.

For my first trick I want to make a game that is building related, with 
a map and such.

For the map I was thinking of using a dict and running along those lines.

My question is, is python really the way to go for game servers?

I remember, long ago, running a script that went along the lines of:

     import shutil

     import time

     while 1:

      f=open("backup.count_file.txt","r");

      num=int(f.read())

      f.close()

      f=open("backup/count_file.txt","w");

      f.write(str(num+1));

      f.close()

      shutil.copy("my_file.txt", "my_file.txt.backup."+str(num))

      time.sleep(900)


After running for a day, this had to be killed because it sucked up more 
memory than anything I'd ever seen before.

This is obviously not ideal.

So I wonder, is it something about my code up there?

Should I be freeing something or other?

The game server would have to, obviously, process messages from clients, 
perhaps keep track of running tasks through a loop of times such as:

     timevar=time.time()

     for x in tasks:

      if(x[0]>timevar):

       #task complete, do code


I don't mind too much if its using a bit of memory, but, if python is 
just going to leak all over the place and I'm better off learning c or c 
sharp or something, then I'd like to know!

Thanks a lot for any help.

Nate



More information about the Tutor mailing list