[Twisted-Python] "3D Game Using Twisted?", or: "Ach du lieber..."
sean at twistedmatrix.com
Wed Mar 13 23:27:11 EST 2002
well, the piece of Twisted that is immediately relvant for this type of
application is twisted.spread - comprised of "pb", "jelly" and "banana".
these provide a distributed object system with marshalling, serialization,
networked observation and reference counting. All things that are useful for
building on-line games!
This technology is not optimized at the level of Quake or Tribes style
protocols, but it is infinitely more flexible and provide a much higher
level of functionality.
I have some (incomplete) code for a primative "sub-space" clone that I wrote
using Twisted a while ago. It probably doesn't even work with the latest
Twisted build - but maybe it could be a starting point for some pb examples?
I could post it somewhere if anyone is interested.
From: twisted-python-admin at twistedmatrix.com
[mailto:twisted-python-admin at twistedmatrix.com]On Behalf Of Derek
Sent: Wednesday, March 13, 2002 8:15 PM
To: twisted-python at twistedmatrix.com
Subject: [Twisted-Python] "3D Game Using Twisted?", or: "Ach du
Hello. My name is Derek Simkowiak, I've just been introduced to
Twisted by Sean Riley (sean at twistedmatrix dot com). I'm using (and now
contributing to) his PyUI widget set for my 3D game engine. When I told
him I still needed to write the networking code, he pointed me here.
I wanted to introduce myself, ask for some general guidance about
a network protocol, and point out that the documentation titled "The
results in "no such page", which really sucks for somebody just
getting started (like me).
First, a little bit about my game engine, because it's the type of
thing you twisted Twisted people might be interested in:
o OpenGL for rendering
o SDL for event management
o Quake2 BSP map rendering (many more model formats to come soon)
- includes almost all of the Id BSP culling tricks
- includes fully-functional collision detection using the Q2
"bloated planes" algorithm, as figured out by Kekoa Proudfoot
o Complete in-game GUI over the top of the 3D world, including
transulency, using the PyUI widget set. Screenshot at:
Also see the older shots at:
Also, the big piece that you may like: I've recently refactored
the whole damn thing, and with a little help from SWIG my "engine" is now
nothing more than some Python C extensions. My "main event loop" is just
a simple Python script, and because all the [bottlenecking] rendering code
is still C, I get the ~70 FPS I was getting when the entire engine was
pure C. But now I have Python at my disposal, mua ha ha. (Also, note
that all the libraries are cross-platform. I'm developing under Linux,
but eventually this thing should run under MS-Windows, Mac OS X, AmigaOS,
and even PlayStation2.)
The big pieces I have left are the enemy A.I. and the networking
code. This is a client-server engine. The light at the end of the tunnel
is load-balanced Linux cluster (using LVS) serving up a persistent, 3D
world (ala' PlanetSide), and maybe even me making some $$$ from a few
hundred subscribers paying $5/month. Now you see where Twisted fits in --
I'm basically shooting for twisted.reality in real-time 3D.
My concern is regarding bandwidth. My game protocol will be
similar to the Quake2 protocol, meaning huge lists of 'entities' are
updated with position and orientation data as often as possible. Such
generic position updates will be done with UDP, and 'critical' packets
(such as damage, explosions, jumps, messages, etc.) will be done with TCP.
In summary, every single byte of network overhead matters -- nay, every
BIT matters (npi).
So I've browsed through the API docs, but I don't have any context
to know what I'm looking at. I'll be downloading and installing the
source soon, but in the meantime... any advice?
Is there any particular package I should be looking at (other than
twisted.internet)? Does Twisted's networking code cater to somebody who
needs to, for example, do bitshifting and compression to absolutely
minimize the bandwidth requirements? What approach would you take? Note
that, using PyUI for the GUI and [possibly] Twisted for the server, I want
to have things like in-game "IRC/ICQ", in-game "emails", and also in-game
"voice chat" ala CounterStrike 1.3. Other wild ideas include in-game
video conferencing, and dynamically-downloaded bits of Python code that
would act as all-new, not-previously-imagined entities. (Note that by
"in-game" I mean the 3D world is rendered, and the email/IRC/video client
application is rendered on top of the 3D world with some translucency.
The idea is to keep the player immersed.)
Any advice is greatly appreciated. If anybody else is using
Twisted for something similar, I'd love to hear about it.
dereks at realloc dot net
Twisted-Python mailing list
Twisted-Python at twistedmatrix.com
More information about the Twisted-Python