pygame is
Python
Simple DirectMedia Layer
 
 
pygame.org is
Site Swing
Spacewar Multi

Spacewar Multi - 3.5.3

Ian Mallett (geometrian)

Tags:

Description

Created over a series of a few days, you play a spaceship in a maze-like arena with many players... This game shows off my networking library, Mastermind. Thank you to pymike for suggestions and especially for hosting the server.

Links

Home Page: http://geometrian.com/programming/index.php
Source: http://www.geometrian.com/Programs/Spacewar%20Multi.zip

Screenshot


click to view original size

Releases

Spacewar Multi - 3.5.6 - Feb 1, 2009
Spacewar Multi - 3.5.3 - Jan 27, 2009

Pygame.org account Comments

If you wish to leave a comment with your pygame.org account, please sign in first.

September 9, 2009 5:02pm - Ian Mallett - nickname: (geometrian)
I suppose I can release the server, as usage of the project is basically zero; I wanted to prevent hacks as much as possible. http://www.geometrian.com/Programs/Spacewar%20Multi%20Server.zip
May 16, 2009 7:26pm - Ian Mallett - nickname: (geometrian)
Contact me at ian@geometrian.com
April 9, 2009 2:43pm - Marek Lisy - nickname: (maral)
Hey, can you add the server part? I couldn't connect to that server(it's probably down) so i want to create my own server.
February 10, 2009 8:44pm - Ian Mallett - nickname: (geometrian)
Someone has been connecting to the server using the previous version. There are very significant changes between the two, so connecting with the previous version crashes the server. Until I add a version checker, this problem will remain. In the meantime, please, download this newer version and delete the older one; DO NOT connect with the older version. Thanks.
February 4, 2009 9:41am - Ian Mallett - nickname: (geometrian)
This is one of the reasons I added a timestamp to the messages. I check on the server sometimes, and it looks like I missed you by about five minutes
February 3, 2009 9:57pm - patrick mullen - nickname: (saluk)
Could not find a way to quit, otherwise ran smooth. Did not see anyone else on, so I can't comment on the most important part - the networking. But good jobs so far!
February 3, 2009 3:17pm - Ian Mallett - nickname: (geometrian)
You can remove this line safely, but you may experience artifacts around the edges of some images. You can eliminate this by not using bilinear filtering (change all GL_LINEAR flags to GL_NEAREST), making the images a touch less anti-aliased. You might want to check your gl version.
February 3, 2009 1:12pm - Rolf Sievers - nickname: (lizard)
When I run it I can choose color and name, then it crashes with the following output:

Traceback (most recent call last):
File "/home/rolf/Download/Spacewar/3.5.6/Spacewar.pyw", line 27, in <module>
SelfPlayer.init()
File "helpers/classes.py", line 188, in init
self.ship = glutil.quadlist(glutil.texture(self.ship),(-15.5,-15,31,30)) #1/4 X
File "helpers/glutil.py", line 36, in texture
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE)
NameError: global name 'GL_CLAMP_TO_EDGE' is not defined
February 2, 2009 12:29am - Ian Mallett - nickname: (geometrian)
besktrap, yes, but I had been planning it for a while.
pywiz32 and to others, If you have a huge error like that, please just email it to me so as not to clutter. I think the problem has to do with OpenGL Texturing. It looks like you have the latest release, so I'm guessing your computer doesn't like non-power-of-two textures. The solution is to change all the textures to something more power-of-two-ey, which would take a while. I think this means your graphics card is old, which means it may not run well anyway. In short, change helpers/objects.py line 114 to scale the image to (512,512) or something. If that works, there's your problem. I'll see about fixing that in the next release (by scaling all the textures to powers of two) and/or readding PyGame drawing.
February 2, 2009 12:16am - Anonymous - nickname: (pywiz32)
On Xubuntu 8.10 on Intel Cerleron D and Intel extreme graphics card.
February 2, 2009 12:14am - Anonymous - nickname: (pywiz32)
when I run it, I get

