So, first off. Here's my server engine. gilmud.py!
Ok, here's a shortened version of my previous novel sized post.
The link above is our python server engine for our MUD. Noting line 73-75, and 359 on
self.tickThread = threading.Thread(None, self.runTicks, None, ())
self.tickThread.start()
...
def runTicks(self):
while self.running:
time.sleep(.1)
for thing in Thing.List.values():
if thing:
if "person" in thing.attrs:
if "spawner" in thing.attrs:
thing.tick()
you'll probably see the horrid method of giving what we need to be roughly 100 players and 2000 mobs/npcs 'life'. The tick() checks for things like whether they'll move or pick up and item or if they are in combat or being targeted, etc. Same goes for the players, minus a few automated things, of course.
Is there any way we could rewrite a portion, or all of this module in say, C++ to get some better performance? Currently our needed .1 second ticks are at about 3 seconds using python in the method we have now.
(Also, we've tried SEVERAL different threading types and stackless. Nothing did the trick).
Thanks in advance for the help! Any advice is welcome!