Sparks: A Vectorial Shooter


hal9000

Member
Joined
Jan 6, 2007
Messages
219
Age
45
Location
France
Website
Visit site
Hello everyone,

Sparks is a vectorial shooter that I have written, inspired by Vektar and Geom. Wars.
It includes an arcade mode, as well as several custom modes, which are actually mini-games featuring each of the enemies you can encounter in the game.

The game is not finished, but is perfectly playable and even quite enjoyable. Missing elements include sound and score saving. Difficulty should maybe be tweaked a bit.

The game currently runs on PC (with double analogic keyboard) but has been written with Pandora in mind. Porting it to Panndora shoot be completely straightforward: changing a configuration file, checking that everything run fine, and hopefully that's all. How it will perform on Pandora is still unknown, but the number of enemies being configurable, it should be possible to make it run smoothly.

As I don't have a Pandora, and I am thinking about cancelling my order (for reasons that I don't want to discuss here), I wish someone could port it for me (and for the community, of course). If people are interested, they could also contribute if they wish, especially for the sound.

The game is in GPL. You can download it here (click on "download") :
http://github.com/haltux/Sparks


Screenshots:

Fight against Bulls and Berzerkers:
screenshot1.jpg




Asteroid mini-game:
screenshot2.jpg




Missile launchers, very tricky opponents:
screenshot3.jpg




Bull rectangles: another mini-game:
screenshot4.jpg


Enjoy.
 
It's awesome that you've made this, but I don't have my Pandora yet, so I can't test it for you. And I don't have a joystick, so I can't even try it on my computer. But a word of advice: Don't use "from [module] import * " so much! Or at all. Okay, pygame.locals is a fair exception, but otherwise it makes it difficult to follow the code since there's no indication of what names came from where. If you want help with the code, it helps to make it more readable. Also, you're not supposed to ship pyc files with your code, but that's a minor detail.

But as soon as my Pandora comes in, I'll take a shot at it.
 
I'm interested, but don't have my pandora either... also, it doesn't seem all that straigh-forward for a non-programmer such as my self to grab the source and compile it on a PC... is this cross-platform (Linux, MacOSX, Win7) or single platform? I'd be willing to at least test it on my Linux PCs if I can figure out what I need to do to compile and install. :)
 
Screenshots, we need them :)

Tempel -- nothing wrong with shipping pyc files -- to wit, they're cross platform (endian save, no packing issues, etc), and its perfectly fine for someone to want to hide or closed source their code.. or even just include them, to save the end user from having to generate them. (ie: usualy not a problem in that one, but on pandora it coudl save space on SD to include them in compressed pnd, and for some mega giant apps, it can save a lot of time; I've seen python apps with _thousands_ of modules, that would take many minutes to start up :) So why not?

What dependancies are there on this one? I'm on the run, but if dependancies are nothing, I'll give it a run at least :)

jeff
 
Thanks for you interest!
Screenshots added on top...

- Dependancies:
No dependancies. Just Pygame, I guess it is already installed on the Pandora.

- Potential porting problems:
None, unless there is something I am completely missing. Python/pygame is intrinsequely multi-plateform. Porting should really be just a matter of updating the cfg fil ewith proper resolution and joystick buttons.
Of course, performances could be an issue. It has so far been only testd on my 3 GHz quad-core... without pushing it to its limits, don't worry. The game has been written for performance (considering it's Python), so I don't expect to be able to make it run much quicker than currently. Of course, there could be some Pandora-specific optimization: for example, I have replaced line drawing with pre-computed sprite blitting for performances, but it could be counter-productive on Pandora. Again, that can be changed in the config file. The maximum number of sprites can be set as well, in the worst case that could be changed as well.

- Python coding style
I agree with you about the "from ... import *", I don't use it at all anymore. Let's say they are here for historical reasons... First, some code (but currently not too much) is taken from another open source game (vectorpods, by PyMike, thanks to him) and second, I learned Python while writing this game.

Something I would like ta add: If you like this game and want to contribute, you should know that even though there is no level builder, writing your own level is not too hard if you have some basic Python skills.
 
Hi Hal9000,

I did a quick test just now. The game starts but when selecting a game mode in the menu and really starting a game it says:

pygame.error: Invalid joystick axis
And there is a whole lot of: SDL_JoystickGetAxis value:0:

I don't have time to look into it right now, but I wanted to let you know. Perhaps I can look into it a few days from now.

Thanks.


Jurn
 
Thanks a lot for the feedback.

It is a joystick configuration problem. The game expect the four analog joystick axis id to be 0,1,2 and 3 of joystick number 0, as it is when you connect a double-analogic joystick on a PC. It does not seem to be the case on a Pandora.

Anyone help from anyone who has tried to use nubs with Pygame would be appreciated. Actually, the source code of a game using Pygame which is using nubs would be enough. If you know one, please let me know.

By the way, if you try this game on Pandora, please at least change the resolution to the actual one of Pandora (800x480 ?). The current default resolution is 1920x1200, I don't expect it to run smoothly on Pandora.
 
skeezix said:
Multiple joysticks, not multiple axis on one stick, is all.

jeff

Thanks, could you be more specific?