Traceback (most recent call last):
File "/home/jerome/Downloads/3.5.6/Spacewar.pyw", line 83, in <module>
loadstuff()
File "/home/jerome/Downloads/3.5.6/Spacewar.pyw", line 53, in loadstuff
dlbg = objects.bg(Enclosure)
File "helpers/objects.py", line 114, in bg
bgimg = glutil.texture(pygame.transform.smoothscale(pygame.image.load("data/bg.jpg"),size).subsurface((0,0,Enclosure[0],Enclosure[1])).convert())
File "helpers/glutil.py", line 33, in texture
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,width,height,0,GL_RGBA,GL_UNSIGNED_BYTE,data)
File "/usr/lib/python2.5/site-packages/PyOpenGL-3.0.0b8-py2.5.egg/OpenGL/wrapper.py", line 673, in wrapperCall
raise err
GLError: GLError(
err = 1281,
description = 'invalid value',
baseOperation = glTexImage2D,
pyArgs = (
GL_TEXTURE_2D,
0,
GL_RGBA,
2500,
2100,
0,
GL_RGBA,
GL_UNSIGNED_BYTE,
'\x03\n\x1c\xff\x03\n\x1c\xff\x03\n\x...,
),
cArgs = (
GL_TEXTURE_2D,
0,
GL_RGBA,
2500,
2100,
0,
GL_RGBA,
GL_UNSIGNED_BYTE,
'\x03\n\x1c\xff\x03\n\x1c\xff\x03\n\x...,
),
cArguments = (
GL_TEXTURE_2D,
0,
GL_RGBA,
2500,
2100,
0,
GL_RGBA,
GL_UNSIGNED_BYTE,
c_void_p(2886594588L),
)
)
February 1, 2009 7:02pm - Luke Endres - nickname: (besktrap)
Finally put in that mini map we were talking about, eh? ;)

but ya porting to opengl was a really good idea for fps.
February 1, 2009 6:01pm - Ian Mallett - nickname: (geometrian)
Version 3.5.6 released! (Versions 3.5.4 and 3.5.5 were prerelease work)
January 31, 2009 10:56pm - Ian Mallett - nickname: (geometrian)
The game is currently in dev, so the server will not function at this time.
January 30, 2009 10:59pm - Ian Mallett - nickname: (geometrian)
That's true. This game doesn't depend on glGetInteger() or the like though, so for my purposes, you won't need NumPy/Numeric.
January 30, 2009 8:37pm - RB[0] - nickname: (roebros)
Pretty much anything you get from the OpenGL, erm host, server, whatever it is, the gfx card.
getIntegerv etc. are the main ones I recall ATM...
January 30, 2009 8:31pm - Ian Mallett - nickname: (geometrian)
Which functionality? I just tested it by removing Numeric and NumPy temporarily, and everything OpenGL runs just fine for me...
January 30, 2009 7:18pm - RB[0] - nickname: (roebros)
Ian, the current version of PyOpenGL does require Numpy/Numeric for quite a bit of the functionality, just so you know ;)
January 30, 2009 10:52am - Ian Mallett - nickname: (geometrian)
You're looking at the console background code--I made the alpha there too high in the image, so I half it in the code--definitely a hack. The real purpose of surfarray is to change the color of the ships and a few other graphics when necessary. This causes a noticeable delay, but in OpenGL, both uses are solved by a single, quick glColor call.

I think porting to OpenGL is a good idea, because it removes dependencies on tons of stuff--Numeric/Numpy being one of them. I had thought of keeping both renders going, as you suggest, but there's bureaucracy associated with trying to keep two separate versions going and up-to-date. Even in porting to OpenGL, I've already added many new features. OpenGL should provide lots of benefits--and I'm purposefully keeping is simple (no shaders, extensions, etc.). But if there's REALLY a lot of demand for having both renderers, I'll try to make one version with an option to choose.
January 30, 2009 1:42am - Rene Dudfield - nickname: (illume)
Ian: couldn't you use PixelArray and blit blend modes instead of surfarray?

From looking at your code... I think you can. You're multiplying some alpha in arrays by 0.5 for a 10x10 square. I think that should work ok with PixelArray. Even set_at get_at should be ok, since you're only using it at startup.

