Infinite sprites with PyGame
The one thing that has always bugged me about sprites in PyGame is that they are so damn finite. Why should I be restricted to an upper bounded number of sprites in my game? Fortunately, I figured out a way of breaking the finite sprite limit, and render an infinite number of sprites to the screen - without any reduction in the frame rate!
Now before you try to convince me this is impossible with such arguments that as "an infinite number of sprites requires an infinite amount of memory", bare in mind that I consider the laws of mathematics to be more rules than actual laws. And rules were meant to be broken, as they say. Not convinced? Download and run this demo, and tell me when you run out of memory. Requires Python and PyGame.
Download Infinite Sprites
Wow, very nice, very smoooth up till 950, which somthing in the backround sent it lagy for 0.5 of a sec, very noice
Nice job! Another great demo/lesson. I'm really looking forward to your book.
Only 950? I'm up to over 12,000!
Obligatory screenshot:
http://michael.susens-schurter.com/files/pygame-sprites.png
This is on Debian Sid, Python 2.4.4, PyGame 1.7.1, 2.8GHz CPU and 1 GB RAM. I also removed the FULLSCREEN flag, so I could continue to get work done while it ran. ;)
Holey moley!
Heh. Neat trick!
Holey Moley this!
http://img460.imageshack.us/img460/7060/14594229wd4.png
Actually a cheat... Changed the number of sprites to start around 14590000.
:)
Have gotten several thousand the 'right' way though...
1.7Ghz Centrino Duo
1 gb RAM
GeForce Go 7600
A devious ruse! I would have believed it if you hadn't come clean. :-|
I would have been lying- and doing something that much would have been suicide for my computer...
I'm having some problems using the SubPixelSurface when the hight of the image is different from the width! The result image gets all screwed up. Any ideas?
That was a bug in the first version. Download it again, and it you should find that it is fixed. :-)
Man, that's like soooo 2002 ;)
http://www.pygame.org/pcr/unlimited_sprites/index.php
It comes back in fashion every 5 years!
Shame Pygame doesn't really. You're right about the exe hassles though, sorting out distribution would have helped lift it years ago...
1Xoq01 re re rerrrreeee gththtt