Game Programming and Development Tools

stackless python – coolj

CoolJ

Member

Posts: 354
From: ny
Registered: 07-11-2004
I'm sure most of you pyheads have alread heard of this, but I came across this while doing some reading for a python class that I am taking at school.

Stackless Python:
http://www.stackless.com/

It looks so powerful! In a nutshell, it adds a couple of classes to python to allow it to provide a extremely simplified way of multitasking within your python program.

It seems to work very similar to how an OS switches between tasks, a combination of:

1. alotting time quantums to each individual process, they call them 'microthreads'(basically just functions); it spends the quantum amount of time in each process before going to the next.

2. priority scheduling, where processes can be given priority levels, so your more time critical can preempt the lower priority.

This is obviously great for multiplayer games. An online game - EVE Online uses it with great success:

"25,000 simultaneous players in a shared space simulation, most of which is created in Python."

http://www.stackless.com/wiki/Applications

I like their simple MUD example:
http://www.stackless.com/wiki/Examples

Anyway, I'm just curious if anyone here is aleady using this?

buddboy

Member

Posts: 2220
From: New Albany, Indiana, U.S.
Registered: 10-08-2004
interesting... very interesting...

------------------
In the stock market, you must buy high and sell low...Wait! That's not right!
--------------
Yes, I can be intelligent at times!!

CPUFreak91

Member

Posts: 2337
From:
Registered: 02-01-2005
Thanks for the link. This is something to look into!

------------------
All Your Base Are Belong To Us!!! chown -r us ./base
"After three days without programming, life becomes meaningless.'' -- Tao of Programming Book 2

D-SIPL

Moderator

Posts: 1345
From: Maesteg, Wales
Registered: 07-21-2001
quote:
Originally posted by coolj:
I'm sure most of you pyheads have alread heard of this, but I came across this while doing some reading for a python class that I am taking at school.

Stackless Python:
http://www.stackless.com/

It looks so powerful! In a nutshell, it adds a couple of classes to python to allow it to provide a extremely simplified way of multitasking within your python program.

It seems to work very similar to how an OS switches between tasks, a combination of:

1. alotting time quantums to each individual process, they call them 'microthreads'(basically just functions); it spends the quantum amount of time in each process before going to the next.

2. priority scheduling, where processes can be given priority levels, so your more time critical can preempt the lower priority.

This is obviously great for multiplayer games. An online game - EVE Online uses it with great success:

"25,000 simultaneous players in a shared space simulation, most of which is created in Python."

http://www.stackless.com/wiki/Applications

I like their simple MUD example:
http://www.stackless.com/wiki/Examples

Anyway, I'm just curious if anyone here is aleady using this?


I did check this out a week or two ago and it does look very interesting.

------------------
"One World. One Web. One Program." -Microsoft promotional advertisement
"Ein Volk, ein Reich, ein Fuhrer!" -Adolf Hitler

CoolJ

Member

Posts: 354
From: ny
Registered: 07-11-2004
I might try to use it for my final project in my python class, just to learn a little more about it.

on the stackless.com website they explain how the enhancement came about, what they did, and why it is a good thing, after reading it I tend to agree.

but here is a good artile from the developer of a 3d game engine that used stackless python and why. (the comments below the article are a good read too!):

http://harkal.sylphis3d.com/2005/08/10/multithreaded-game-scripting-with-stackless-p ython/

[This message has been edited by coolj (edited May 18, 2006).]