All digital control = joystick 0
First nub = joystick 1
Second nub = joystick 2

or maybe:

All digital control + first nub = joystick 0
Second nub = joystick 1

or even:

All digital control = joystick 0
First + second nub = joystick 1 ?
 
Last edited by a moderator:
before running your program, you need to put the nubs into joystick mode
Code:
NUB0=`cat /proc/pandora/nub0/mode`
NUB1=`cat /proc/pandora/nub1/mode`
echo absolute > /proc/pandora/nub0/mode
echo absolute > /proc/pandora/nub1/mode
Then you can open up joystick 1 and joystick 2. Joystick 0 has 2 axis, but they don't seem to be connected to anything; it does have all the buttons, however.
So to read the buttons (A,B,X,Y,L,R,Start,Select) you open joystick 0, to read the left analog nub open joystick 1, and to read the right analog nub open joystick 2.
Then you need to restore the old values for the nubs
Code:
echo $NUB0 > /proc/pandora/nub0/mode
echo $NUB1 > /proc/pandora/nub1/mode
 
OK, that sounds good.

Could you please tell me the button numbers for A,B,X,Y,L,R, Start and Select?

With this info I should be able to release a Pandora version myself...
 
I have now uploaded a new version that _should_ work on the Pandora. Hopefully, only button number id should be tuned in the sparks-pandora.cfg file.

http://github.com/haltux/Sparks

Could anyone try it? I think the game really worth it.

Once I will have confirmation that it works, I would like someone to package it and then anounce its realease on the main forum.
 
Hi hal. I continue to not have a Pandora, but I've answered your request for it to be packaged. Someone with a Pandora, please let me know if this PND works. I couldn't find any mention of version number, so I just set it to 0.1.

To do this, I forked your repo and rearranged your file layout so I could create a good ol' fashioned Distutils setup script. I had to make minor modifications to a few files to work with new layout, but they're all noted in my changelog. Now, Sparks can be installed in the traditional way (python setup.py install), or, using my distPND extension, can be built into a PND (which is how I made the one linked above). Or it can be built into an RPM, or into a DEB, or a convenient source package... it's the best way to do things in Python. Oh, and I removed all the pyc files and added a gitignore to keep them out (I'll defer to skeezix - you can ship them out to end users - but they really don't belong in a source code repository).

I'll send you a pull request as soon as I've written this message. It's a pretty major rearrangement, so I won't have hurt feelings if you don't want to accept it as-is. Let me know if you'd prefer it arranged differently, and we can try to make it work.

And someone please let me know if distPND is producing valid files!!
 
Last edited by a moderator:
hal9000 said:
Hello everyone,

Sparks is a vectorial shooter that I have written, inspired by Vektar and Geom. Wars.
It includes an arcade mode, as well as several custom modes, which are actually mini-games featuring each of the enemies you can encounter in the game.
Looks cool, I always liked vector games. Maybe it was all thosgames of Asteroids and Tempest I played when young and my brain was forming :p

If this gets sound it will be nice. Too bad you are bailing on the Pandora, but you have to do what you have to do.
 
Last edited by a moderator:
Gruso said:
Sadly no! The file size seems smallish, and it just shows up as a document / unknown filetype on the Pandora.
Well that's frustrating. I double checked, all the right files are in there (uncompressed, it's only 230KB, and it's almost entirely text files, so I'm not surprised it gets down to 70KB; regardless, extracting the archive shows all files where they belong). Maybe there's something up with squashfs, or maybe I'm just not appending the PXML right.

I've uploaded a version made as an iso instead to the same place. If that doesn't work any better, I may just have to wait for a Pandora of my own.
 
Last edited by a moderator:
Haven't tried your latest file but looked at it with my browser.
Seems like the PXML-File is missing at the end, so it appears to be a normal ISO.
 
EvilDragon said:
Haven't tried your latest file but looked at it with my browser.
Seems like the PXML-File is missing at the end, so it appears to be a normal ISO.
When I open it in a hex editor, the PXML data is clearly there at the end. What browser are you referring to?

The python code that appends it on looks like this:
Code:
pnd = open(self.pndname, 'ab')
pxml = open(pxml_final, 'rb')
try:
    pnd.write(pxml.read())
    if icon != ':
        icon = open(os.path.join(self.build_dir, icon), 'rb')
        pnd.write(icon.read())
        icon.close()
finally:
    pnd.close()
    pxml.close()
All this is effectively equivalent to "cat $PXML $ICON >> $PND", isn't it?

But problems with distPND might be better discussed in its original thread, because we're distracting from Sparks! Has anyone successfully run the (unpackaged) code on a Pandora?
 
Last edited by a moderator:
Thanks a lot Tempel.

I have merged your modifications.

The updated archive is now available to everyone here:

https://github.com/haltux/Sparks/zipball/master

I really can't help you about this packaging problem, I hope it will be figured out easily.

Could anyone with a Pandora try to download this archive and run it? The config file for Pandora should be updated before the final packaging anyway, because even if everything runs as expected, the button number have probably not been set properly. I coudl change it myself if someone could give me good Pandora button numbers for the four buttons of the game: select/back/escape/pause. The axis should be alright after the explanation given by WizardStan.
 
Back
Top