opengl will make it less portable and slower for those without gl hardware or good drivers.

Or maybe you could keep both renderers going?
January 29, 2009 3:16pm - Ian Mallett - nickname: (geometrian)
I'm currently porting this to simple OpenGL (no shaders). I'm not done yet, but at present, the framerate is 550 fps instead of a maximum 130 fps with pygame. Using OpenGL has also eliminated the need for surfarray, so that will not be a requirement for the next release.
January 29, 2009 12:23pm - Ian Mallett - nickname: (geometrian)
Thank you.
January 29, 2009 10:16am - RB[0] - nickname: (roebros)
There is a bug in the game where when two people kill each other at the same time (roughly) only one person's kill is counted.
January 28, 2009 8:05pm - Ian Mallett - nickname: (geometrian)
Yes, you will need Numpy or Numeric.

I wanted to make Psyco optional, but this game is pretty graphics and physics heavy. Psyco is almost necessary. It's listed under requirements on my website.

I've fixed a lot of bugs and added some new features. I'm thinking of porting it to PyOpenGL for speed--which might help the Psyco thing.
January 28, 2009 6:34pm - pymike - nickname: (pymike)
@Daniel:
You need numpy. http://numpy.org/
January 28, 2009 4:39pm - Daniel - nickname: (daxni)
I get an error when run:
Why can I python, pygame and psyco

Traceback (most recent call last):
File "C:\Documents and Settings\DaXni\Escritorio\Spacewar Multi\3.5.3\Spacewar.py", line 19, in <module>
SelfPlayer.set_color(SelfPlayer.color)
File "C:\Documents and Settings\DaXni\Escritorio\Spacewar Multi\3.5.3\classes.py", line 167, in set_color
self.colorize(self.ship,newcolor)
File "C:\Documents and Settings\DaXni\Escritorio\Spacewar Multi\3.5.3\classes.py", line 153, in colorize
self.imgdata = pygame.surfarray.pixels3d(img)
File "C:\Python25\lib\site-packages\pygame\__init__.py", line 70, in __getattr__
raise NotImplementedError, MissingPygameModule
NotImplementedError: surfarray module not available

January 28, 2009 3:00pm - Rolf Sievers - nickname: (lizard)
Looks nice, especially the flames ;-)
I were able to leave the window though...
And you should make a try: (..); except: pass clause for the psyco, since not everyone has that
January 28, 2009 12:23pm - Ian Mallett - nickname: (geometrian)
The lag is calculated as an average of 10 frames' lag. This is to make sure a one-frame anomaly doesn't get you kicked ;-)

However, in the beginning, sometimes the computer can be a bit slower than normal because it's still setting stuff up, so this can be disproportionately high. I'll set the lag limit at 1000ms in the next version, OK?
January 28, 2009 10:30am - pymike - nickname: (pymike)
Where are you located? I think the server is located in France. I've never been kicked for lag, though (IIRC) he's using TCP protocol, so I guess that lag's gonna be a problem. :-P
January 28, 2009 1:20am - Rene Dudfield - nickname: (illume)
Seemed like a fun game :)

However I kept getting kicked for excessive lag 500ms + However I averaged around 300+ ms for the most part I think.

It'd be nice if it didn't kick me off for the occasional high lag.
January 27, 2009 3:10pm - pymike - nickname: (pymike)
Yay you released it! Fun fun fun. You should set up a tourny or something.
January 27, 2009 2:10pm - Ian Mallett - nickname: (geometrian)
Version 3.5.3 released! (Versions 1, 2, 3, 3.1, 3.2, 3.3, 3.4, 3.4.1, 3.5, 3.5.1, and 3.5.2 were prerelease work)
spotlight

 
our projects
pygame.org welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
 
recent releases
Jul 23, 2014

Jul 22, 2014

Jul 21, 2014

Jul 20, 2014

Jul 19, 2014

Jul 15, 2014

Jul 10, 2014

Jul 9, 2014

Jun 27, 2014



Jun 24, 2014

... more!
 
for pygame related questions, comments, and suggestions, please see help (lists, irc)