Re: [pygame] Using PyOpenGL for 2D graphics
On Monday 16 July 2007 02:05:43 pm Matthew Marshall wrote: I'll also throw in a mention of my own project, Rabbyt (http://matthewmarshall.org/projects/rabbyt/) Like Simon's GFX, it's done in Pyrex for speed. (The two libraries can actually be used simultaneously without problems.) Here's a port of Simon's dumb example (quick, untested): import pygame import rabbyt rabbyt.init_display() ball = rabbyt.Sprite(ball.png) # Make the ball bounce up and down :-) ball.y = rabbyt.lerp(0, 100, dt=1000, extend=reverse) running = True while running: if QUIT in (i.type for i in pygame.event.get()): running = False rabbyt.clear() rabbyt.set_time(pygame.time.get_ticks()) ball.render() pygame.display.flip() On Monday 16 July 2007 02:53:43 Simon Wittber wrote: I've been told pyglet (http://pyglet.org/) is approaching a stable release. AFAIK, Pyglet works without pygame. If you're after brain dead simple 2D OpenGL functions only, try gfx.gl in the GFX package. (http://cheeseshop.python.org/pypi/GFX). Dumb GFX example: 1 import pygame 2 from pygame.locals import * 3 from gfx import gl 4 5 pygame.init() 6 flags = OPENGL|DOUBLEBUF|HWSURFACE 7 pygame.display.set_mode((800,600), flags) 8 gl.init((800,600)) 9 image = pygame.image.load('ball.png') 10 texture_id = gl.load_texture(pygame.image.tostring(image, 'RGBA'), image.get_size()) 11 running = True 12 w,h = image.get_size() 13 while running: 14 if QUIT in (i.type for i in pygame.event.get()): 15 running = False 16 gl.draw_quad((0,0),((0,0),(0,h),(w,h),(w,0)), texture_id=texture_id) 17 pygame.display.flip() 18 I've got so many choices... Too bad I suck at making decisions. :P I have actually decided that I'd try to use Opioid2D for my first game... I have decided to make a simple strategy RPG for my first game idea. I'm leaning toward making it a Touhou doujin game. OK, gotta go... See ya later!
Re: [pygame] Using PyOpenGL for 2D graphics
On Sunday 08 July 2007 09:09:23 pm Dave LeCompte (really) wrote: Greg Ewing [EMAIL PROTECTED] wrote: Making lots of calls to glVertex() from Python will be inefficient, even more so than it would in C, due to the slowness of Python function calls. And it's not just the Python function calls (which we know are slow) - the PyOpenGL wrapper actually does error checking for you on every call, so it can raise an assertion if something goes wrong. The overhead of this error checking adds to the function call slowness. Even more reason to use display lists or otherwise group your data. -Dave LeCompte All of this information is very helpful! I'm glad I asked you guys ;) I've downloaded the Python version of NeHe 1-10, and I'll take a look at it soon. One of the reasons I wanted to get into OpenGL, although I probably won't be learning it until A LOT later, is things like particle effects and other types of visual effects (I know a lot of people who used Direct3D in their 2D games to do such things), and plus I had assumed that OpenGL draws more things much quicker if you have Direct Rendering and code it properly. Plus, I'm learning 3D modeling and, although 3D graphics for games don't seem as good as well polished 2D graphics to me, I'd like to at least experiment with the idea as soon as I stop sucking at Blender. Plus, if I ever want to make that Tetris Attack clone (in the far future) with the 3D mode, well, it has to be in 3D :P Also, kinda off-topic, I've found an idea for my first game that is so simple, that even I can't screw it up. ...I think. (Plus, the game is awesomely addictive) http://jayisgames.com/archives/2007/05/speed_cluster_2.php A simple game concept, yes? I think I could do it. I'm positive, in fact. I could practice all sorts of simple concepts, like randomization, 2D graphics, simple logic, and different types of input, like keyboard and mouse. Oh, and I can finally learn how to make a menu. I still have no clue how to do that (or make any other screens, scenes and popup menus in games).
Re: [pygame] Testing if a File Exists
On Sunday 08 July 2007 10:17:06 pm Ian Mallett wrote: So, how exactly do try/except things work? I've seen them in various programs but I dn't know what they really do. I was just about to ask, and this seemed the perfect opportunity... On 7/8/07, Dave LeCompte (really) [EMAIL PROTECTED] wrote: John Eikenberry [EMAIL PROTECTED] wrote: Ian Mallett wrote: Hi, Exactly what it sounds like. Using pygame.image.load([file]) will return an error if the file doesn't exist. How do you test if it exists without actually loading it, and without crashing? Thanks. os.path.exists(path) http://docs.python.org/lib/module-os.path.html Some consider it more pythonic to just try the call and deal with the exception: try: pygame.image.load(imagefile) except pygame.error: # handle the error here -Dave LeCompte Try and except: Try to execute the command. If it works, it works. If an exception is raised, instead execute the command in the except block.
Fwd: Re: [pygame] Starting a game
On Friday 29 June 2007 06:21:56 pm you wrote: On Friday 29 June 2007 06:15:39 pm Casey Duncan wrote: On Jun 29, 2007, at 3:06 PM, Charles Joseph Christie II wrote: [..] You say to look at other people's games for an example of abstraction. Do you have a particular one in mind? Totally depends on the kind of game you are going to implement and whether it is sprite-based or OpenGL. Have you decided which of the options you mentioned you are going to do? -Casey I've got my final decision on what my first game should be. A shoot-em-up game that uses OpenGL to draw 2D sprites. I'm really stubborn on using OpenGL now. I really want to learn it! And I really want to make a shoot-em-up too. I've wanted to make one ever since I played ZUN's games, especially after I moved to Linux and couldn't play his games anymore (the bullet patterns are practically art, and the presentation of every game just gets better). If you search ZUN on google, it should be obvious which one of the ZUNs is the one I'm talking about. ;) Of course, I don't expect anything that awesome for a first attempt. But I won't release a pile of dung, either. If I make a game, and decide that it sucks, I'll either trash it and start over, or put it on the internet with a warning that it sucks or something. :P
[pygame] Starting a game
Alright. I don't know if I'm going to be using that MVC stuff... although I might reprogram the game to use it later, if I decide it'll be better... but I want to start a game now! I'm so bored just sitting here that I may as well start something. So now, I'm going to get started. But the problem is that the last time I tried it, I over-complicated it by using advanced sprite functions that I didn't understand at all. I'm still trying to figure out an eaiser way to draw stuff than making everything a class and making it extend from pygame.sprite.Sprite (painful .) Also, some concepts of object orientation seem to have bit me. How should I have classes interact with each other? I know I was doing it completely wrong last time, and one of my friends called me on it. But I forgot how he said I should do it... Well, I'm going to see if I can drum up something usable...
Re: [pygame] Starting a game
On Friday 29 June 2007 05:55:26 pm Casey Duncan wrote: On Jun 29, 2007, at 2:34 PM, Charles Joseph Christie II wrote: Alright. I don't know if I'm going to be using that MVC stuff... although I might reprogram the game to use it later, if I decide it'll be better... but I want to start a game now! I'm so bored just sitting here that I may as well start something. So now, I'm going to get started. But the problem is that the last time I tried it, I over-complicated it by using advanced sprite functions that I didn't understand at all. I'm still trying to figure out an eaiser way to draw stuff than making everything a class and making it extend from pygame.sprite.Sprite (painful .) My advice, come up with a game concept, then come up with one aspect of it that you can implement easily and do that first. For example, if you were making a tiled rouge-like game, you could come up with some simple art for a player character (like a knight or mage) then make it so you move the character in a grid on the screen. If you are making an asteroids type game, make it so you can turn your ship, then implement thrust, etc. Try to bite off little chunks you can do in a few hours time and don't try and invent the whole thing at once, learn as you go. Some kinds of games (such as the rouge-like one I mentioned) already have lots of pygame implementations, and there are frameworks that can help with things like tiling, level design, etc. Sometimes though it may be as hard to learn to use the framework as it is to learn pygame itself, so beware of biting off more than you can chew. Also, some concepts of object orientation seem to have bit me. How should I have classes interact with each other? I know I was doing it completely wrong last time, and one of my friends called me on it. But I forgot how he said I should do it... Look at other people's code. Games and OO programming go hand-and- hand IMO and it really helps you if you have the right level of abstraction. The sprite class is supposed to help you in this regard, giving you a small organizational unit for the components of your game. OTOH, using Sprite may make it more difficult to implement certain patterns (i.e., MVC). But to risk overusing a cliche: Don't let the perfect be the enemy of the good, figure out how to make something work first then learn how to make it better. Don't try to learn everything at once. Maybe you said this before, but what kind of game are you making? Is there another pygame that has similar ideas and elements you can borrow from? -Casey I'm trying to decide between a Tetris Attack clone (my friends were all interested in this idea), an RPG (some of my other friends recommended I start with this, but if I did I wouldn't allow myself to do something like Final Fantasy, it'd have to be something really weird like Tendrills) or an arcade shoot-em-up game like the one I tried to make for my senior project, which would be a series of boss-battles in which you have to type a set of words to damage the boss. My teacher really wanted to see what it looked like when it was done but my first try ened up... well, crappy to say the very least. (it couldn't shoot bullets T_T) I had other people on the ML say that I should start backwards from what I did last time: try to get an enemy firing bullets before I get the player on the screen. Which I probably will do, just to make sure I do it right this time. You say to look at other people's games for an example of abstraction. Do you have a particular one in mind?
Re: [pygame] Starting a game
On Friday 29 June 2007 06:15:39 pm Casey Duncan wrote: On Jun 29, 2007, at 3:06 PM, Charles Joseph Christie II wrote: [..] You say to look at other people's games for an example of abstraction. Do you have a particular one in mind? Totally depends on the kind of game you are going to implement and whether it is sprite-based or OpenGL. Have you decided which of the options you mentioned you are going to do? -Casey Whatever I make, I definitely want to use OpenGL for rendering. I know it's harder, but no pain no gain amirite? ;D Plus I'm learning how to make (really crappy) 3D models in Blender (awesome program, by the way). I don't intend to make a 3D game any time soon, but I'd still like to know how to use OpenGL.
Re: [pygame] Tendrils
On Monday 25 June 2007 03:27:48 pm DR0ID wrote: [EMAIL PROTECTED] schrieb: Mon, 25 Jun 2007 07:57:51 -0700 James Paige [EMAIL PROTECTED] wrote: Is it just me, or is the directory structure of that .rar file all screwed up? Everything seems to be in the wrong folder, and many folders are duplicated. Definitely not runable out-of-the-box. --- James Paige Hmm... A friend of mine has made the archive and uploaded the file (I don't have the bandwidth). He's just downloaded and unpacked it again and he said it was alright. He's used a rather old version of WinRar (3.30 Beta 2 cough), so maybe your problems are related to that? Hi I could extract them although having many warnings (see below). The game started and I palyed it about 10 min without problems. I could zip if it, but I have no space to upload it. ~DR0ID Extracts perfect over here, but I can't get the script to work because of the WHERE_IS_TENDRILS variable wanting a directory, and when I put one in it says invalid syntax.
Re: [pygame] Re: Tendrils
On Monday 25 June 2007 06:45:50 pm [EMAIL PROTECTED] wrote: There seems to be a file in the Tendrils package labeled crack.nfo, which when opened in Notepad begins: KR4XX0R3D . . . . \ . .\ BY \. . . . .\. . .\/ [{BaSaLiSk}]\. . @ |.\ / of \.. \/ |..\ ABCGi /. / -={ARK-MOO-CRU}=- Presumably this isn't the original program, so I'm hesitant to run the thing without scouring the code first. Well... that's good to know. Tell me if you find anything...
Re: [pygame] Display-less PyGame
On Wednesday 20 June 2007 06:46:28 pm [EMAIL PROTECTED] wrote: Actually, someone did use Pygame to make a DDRPG called Tendrils. http://www.pygame.org/projects/23/46/ Awesome. I had an idea for this but it looked more like Paper Mario than Final Fantasy but great minds think alike, I suppose :P (I have to get this game when I come back from Church and get done playing Star Wars Rogue Squadron 3)
Re: [pygame] Display-less PyGame
On Wednesday 20 June 2007 06:46:28 pm [EMAIL PROTECTED] wrote: Actually, someone did use Pygame to make a DDRPG called Tendrils. http://www.pygame.org/projects/23/46/ Doesn't work, the project's homepage is dead. Darnit, I really wanted to play this :P Have any of you played the old text-mode game engines ZZT and Megazeux? For the most part these were action games. There's also ika (http://en.wikipedia.org/wiki/Ika), a Python spinoff of the RPG engine Verge. It doesn't use Pygame itself though. I've heard of Megazeux ages ago, but that's about as much as I know. I never really got into text RPGs.
Re: [pygame] Display-less PyGame
On Wednesday 20 June 2007 10:46:49 pm Luke Paireepinart wrote: Have any of you played the old text-mode game engines ZZT and Megazeux? For the most part these were action games. There's also ika (http://en.wikipedia.org/wiki/Ika), a Python spinoff of the RPG engine Verge. It doesn't use Pygame itself though. Wo, thanks for introducing me to this. Ika looks super-awesome! Maybe when my two summer school classes stop eating up my time, I'll be able to look into it more ^_^. -Luke Well, hey, would you look at that. Two of my prominent game ideas, an SRPG and a Tetris Attack clone, right there on the examples page. :P ika looks pretty awesome... But now I'm all I want to use pygame but this looks really interesting but I want to learn to make my own game engine in pygame but this one is already great bu *head asplodes Crap. I don't know what I want to use now :P
Re: [pygame] I have a quick question... again...
On Sunday 17 June 2007 08:30:04 pm Greg Ewing wrote: Charles Joseph Christie II wrote: What I mean by 3D: http://www.youtube.com/watch?v=fSqB5pEp90I Hmmm, I guess that's sort of 2D with wrap-around as far as the game logic is concerned. Oh, I knew that, I'm just trying to figure out how much trouble I'll be going through if I start with regular 2D and then change to 3D later. Through this MVC magic that you guys are talking about, it seems to be almost what I expected. I once did a true 3D tetris for the Mac. It was quite an interesting experience, both to implement and to play. Some day I'll dig it out and make a pygame version... -- Greg How do you do 3D tetris? o.O
Re: [pygame] I have a quick question... again...
On Saturday 16 June 2007 09:36:18 pm Greg Ewing wrote: Casey Duncan wrote: I'm curious how many of you actually employ MVC using pygame, since the library encourages mixing the model and view via sprites. I always try to separate the application logic from the user interface in any kind of program I write, including games. I've never tried to use sprites in pygame. If they're designed in such a way as to make model/view separation difficult or impossible, I probably won't be using them, for that reason. -- Greg Well, if I don't use the pygame sprite module, what should I use? Also, I'm reading about MVC from multiple sources right now and, although I get the concept, I'm still not 100% sure how to use it in a game.
[pygame] I have a quick question... again...
So, if I was making a Tetris Attack clone using plain pygame and the SDL blitting functions, but later on decided that I wanted to render the blocks in 3D and add a 3D mode like Pokemon Puzzle League for the Nintendo 64, using pyopengl, how much of the code do you think, aside from the drawing, do you think I'd have to rewrite? Oh, don't worry about giving a 100% accurate answer to this: I won't be doing it for a LONG time.
Re: [pygame] I have a quick question... again...
On Saturday 16 June 2007 01:18:49 pm Marius Gedminas wrote: On Sat, Jun 16, 2007 at 09:32:09AM -0700, Casey Duncan wrote: On Jun 16, 2007, at 8:56 AM, Laura Creighton wrote: [..] If you use Model-View-Controller like separation of your code, None. All your changes will be in the drawing. I'm curious how many of you actually employ MVC using pygame, since the library encourages mixing the model and view via sprites. I'd be interested to see a canonical example of a pygame that uses MVC. I don't know about canonical, but PySpaceWar uses pure MVC. I think; I never fully understood the controller part of it; my views are often also controllers. http://mg.pov.lt/pyspacewar/http://mg.pov.lt/pyspacewar/ There were two reasons for making the model independent of views: * I wanted beautiful and understandable code * I want to add network play at some undetermined point in the future I'll take a look at that. But when you say making the model independant of views, what exactly do you mean? MVC has strong advantages when you need to present and interact with the same data in multiple ways, but often in simple games data is only presented a single way. Using MVC has advantages for unit testing as well, but how many pygames actually employ unit tests in a meaningful way? For some low-level functions (e.g. vector math) unit tests were rather useful. Also, I couldn't have refactored the AI code that Ignas Mikalajūnas wrote for me without writing a set of unit tests for it. Other than that, my initial resolution to have everything covered by unit tests evaporated pretty rapidly when I got caught in the frenzy of prototyping the fun stuff. What's unit testing? I wouldn't be surprised if I knew what it was, but didn't know what it was called. I also wouldn't be surprised if I never had the slightest idea what it was, either. I'm curious how widespread these practices really are in the pygame community, not to make a point for or against them, but to better understand theory vs. practice. I'm curious about everything.
Re: [pygame] Playing mp3s
On Saturday 16 June 2007 04:51:52 pm Ulf Ekström wrote: Many linux distros cannot legally distribute mp3 decoding software (patent?), so sdl (mixer) is compiled without mp3 support on those platforms. Use ogg if you can, it sounds better anyway. Regards, Ulf Of course, after you install MP3 support you should be able to compile pygame and sdl mixer yourself with mp3 support. Which is made very easy if you use a source-based distro. :p
Re: [pygame] I have a quick question... again...
On Saturday 16 June 2007 04:25:59 pm Marius Gedminas wrote: On Sat, Jun 16, 2007 at 01:27:37PM -0400, Charles Joseph Christie II wrote: I don't know about canonical, but PySpaceWar uses pure MVC. I think; I never fully understood the controller part of it; my views are often also controllers. http://mg.pov.lt/pyspacewar/http://mg.pov.lt/pyspacewar/ Gaah, obviously it should have been just http://mg.pov.lt/pyspacewar/ Copying and pasting URLs from Firefox to GNOME Terminal sometimes has this strange delay that makes me thing I didn't press the middle mouse button, so I do it again. No problem. There were two reasons for making the model independent of views: * I wanted beautiful and understandable code * I want to add network play at some undetermined point in the future I'll take a look at that. But when you say making the model independant of views, what exactly do you mean? Model objects have no references to view objects. You can take the Python modules that implement the game model of PySpaceWar (world.py, game.py, ai.py) and build a different user interface without changing those modules. Or build a network server that doesn't have any drawing code. In theory. I haven't attempted either, so it's possible that some flaw in the design may require modifications to the model classes to support alternative views. That's exactly what I want to do when I build my games. I want this to be one of the first things I learn before going into a game. What's unit testing? I wouldn't be surprised if I knew what it was, but didn't know what it was called. I also wouldn't be surprised if I never had the slightest idea what it was, either. It's the programming equivalent of putting your answers into the original math equation to make sure you haven't made any silly mistakes while solving the problem. So I was right. :P Dive Into Python has two chapters devoted to unit testing (and test-first programming, which is a somewhat separate thing): http://www.diveintopython.org/unit_testing/index.html http://www.diveintopython.org/unit_testing/stage_1.html Marius Gedminas Thanks, I had read parts of that book but skipped others. Now that I think about it, had I read the entire book, I might have come up with something better for my senior project game.
Re: [pygame] I have a quick question... again...
On Saturday 16 June 2007 09:36:11 pm Greg Ewing wrote: Charles Joseph Christie II wrote: So, if I was making a Tetris Attack clone using plain pygame and the SDL blitting functions, but later on decided that I wanted to render the blocks in 3D and add a 3D mode like Pokemon Puzzle League for the Nintendo 64, using pyopengl, how much of the code do you think, aside from the drawing, do you think I'd have to rewrite? It also depends on what exactly you mean by 3D. If it's still essentially a 2D game, just rendered using blocks that have depth, the game logic doesn't change. But if the game itself is to be 3D (with the blocks moving in 3 dimensions instead of 2) you may have to re-think the whole thing. Greg What I mean by 3D: http://www.youtube.com/watch?v=fSqB5pEp90I For some reason, I remember this game looking a whole lot different, but this version isn't the US version so many things might be different after all.
Re: [pygame] Shining Sea source code
On Thursday 31 May 2007 09:21:11 am Samuel Mankins wrote: I tried this source code, and at first it spat out a pygame.error with the traceback: Traceback (most recent call last): File /Users/samuelmankins/Desktop/070530ShiningSeaSource Folder/Shining Sea.py, line 668, in ? game = Game(screen=screen) File /Users/samuelmankins/Desktop/070530ShiningSeaSource Folder/Shining Sea.py, line 182, in __init__ self.GoToZone((0,0)) File /Users/samuelmankins/Desktop/070530ShiningSeaSource Folder/Shining Sea.py, line 379, in GoToZone self.screen.blit(self.bigpen.render(Now Loading,0,(255,255,255)),(500,560)) pygame.error Then when I commented that line out, it started up, but then just sat there with a blue screen for about a minute and then crashed with another error (Unfortunately I didn't save that traceback). You probably need to turn antialiasing on, because your computer doesn't like drawing without antialiasing.
Re: [pygame] Shining Sea source code
On Thursday 31 May 2007 09:27:53 am Samuel Mankins wrote: How do I do that? Charles Joseph Christie II wrote: On Thursday 31 May 2007 09:21:11 am Samuel Mankins wrote: I tried this source code, and at first it spat out a pygame.error with the traceback: Traceback (most recent call last): File /Users/samuelmankins/Desktop/070530ShiningSeaSource Folder/Shining Sea.py, line 668, in ? game = Game(screen=screen) File /Users/samuelmankins/Desktop/070530ShiningSeaSource Folder/Shining Sea.py, line 182, in __init__ self.GoToZone((0,0)) File /Users/samuelmankins/Desktop/070530ShiningSeaSource Folder/Shining Sea.py, line 379, in GoToZone self.screen.blit(self.bigpen.render(Now Loading,0,(255,255,255)),(500,560)) pygame.error Then when I commented that line out, it started up, but then just sat there with a blue screen for about a minute and then crashed with another error (Unfortunately I didn't save that traceback). You probably need to turn antialiasing on, because your computer doesn't like drawing without antialiasing. Change the 0 after Now Loading to a 1, and do this for all of the other renders.
Re: [pygame] my tutorials
On Saturday 26 May 2007 02:47:41 am DR0ID wrote: Hi again payback time 2: In the past months I have started to write some tutorials for some friends. I think other people might be interested too and they do not help, if they are not published. Here they are: http://www.mypage.bluewin.ch/DR0ID/pygame_tutorials.html As you can see I want write more tutorials. I hope in time I will get there. At the moment its more an introduction on how to use blit. Further tutorials will cover more advanced topics as you can see. To stay informed, do not forget to subscribe to the RSS feed. I would appreciate some feedback. Thanks. ~DR0ID Looks great so far, I'm looking forward to the animation and hud sections the most ;)
Re: [pygame] Need help testing Slingshot rc2
On Friday 25 May 2007 04:23:24 am Rikard Bosnjakovic wrote: On 5/24/07, Charles Joseph Christie II [EMAIL PROTECTED] wrote: It segfaulted when trying to find some timidity configs. Sounds very unlikely, and OTOH: strace is not a good tool for finding segmentation violations. But you can try adding the -f option to strace (follow forks) and see what happens. Same thing, it shows a bunch of sound related things and the timidity config file is the last thing on the list before segmentation fault. Because it doesn't dump a core, gdb was no help either _ So how do I go about troubleshooting this?
Re: [pygame] Need feed back on new game!
On Wednesday 23 May 2007 12:54:51 am John Eriksson wrote: Since PyGame.org still seems to be dead I'll post the direct link to Slingshot should anyone liek to try it and drop some comments. http://arainyday.se/projects/python/Slingshot/Slingshot_rc1.tar.gz Best Regards /John tis 2007-05-22 klockan 21:11 +0200 skrev Rikard Bosnjakovic: On 5/22/07, John Eriksson [EMAIL PROTECTED] wrote: Could you try downloading it again? (I can't for some reason start my vmware windows right now.) pygame.org seems to be dead at the moment. In Gentoo Linux, when I run it I get: Fatal Python error: (pygame parachute) Segmentation Fault Aborted I'll run it with a strace later to see if I can find out why.
Re: [pygame] Need help testing Slingshot rc2
On Thursday 24 May 2007 03:04:48 pm John Eriksson wrote: Hi, Hopefully this new version of Slingshot will work on more platforms. I've removed the surfarray dependency which caused problems on several platforms. I've also changed the behaviour of the force fields used on some levels. Instead of exploding the torpedoes will bounce off. This gives level building a new dimension. Please, help me test Slingshot once more and tell me what you think. Since the PyGame-site still has some problems I include a direct link to the new version. http://arainyday.se/projects/python/Slingshot/Slingshot_rc2.tar.gz When the final release is finished there will be a Windows and Mac release as well. Best Regards /John Eriksson still segfaulting for no reason on my computer.
Re: [pygame] Need help testing Slingshot rc2
On Thursday 24 May 2007 03:04:48 pm John Eriksson wrote: Hi, Hopefully this new version of Slingshot will work on more platforms. I've removed the surfarray dependency which caused problems on several platforms. I've also changed the behaviour of the force fields used on some levels. Instead of exploding the torpedoes will bounce off. This gives level building a new dimension. Please, help me test Slingshot once more and tell me what you think. Since the PyGame-site still has some problems I include a direct link to the new version. http://arainyday.se/projects/python/Slingshot/Slingshot_rc2.tar.gz When the final release is finished there will be a Windows and Mac release as well. Best Regards /John Eriksson The strace helped, I think: open(timidity.cfg, O_RDONLY) = -1 ENOENT (No such file or directory) open(P/timidity.cfg, O_RDONLY)= -1 ENOENT (No such file or directory) --- SIGSEGV (Segmentation fault) @ 0 (0) --- It segfaulted when trying to find some timidity configs. Well, at least that's what it looks like is happening... I'm not an expert at reading strace logs, but those are the last 2 lines above the SIGSEGV. I built my system without Timidity support, so maybe that's what's going on?
Re: [pygame] Installing from source
On Sunday 20 May 2007 08:10:36 pm Grant Ito wrote: Hi there. New to pygame here. Running on SuSE Linux 9.0, and I didn't see an RPM for it so thought installing from source would be the only way to go. Downloaded the tarball and followed the instructions: python setup.py help. Got a message No setup file exists, running 'config.py' - fine enough. Result: Hunting dependencies... sh: line 1: smpeg-config: command not found WARNING: smpeg-config failed! SDL : found 1.2.7 FONT: not found IMAGE : not found MIXER : not found SMPEG : not found NUMERIC : found 23.1 Warning, some of the pygame dependencies were not found. Pygame can still compile and install, but games that depend on those missing dependencies will not run. Would you like to continue the configuration? So I said no. Just wondering if someone could tell me where I should look to find FONT, IMAGE, MIXER, and SMPEG - are these python modules or Linux-specific RPM's? Any help would be greatly appreciated. Grant. Install the devel rpms. sdl-ttf-devel sdl-image-devel sdl-mixer-devel smpeg-devel that should do it.
Re: [pygame] OLPC game jam
On Thursday 10 May 2007 09:14:47 am Kris Schnee wrote: Richard Jones wrote: OLPC are having a game jam! It sounds like a helluva lot of fun and I'm totally jealous of anyone who's in the US who could just fly there to attend. The deadline for signing up is the 12th of May, so hop to it! http://wiki.laptop.org/go/GameJam This sounds like fun. But I'm not eager to pay $50-100 for the privilege of making and giving away games for a system I can't buy. Kris You don't have to pay to do this, do you? I thought you could download the image for the computer systems and run it in a chroot or something like that.
Re: [pygame] Infinite sprites
On Wednesday 02 May 2007 06:08:01 pm Will McGugan wrote: Hi folks, Ive just posted a demo of how to render an infinite number of sprites in PyGame. http://www.willmcgugan.com/2007/05/02/infinite-sprites-with-pygame/ Regards, Will McGugan Wow, that's pretty neat!
Re: [pygame] Infinite sprites
On Wednesday 02 May 2007 07:42:27 pm Ethan Glasser-Camp wrote: Will McGugan wrote: Ive just posted a demo of how to render an infinite number of sprites in PyGame. This is a very clever trick, and it makes a neat demo. One thing that I would do to make it look a little prettier is to prerender the first k frames with the ball having a decreasing alpha, so that the ball looks like it's fading in. While I wouldn't say you've managed to render an infinite number of sprites, this technique might come in handy for some of the bullet hell games people were talking about around here. Ethan Am I the one that started the whole idea of bullet hell games in this mailing list? heh, well he's definitely right that this little trick would make rendering hundreds of bullets at a time less painful... ...If I could wrap my empty head around it. T_T
Re: [pygame] Infinite sprites
On Wednesday 02 May 2007 07:58:03 pm Ethan Glasser-Camp wrote: Charles Joseph Christie II wrote: Am I the one that started the whole idea of bullet hell games in this mailing list? heh, well he's definitely right that this little trick would make rendering hundreds of bullets at a time less painful... ...If I could wrap my empty head around it. T_T My original email had an explanation of the technique but I thought that might be considered spoilers :). It might help you understand if you went into the code. At the very top, there's a line called FRAME_COUNT. Change it to 1 or 2 and see what happens. It's a cute trick, but it relies on certain properties of the sprite motion -- namely that all sprites are identical, and are all following the same trail, but are just on different places on it. I think generally the use of sprites in a game runs counter to these assumptions -- you introduce a sprite class because the sprites aren't identical, and they move differently. But like I said, maybe bullet hell games. Ethan Oh... that's still cool, though. Maybe after I fix my little game thing that currently is out of order, I could implement something like this? It would be cool to have, oh say, 2 or 3 of these running at the same time making a pattern. Would that make sense or would it be asking for trouble?
[pygame] loading images and sounds
So, I have a helpers.py file that I imported into all of my files. It loads sounds, images and music. However, when I load an image, I can't do anything with it because pygame keeps saying that tuple object has no attribute 'blit' and I can't do anything. I noticed at the bottom of this helper file, it says return image, image.get_rect() on it. What should I do with that then? Here is the file that is causing the problem and the helpers.py file. this is due on the 3RD OF MAY OH DANG IT GOT HERE FAST!!! :P (I said I wouldn't be rushing to get it out at the end of the deadline and, hey look, I'm rushing to get it out at the end of the deadline. Go figure. _ ) Help is appreciated! I need all the help I can get! helpers.py Description: application/python bullets.py Description: application/python
Re: [pygame] loading images and sounds
On Tuesday 01 May 2007 09:48:04 am Samuel Mankins wrote: I think I ran into the problem before. What it is is that the load_image function does is return the image, and the image's rectangle. All you've got to do is delete the bit at the end of the function that says return image, image.get_rect and replace it with return image. Charles Joseph Christie II wrote: So, I have a helpers.py file that I imported into all of my files. It loads sounds, images and music. However, when I load an image, I can't do anything with it because pygame keeps saying that tuple object has no attribute 'blit' and I can't do anything. I noticed at the bottom of this helper file, it says return image, image.get_rect() on it. What should I do with that then? Here is the file that is causing the problem and the helpers.py file. this is due on the 3RD OF MAY OH DANG IT GOT HERE FAST!!! :P (I said I wouldn't be rushing to get it out at the end of the deadline and, hey look, I'm rushing to get it out at the end of the deadline. Go figure. _ ) Help is appreciated! I need all the help I can get! Well, it's problem after problem, bug after bug over here. I fixed it so that it loads images (Thanks!). I added my sprites to the pygame.sprite.RenderUpdates() sprite group and (after fixing a couple syntax errors) it worked! ...OK, not really. It almost worked. It returned no errors, yet the bullets don't appear on-screen. I put the code in SVN just a second ago if you want to check it out (svn://commons.game-host.org:3670/TypeNine) and I can provide a zip if you want, too. It's weird though... I think it's because I didn't put attacking in the def update() section but instead put self.attack() in there and made a def attack() in there to fire the bullets. I think that's the reason, anyway...
Re: [pygame] loading images and sounds
On Tuesday 01 May 2007 11:58:17 am DR0ID wrote: Charles Joseph Christie II schrieb: On Tuesday 01 May 2007 09:48:04 am Samuel Mankins wrote: I think I ran into the problem before. What it is is that the load_image function does is return the image, and the image's rectangle. All you've got to do is delete the bit at the end of the function that says return image, image.get_rect and replace it with return image. Charles Joseph Christie II wrote: So, I have a helpers.py file that I imported into all of my files. It loads sounds, images and music. However, when I load an image, I can't do anything with it because pygame keeps saying that tuple object has no attribute 'blit' and I can't do anything. I noticed at the bottom of this helper file, it says return image, image.get_rect() on it. What should I do with that then? Here is the file that is causing the problem and the helpers.py file. this is due on the 3RD OF MAY OH DANG IT GOT HERE FAST!!! :P (I said I wouldn't be rushing to get it out at the end of the deadline and, hey look, I'm rushing to get it out at the end of the deadline. Go figure. _ ) Help is appreciated! I need all the help I can get! Well, it's problem after problem, bug after bug over here. I fixed it so that it loads images (Thanks!). I added my sprites to the pygame.sprite.RenderUpdates() sprite group and (after fixing a couple syntax errors) it worked! ...OK, not really. It almost worked. It returned no errors, yet the bullets don't appear on-screen. I put the code in SVN just a second ago if you want to check it out (svn://commons.game-host.org:3670/TypeNine) and I can provide a zip if you want, too. It's weird though... I think it's because I didn't put attacking in the def update() section but instead put self.attack() in there and made a def attack() in there to fire the bullets. I think that's the reason, anyway... Hi again I looked at it for a moment and found following: 1.)stg.py in Player.update() uncomment slef.image.blit(self.image, ...) # this cuases a segmentation fault on my machine, winxp 2.)you have to add a Bullet.png in the img directory 3.) in stg.py in Boss.update() same line as in Player.update() 4.) in bullets.py in the Bullets class the same error as in the other classe in update()! otherwise it seem to work, although I cant see anything happen on screen except of the typing (cant see any bullet??). well done. ~DR0ID PS: if you want to chat, I'm currently online in the IRC on #pygame :-) I think you have the old code... really really old. I uncommented the player image stuff ages ago and I have a (really ugly) bullet in my img folder. Did you use svn to get the code or what? I sent another email, it should have my most up-to-date junk on it.
Re: [pygame] Mouse Speed
On Tuesday 01 May 2007 03:01:43 pm Rodney Brown wrote: The more I read up on this, it seems what I should do is hide the real mouse cursor and use a sprite instead. Then I could maybe take the value from pygame.mouse.get_rel() and cut the x/y values in half to slow down movement of the sprite cursor? - Original Message From: Rodney Brown [EMAIL PROTECTED] To: pygame-users pygame-users@seul.org Sent: Saturday, April 28, 2007 11:21:36 AM Subject: [pygame] Mouse Speed Hello, I am trying to figure out how to slow down the mouse pointer in pygame. I've looked over both the mouse and cursor documentation and don't see a speed setting. I wrote a very simple app for someone. It's not a game, but uses the mouse and draw functions of pygame. I use Linux and the user I've written the app for is on Windows. I recommended they slow down the pointer in the Windows crontrol panel. This works for Windows but the mouse runs at full speed in my app, then goes back down to the slower speed he's set in Windows once he exits the app. So is there any way to slow down the mouse in pygame? A couple people on the irc channel suggested slowing down my game engine, but I don't have much of an engine and that wouldn'ts affect the mouse pointer anyways. Any suggestions? Ahhh...imagining that irresistible new car smell? Check out new cars at Yahoo! Autos. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com Wouldn't that cause sporadic jumping of the mouse?
Re: [pygame] loading images and sounds
On Tuesday 01 May 2007 03:26:04 pm DR0ID wrote: Charles Joseph Christie II schrieb: On Tuesday 01 May 2007 02:52:30 pm DR0ID wrote: Charles Joseph Christie II schrieb: On Tuesday 01 May 2007 02:40:24 pm DR0ID wrote: Hi again I looked at it for a moment and found following: 1.)stg.py in Player.update() uncomment slef.image.blit(self.image, ...) # this cuases a segmentation fault on my machine, winxp 2.)you have to add a Bullet.png in the img directory 3.) in stg.py in Boss.update() same line as in Player.update() 4.) in bullets.py in the Bullets class the same error as in the other classe in update()! otherwise it seem to work, although I cant see anything happen on screen except of the typing (cant see any bullet??). well done. ~DR0ID PS: if you want to chat, I'm currently online in the IRC on #pygame :-) I think you have the old code... really really old. I uncommented the player image stuff ages ago and I have a (really ugly) bullet in my img folder. Did you use svn to get the code or what? I sent another email, it should have my most up-to-date junk on it. I had the same problems that DR0ID had, and I got the code from subversion I think you forgot to svn add img/Bullet.png Yeah, I did. :P (I just fixed it, try it again) Hi again still segmenation faults on winxp. Sorry, this time I have no time to check where in the code they occure. (well blitting an image on itself at (0,0) does not make any sense, right?) ~DR0ID Well, it worked on all the other images... :P I don't know what to blit it to, then. Could this be the problem? Hi why do you want to blit and image to itself? Anyway you fill it just a line befor, so it has already only one color. It is that evil line, where you blit it to itself, that causes the segmentation fault (at least on my machine running winxp). As I told you, I commented these lines out and it worked. ~DR0ID So then just get rid of all the self.image.blit lines or just remove what's in the brackets? Hi delete or comment the lines out. How do you run you script? I run it in the command shell because then I see what the traceback is :-) ~DR0ID I did, and I didn't get the problems you got... I'll get rid of them though.
Re: [pygame] PATCH: movie_set_display hangs on movie from file-like object
On Tuesday 01 May 2007 07:17:08 pm René Dudfield wrote: Committed revision 994. Working hard or hardly working? ;) Well, it looks like you got a lot done today. 5 fixes in an hour. Nice.
Re: [pygame] pygame and Ubuntu
On Monday 30 April 2007 12:09:10 pm James Paige wrote: On Sun, Apr 29, 2007 at 05:38:33PM -0400, Jason Coggins wrote: I am trying to run them from the desktop by double clicking on them then selecting either run or run in terminal from the box that pops up. I tried right clicking on the program to select open with python but that was not an option. When I right clicked and selected open with another application python was not listed on the application list. I know I have python 2.5 installed because it states so on the synamtic package manager. Jason I have had a lot of problems with this too. The problem is that most pygame games assume that that the current working directory has been set to the directory where the .py file is located. But when you double-click and pick run or right-click and pick open with python, the current working directory does NOT get set, and the game cannot find its data files. What I do for my own games is something similar to this: import os import sys os.chdir(os.path.dirname(sys.argv[0])) That makes sure that the data files will always be found where you expect them. --- James Paige That's good information. I'll have to remember to make my game do that too!
Re: [pygame] pygame and Ubuntu
On Sunday 29 April 2007 05:38:33 pm Jason Coggins wrote: I am trying to run them from the desktop by double clicking on them then selecting either run or run in terminal from the box that pops up. I tried right clicking on the program to select open with python but that was not an option. When I right clicked and selected open with another application python was not listed on the application list. I know I have python 2.5 installed because it states so on the synamtic package manager. Jason - Original Message - From: [EMAIL PROTECTED] To: pygame-users@seul.org Sent: Sunday, April 29, 2007 4:45 PM Subject: Re: [pygame] pygame and Ubuntu How are you trying to run them ? I have not had alot of success with the open with python right click thing.. (but that's me, yours might work fine) I usually just open a terminal, navigate to the directory containing the program and type .. python myprogram.py --- On Sun 04/29, Jason Coggins [EMAIL PROTECTED] wrote: From: Jason Coggins [mailto: [EMAIL PROTECTED] To: pygame-users@seul.org Date: Sun, 29 Apr 2007 16:14:37 -0400 Subject: Re: [pygame] pygame and Ubuntu Alright, I found the package and installed it but for some reason none of the python programs I wrote will run on Ubuntu. They run perfectly fine on windows. I already have Python 2.5 installed on Ubuntu. Is there anything else I should get to make python run on Ubuntu?Jason- Original Message - From: [EMAIL PROTECTED]To: pygame-users@seul.orgSent: Sunday, April 29, 2007 3:59 PMSubject: RE: [pygame] pygame and Ubuntu Go to Synaptic and make sure Universe is checked as a repository.. update.. and search again.. (I used by description and name) for pygame. --- On Sun 04/29, Jason Coggins [EMAIL PROTECTED] wrote: From: Jason Coggins [mailto: [EMAIL PROTECTED] To: pygame-users@seul.org Date: Sun, 29 Apr 2007 15:19:44 -0400 Subject: [pygame] pygame and Ubuntu I am trying to install pygame on the Ubuntu Linux operating system but I cannot find it in any software repository. Could someone tell me where to find a copy in a software repository for Ubuntu?Jason ___ Join Excite! - http://www.excite.com The most personalized portal on the Web! ___ Join Excite! - http://www.excite.com The most personalized portal on the Web! This is Linux. You have a terminal. Use it! It's not hard... there should be an option in the right click menu or one of the file or tools menus to open up a terminal in the current location. Then type python and then the name of the program (for instance: python typinggame.py)
Re: [pygame] pygame and Ubuntu
On Sunday 29 April 2007 05:38:33 pm Jason Coggins wrote: I am trying to run them from the desktop by double clicking on them then selecting either run or run in terminal from the box that pops up. I tried right clicking on the program to select open with python but that was not an option. When I right clicked and selected open with another application python was not listed on the application list. I know I have python 2.5 installed because it states so on the synamtic package manager. Jason - Original Message - From: [EMAIL PROTECTED] To: pygame-users@seul.org Sent: Sunday, April 29, 2007 4:45 PM Subject: Re: [pygame] pygame and Ubuntu How are you trying to run them ? I have not had alot of success with the open with python right click thing.. (but that's me, yours might work fine) I usually just open a terminal, navigate to the directory containing the program and type .. python myprogram.py --- On Sun 04/29, Jason Coggins [EMAIL PROTECTED] wrote: From: Jason Coggins [mailto: [EMAIL PROTECTED] To: pygame-users@seul.org Date: Sun, 29 Apr 2007 16:14:37 -0400 Subject: Re: [pygame] pygame and Ubuntu Alright, I found the package and installed it but for some reason none of the python programs I wrote will run on Ubuntu. They run perfectly fine on windows. I already have Python 2.5 installed on Ubuntu. Is there anything else I should get to make python run on Ubuntu?Jason- Original Message - From: [EMAIL PROTECTED]To: pygame-users@seul.orgSent: Sunday, April 29, 2007 3:59 PMSubject: RE: [pygame] pygame and Ubuntu Go to Synaptic and make sure Universe is checked as a repository.. update.. and search again.. (I used by description and name) for pygame. --- On Sun 04/29, Jason Coggins [EMAIL PROTECTED] wrote: From: Jason Coggins [mailto: [EMAIL PROTECTED] To: pygame-users@seul.org Date: Sun, 29 Apr 2007 15:19:44 -0400 Subject: [pygame] pygame and Ubuntu I am trying to install pygame on the Ubuntu Linux operating system but I cannot find it in any software repository. Could someone tell me where to find a copy in a software repository for Ubuntu?Jason ___ Join Excite! - http://www.excite.com The most personalized portal on the Web! ___ Join Excite! - http://www.excite.com The most personalized portal on the Web! One more thing: you might want to install a Python IDE. I recommend Eric3 because it is easy to use. It also has a run current script button you might like to use.
Re: [pygame] pygame and Ubuntu
On Sunday 29 April 2007 09:51:31 pm Jason Coggins wrote: I am currently using Wing IDE on Windows. I will see if Wing IDE works on Linux but if Wing IDE doesn't work on Linux I will check out Eric3. Do you have a link for it? Jason - Original Message - From: Charles Joseph Christie II [EMAIL PROTECTED] To: pygame-users@seul.org Sent: Sunday, April 29, 2007 6:05 PM Subject: Re: [pygame] pygame and Ubuntu On Sunday 29 April 2007 05:38:33 pm Jason Coggins wrote: I am trying to run them from the desktop by double clicking on them then selecting either run or run in terminal from the box that pops up. I tried right clicking on the program to select open with python but that was not an option. When I right clicked and selected open with another application python was not listed on the application list. I know I have python 2.5 installed because it states so on the synamtic package manager. Jason - Original Message - From: [EMAIL PROTECTED] To: pygame-users@seul.org Sent: Sunday, April 29, 2007 4:45 PM Subject: Re: [pygame] pygame and Ubuntu How are you trying to run them ? I have not had alot of success with the open with python right click thing.. (but that's me, yours might work fine) I usually just open a terminal, navigate to the directory containing the program and type .. python myprogram.py --- On Sun 04/29, Jason Coggins [EMAIL PROTECTED] wrote: From: Jason Coggins [mailto: [EMAIL PROTECTED] To: pygame-users@seul.org Date: Sun, 29 Apr 2007 16:14:37 -0400 Subject: Re: [pygame] pygame and Ubuntu Alright, I found the package and installed it but for some reason none of the python programs I wrote will run on Ubuntu. They run perfectly fine on windows. I already have Python 2.5 installed on Ubuntu. Is there anything else I should get to make python run on Ubuntu?Jason- Original Message - From: [EMAIL PROTECTED]To: pygame-users@seul.orgSent: Sunday, April 29, 2007 3:59 PMSubject: RE: [pygame] pygame and Ubuntu Go to Synaptic and make sure Universe is checked as a repository.. update.. and search again.. (I used by description and name) for pygame. --- On Sun 04/29, Jason Coggins [EMAIL PROTECTED] wrote: From: Jason Coggins [mailto: [EMAIL PROTECTED] To: pygame-users@seul.org Date: Sun, 29 Apr 2007 15:19:44 -0400 Subject: [pygame] pygame and Ubuntu I am trying to install pygame on the Ubuntu Linux operating system but I cannot find it in any software repository. Could someone tell me where to find a copy in a software repository for Ubuntu?Jason ___ Join Excite! - http://www.excite.com The most personalized portal on the Web! ___ Join Excite! - http://www.excite.com The most personalized portal on the Web! One more thing: you might want to install a Python IDE. I recommend Eric3 because it is easy to use. It also has a run current script button you might like to use. Pretty much every Linux distro I've used had it in Synaptic or APT or whatever your package manager is. Also, make sure you have all of the repositories for your distro turned on.
Re: [pygame] Drawing Bullets
On Saturday 28 April 2007 01:28:38 am Kris Schnee wrote: Charles Christie wrote: Well, bullets just seem to be a sticking point for me... Stick with it! 1. bullet cleanup (self.kill, etc.) which isn't important to me right now, as the demo won't be running for an extended period, and when it does it'll be running on a monstrous beast of a computer that can probably handle the crappy coding. 2. Drawing bullets (pygame.update.dirtyrects, etc) which is VERY important to me right now. I don't think you need a kill function. What I did in my shooter game was to have the bullets stored in two lists, and then every frame: self.player_bullets = [bullet for bullet in self.player_bullets if bullet.ttl 0] self.enemy_bullets = [bullet for bullet in self.enemy_bullets if bullet.ttl 0] This filtering gets rid of the ones whose time-to-live is expired, due to Python's automatic garbage-collection. So, I tried to load an image for the bullets, and that didn't work either. What happened was that it couldn't load the image... probably because it doesn't exist. Which it does, though. It's in the project directory under the folder img/Bullet.png. When I put img/Bullet.png into the load_image function it says it can't load the image! I tried it with front and back slashes and it didn't work. Yeah, Python doesn't automatically handle path names. Try os.path.join, as in: import os filename = os.path.join(img,Bullet.png) my_image = pygame.image.load(filename).convert_alpha() As I understand it, os.path.join attaches the directory terms (any number of them) according to whatever format is appropriate for the OS. After I get the image loaded, however, I can't add the bulletlist to my list of dirtyrects to update... The dirtyrect doesn't read from lists! How do I get pygame.sprite.RenderUpdates to display my bullets on the screen? I haven't messed with dirty rectangle functions myself, so this one is beyond me. Kris Woohoo! Thanks! I'll try this ASAP. Still need to figure out how to get the dirtyrects thing sorted out though...
Re: [pygame] Drawing Bullets
On Saturday 28 April 2007 11:45:15 am DR0ID wrote: Charles Joseph Christie II schrieb: On Saturday 28 April 2007 01:28:38 am Kris Schnee wrote: Charles Christie wrote: Well, bullets just seem to be a sticking point for me... Stick with it! 1. bullet cleanup (self.kill, etc.) which isn't important to me right now, as the demo won't be running for an extended period, and when it does it'll be running on a monstrous beast of a computer that can probably handle the crappy coding. 2. Drawing bullets (pygame.update.dirtyrects, etc) which is VERY important to me right now. I don't think you need a kill function. What I did in my shooter game was to have the bullets stored in two lists, and then every frame: self.player_bullets = [bullet for bullet in self.player_bullets if bullet.ttl 0] self.enemy_bullets = [bullet for bullet in self.enemy_bullets if bullet.ttl 0] This filtering gets rid of the ones whose time-to-live is expired, due to Python's automatic garbage-collection. So, I tried to load an image for the bullets, and that didn't work either. What happened was that it couldn't load the image... probably because it doesn't exist. Which it does, though. It's in the project directory under the folder img/Bullet.png. When I put img/Bullet.png into the load_image function it says it can't load the image! I tried it with front and back slashes and it didn't work. Yeah, Python doesn't automatically handle path names. Try os.path.join, as in: import os filename = os.path.join(img,Bullet.png) my_image = pygame.image.load(filename).convert_alpha() As I understand it, os.path.join attaches the directory terms (any number of them) according to whatever format is appropriate for the OS. After I get the image loaded, however, I can't add the bulletlist to my list of dirtyrects to update... The dirtyrect doesn't read from lists! How do I get pygame.sprite.RenderUpdates to display my bullets on the screen? I haven't messed with dirty rectangle functions myself, so this one is beyond me. Kris Woohoo! Thanks! I'll try this ASAP. Still need to figure out how to get the dirtyrects thing sorted out though... Hi if you use Renderupdates then you have to do the following: make an instance of the RenderUpdateGroup add as many sprites you want to it then in each frame of you game: renderUGroup.clear() # update your sprites in here dirty_rects = renderUGroup.draw(screen) display.update(dirty_rects) It should be more or less that thing. Try to look at an example like chimp on the pagame website. Sorry, about that short and quick instruction, but I have not much time at the moment. ~DR0ID No problem, any help is appreciated! Does RenderUpdateGroup read from lists, though?
Re: [pygame] Distributing pygame games for non-Windows platforms
On Saturday 28 April 2007 05:17:12 pm Kris Schnee wrote: p p wrote: Hi, PyInstaller. PyInstaller is a program that converts (packages) Python programs into stand-alone executables, under Windows, Linux and Irix. P.Kort How does that work with the GPL, though? I still don't fully understand the thing, but it seems like you're obligated, if you make a Pygame game, to distribute it in such a way that people can try plugging in a new version of Pygame. I don't necessarily want to make all of my code public, so I'm uneasy about the licensing. Kris Why not? Also, what does the GPL have to do with anything? Is pyinstaller GPL?
Re: [pygame] movies
On Wednesday 18 April 2007 09:28:46 pm Jason Coggins wrote: I noticed the documentation states that pygame.move does not work on windows. Does anyone know how to fix this problem? Jason The documentation states: No one has managed to get smpeg working there. It also recommends that you use a library called pymedia. The link given is http://www.pymedia.org.
Re: [pygame] Firing bullets
That's not quite what I meant... I'm bad at describing things. Let's see... um... my drawing code uses the RenderUpdates method. At the top of the main loop, I have: all = pygame.sprite.RenderUpdates() after that, I have all the classes listed as: textsprite = Textsprite([]) the text I want shows up in the brackets. I'll be changing that later anyway. Next, I have all.add(textsprite) which makes the game update the sprites in the listed classes, in this case textsprite. A little later down, I have: all.clear(screen, background) all.update dirty = all.draw(screen) pygame.display.update(dirty) which would redraw all the sprites on the screen that have changed without updating the ones that haven't. My question is, what do I have to put in all.add to get the bullets to actually show up on screen? On Mon, 09 Apr 2007 15:38:25 -0400 Kris Schnee [EMAIL PROTECTED] wrote: Charles Christie wrote: Now my questions are: A. If this is really all I have to do, how do I get the bullets to register with my screen redrawing class? I use that dirty rect update method where you have to specify the class with the sprite class. If you want the bullet objects to have a reference back to the object running the game (if any), you can give them that reference. Say: class Game: ... def MakeBullet(self): self.bullets.append(self, Bullet() ) class Bullet: def __init__(self,game_object): self.game_object = game_object If you do that, the bullets can then call functions of the game object. I do that for the ships in my game so they can say, Hey, I got destroyed, but not for bullets. Also I've got separate lists for player and enemy bullets to simplify collision detection.
Re: [pygame] Firing bullets
That's the most basic way of doing it... but reusing bullets means that the program doesn't have to delete and recreate bullets every operation. If I understand correctly, it only needs to make one set of bullets. I know that it is faster, but I'm not sure how much faster, or how much more efficiently it will work, and if it is easier or harder to code it that way, although the kill and recreate way sounds a bit easier to code. I don't know which I would be using, though... I have until the end of April to turn in my code and art... my code is not finished, my music isn't anywhere near done and I keep forgetting to contact my artist _ On Sun, 8 Apr 2007 10:29:19 -0500 Lamonte(Scheols/Demonic) [EMAIL PROTECTED] wrote: Im a noob all but why not just fire the bullet and destroy it when it hits the object or hits the outside of the window size(max width,max height)? On 4/8/07, andrew baker [EMAIL PROTECTED] wrote: I absolutely have profiled using lists and creating/destroying instances. Using freelists is always faster if you have enough RAM. This amount of RAM is well within reasonable limits. I always develop for low-end machines, so my minspecs are usually tiny. Recycling is not particularly difficult if you use a factory. EX. def fireBullet(mVector): if returnVal = unfiredBullets.pop(): return returnVal else: return Bullet(mVector) # produces a new Bullet object On 4/7/07, Greg Ewing [EMAIL PROTECTED] wrote: Kris Schnee wrote: I'm not sure that the recycling method is really necessary, if you find it hard to program. (It's probably not hard; just laziness on my part that I didn't use it.) I suggest measuring before concluding that keeping a free list is faster. It might not be. -Is it worth using ODE physics for bullets? ... But you'd also have the overhead of constantly being notified about bullet-on-bullet collisions, Not necessarily. ODE geoms can have a bitmask that determines what categories of objects collide with others. So you could easily arrange for bullets to collide e.g. with players and walls but not with each other. -- Greg -- Andrew Ulysses Baker failrate
Re: [pygame] Firing bullets
You guys kinda lost me here. Do you guys have examples of both styles? and what's mVector and unfiredBullets? On Sun, 8 Apr 2007 01:12:30 -0700 andrew baker [EMAIL PROTECTED] wrote: I absolutely have profiled using lists and creating/destroying instances. Using freelists is always faster if you have enough RAM. This amount of RAM is well within reasonable limits. I always develop for low-end machines, so my minspecs are usually tiny. Recycling is not particularly difficult if you use a factory. EX. def fireBullet(mVector): if returnVal = unfiredBullets.pop(): return returnVal else: return Bullet(mVector) # produces a new Bullet object On 4/7/07, Greg Ewing [EMAIL PROTECTED] wrote: Kris Schnee wrote: I'm not sure that the recycling method is really necessary, if you find it hard to program. (It's probably not hard; just laziness on my part that I didn't use it.) I suggest measuring before concluding that keeping a free list is faster. It might not be. -Is it worth using ODE physics for bullets? ... But you'd also have the overhead of constantly being notified about bullet-on-bullet collisions, Not necessarily. ODE geoms can have a bitmask that determines what categories of objects collide with others. So you could easily arrange for bullets to collide e.g. with players and walls but not with each other. -- Greg
Re: [pygame] Nutshell Simple Game Framework
Open it up and I'll be glad to do everything I can to help. Most likely music, not art though. I'll try my hand at graphics code although I'm still learning... and I am a Math expert so I can help with RPG-ish stuff. On Sun, 08 Apr 2007 08:29:35 -0400 Kris Schnee [EMAIL PROTECTED] wrote: I'm trying to build a game framework that's simple and easy to use, and that incorporates the ideas of a huge game space and basic physics that I've been working on. I don't care about complex physics simulations like hinges, and am willing to callously treat objects as hard boxes standing upright, on or above a plane. I just want characters that can run and jump around in a game world and interact with stuff. As a result you can so far make a game world with an object in it that can move around, with the following code: import Nutshell w = Nutshell.BasicWorldsim() w.MakeEntity(nature=Object,name=Pretzel,velocity=[1.0,0.0,0.0]) w.SimulationStep() The collision detection isn't quite done yet, but motion is, it's optimized for efficiency, and I'm going to build on the basic worldsim class to get zones that can be loaded/saved. I'm willing to open-source this if anyone's interested, especially if people are willing to help with graphics/graphics code. My question is, does it seem reasonable to build a goodly chunk of the game character code into the simulation, ie. having RPG stats mixed in with the class that handles the physics of living creatures? Considering the module as a pure physics simulation, that seems odd, but since a physics simulation doesn't really need a Creature class at all, maybe it's justified. Kris
Re: [pygame] Calling all game developers - OLPC
After I finish my game, I'll be VERY glad to work on a game for the OLPC project. I can use it as community service learning because my school requires it for my graduation. ;) On Sun, 08 Apr 2007 13:04:47 -0400 Noah Kantrowitz [EMAIL PROTECTED] wrote: Horst JENS wrote: On Fri, 2007-04-06 at 20:02 -0400, Noah Kantrowitz wrote: Calling all game developers! The One Laptop Per Child project needs talented game developers to work on software for the XO laptops. Thanks to a few awesome developers, PyGame is now up and running under Sugar (the OLPC graphical environment) and should be included in the build system shortly. What we need now is games geared towards children in developing areas. Information about PyGame on the XO can be found at http://mailman.laptop.org/pipermail/games/2007-April/36.html. I would ask anyone interested in either building new games or porting existing ones to join the OLPC games list (http://mailman.laptop.org/mailman/listinfo/games) and discuss your ideas there. This is a chance to have a major impact on the lives of millions of children, as well as work on a unique platform. If you have any questions please don't hesitate to email me, or ask on the games list. --Noah Kantrowitz OLPC Evangelist Hi Noah, making pygames for the OLPC project is a great idea. Could you post to some direct links of how and where to join the project (pygame - olpc)? I figure i need to download / set up an emulator to test if my game is working on the OLPC-Computer ? -Horst There are several developer images with Sugar preinstalled here: http://wiki.laptop.org/go/Developer_Images. If you are using Linux you can also install the sugar system directly (see http://wiki.laptop.org/go/Category:Installing_Sugar). As for joining, there isn't really much formalized yet, other than the mailing list I mentioned. Hope this helps. --Noah
Re: [pygame] Sprite to variable
Wow thanks, this might come in handy for me too. ;) On Wed, 04 Apr 2007 11:53:08 -0400 Samuel Mankins [EMAIL PROTECTED] wrote: Jason Massey wrote: Okay, have you checked out the pygame tutorials? I find piman's tutorial very good: http://www.sacredchao.net/~piman/writing/sprite-tutorial.shtml http://www.sacredchao.net/%7Epiman/writing/sprite-tutorial.shtml On 4/4/07, *Samuel Mankins* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Jason Massey wrote: What about a dictionary of sprites? A lot safer and more flexible option than defining variable names on the fly. On 4/4/07, *Samuel Mankins* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hello, Does anyone know how I can create a sprite and then set it to a variable name? If not, thanks anyway. -Skizzaltix How would I do that? (I'm sorry, my pygame and python experience is pretty small) I checked out some of them, but not this one. It looks good, thanks!
[pygame] Strange syntax error
I have come to the decision that this idea would make a great sequel, But for now I don't want to throw away the work I've already done. So, without further ado... I got hit with a syntax error, but I don't see it anywhere. Does anybody see it? It's on line 17. I don't see it though... On Thu, 1 Mar 2007 21:14:10 -0500 Charles Christie [EMAIL PROTECTED] wrote: I know the basics of both Python and C, I took robotics and the robot's programming was done in C. I've learned how to use C but I've never actually done it, though. I've read code, went bug hunting and used code in a robot but I've never actually done something on my own in it yet.I know a little python from what I've been doing with my game so far. I'm just trying to think which direction I should take it. I had better make up my mind soon... I'd like to experiment with SWIG and C... but I don't know if I have enough time for that. I'm afraid that if I do it wrong I'll waste too much time and have nothing good to present for my project... Hmm. It's a difficult decision. ##Character class. This is where the main playable STG character actions will be defined. import pygame from pygame.locals import * from helpers import * class Charsprite(pygame.sprite.Sprite): def __init__(self, pix, x, y): pygame.sprite.Sprite.__init__(self) self.update() self.x = x self.y = y self.sprite = load_image(pix) def update(self): self.image = self.sprite self.image.blit = (self.image, (0, 0) self.rect = self.image.get_rect() self.rect.center = (self.x, self.y) ##class Playersprite(Charsprite): ##def __init__(self): ##def update(self): ## ## ##class Bosssprite(Charsprite): ##def __init__(self): ##def update(self): ## ## ##class Lifebar(Charsprite): ##def __init__(self): ##def update(self): ## ##helpers.py - has all the stuff for importing images and sounds and other helpers I might want import pygame, os, sys from pygame.locals import * def load_image(name, colorkey=None): fullname = os.path.join('data', name) try: image = pygame.image.load(fullname) except pygame.error, message: print 'Unable to load ', name, '!' raise SystemExit, message image = image.convert() if colorkey is not None: if colorkey is -1: colorkey = image.get_at((0,0)) image.set_colorkey(colorkey, RLEACCEL) return image, image.get_rect() def load_sound(name): class NoneSound: def play(self): pass if not pygame.mixer: return NoneSound() fullname = os.path.join('data', name) try: sound = pygame.mixer.Sound(fullname) except pygame.error, message: print 'Unable to load ', wav, '!' raise SystemExit, message return sound
Re: [pygame] Game idea revised
On Wed, 28 Feb 2007 14:27:45 -0800 Bob Ippolito [EMAIL PROTECTED] wrote: On 2/28/07, Charles Joseph Christie II [EMAIL PROTECTED] wrote: On Wed, 28 Feb 2007 10:55:30 -0800 Bob Ippolito [EMAIL PROTECTED] wrote: On 2/28/07, Kordova [EMAIL PROTECTED] wrote: On Feb 28, 2007, at 8:27 AM, Charles Christie wrote: This idea seems more and more feasible, and better for pygame, every time I think about it, and my previous idea of making a danmaku shoot-em-up game out of this typing thing gets less savory due to the speed and accuracy limitations of python (which isn't exactly a bad thing, it's easy to program in for a newbie like me). I do not know what danmaku is (actually thanks to google I think I now do), but I have had success at work and at home with intensive 3d applications written primarily in Python. If you feel you are able to develop this and are interested in doing so, you should try it. In my experience most complaints against Python tend to be based on poor design and/or implementation of algorithms rather than the language running dog slow. (And you can make the plunge into C extensions or whatever if it really becomes an issue.) Python having accuracy limitations seems very suspect as well. Where the heck did that assertion come from? -bob A tutorial on the pygame website says that you shouldn't try to get pixel perfect hitrect detection. Wouldn't that mess with the game's accuracy? That's a general rule of game programming; doing bounding rects or circles is a LOT faster than comparing swaths of pixels. It's possible to do it with pixels in pygame if you really want to, and I'm pretty sure I've seen extensions that do exactly that. You still need to design for bounding rect or distance based collision detection in *any* environment even if doing pixel based collision in order to decide which things are worth comparing. Bounding rect? you mean like something that surrounds an object and tells if the two bounding rects touched? That's what I thought he meant by pixel perfect detection. Oops. ^_^;; And the speed limitations thing comes from the fact that, well, I suck at coding. :P I read one tutorial that if you're making a fast paced game you shouldn't even bother with Python. Of course, I considered this BS, but I know that Python isn't as fast as C. That doesn't mean it's _slow_, though. If you can do fast paced games in Flash (and you can), then you can do it in pygame. I've seen an ikaruga clone in Flash, which sounds like the kind of game you're thinking of. That said, you need to know what you're doing in nearly any environment to get good performance when you're managing hundreds or thousands of things many times a second. Good point. Although it wouldn't be thousands of things. at the most a hundred or two. Didn't know you could use C extensions in Python. Is that like saying, if I have a library I like to use in C (in this case, Kenta Cho's awesome bulletml library) I can use it in python? How much hacking would that take? pygame is a C extension. I don't know anything about bulletml, but you might be able to use it relatively easily with something like ctypes or swig. Otherwise you'd have to write code in C or Pyrex against the Python API that gets what you want out of it. someone was writing a python wrapper for it and then disappeared off of the face of the planet _ I kinda don't have time for that, though. Other reasons I wanted to change the idea of my game is because... 1. Time limitations. It'd probably be easier to come up with a grid instead of 20 bullet patterns and program them all, but if I could use bulletml this wouldn't be nearly as much of a problem. 2. I never thought of doing it this way and someone else said it would be a good idea, and I agree with him now. 3. No need to change the game code for every keyboard layout. My typing danmaku game idea assumed everyone has a QWERTY keyboard. 4. I've never seen anyone else do this, while I've seen multiple shoot-em-up typing tutors (but none of them were danmaku and none of them were based on the Touhou games). 5. Well... uh... my typing danmaku game would make a good sequel. ;P I didn't mean to make it sound as if it's impossible to make a danmaku typing game in Python, but rather a newbie like myself would end up making code that is slow and inaccurate due to lack of information and (moreover) time. None of these really seem terribly relevant to Python or pygame. You'd have the same problems with just about anything... Yeah, I know, which is why I am going for something a little simpler. Since it sounds like you're just starting out I would recommend doing simpler games that you can actually finish instead of trying to make your first or second project a masterpiece... but again, that's not Python
Re: [pygame] Game idea revised
On Thu, 01 Mar 2007 15:48:29 +1300 Greg Ewing [EMAIL PROTECTED] wrote: No, pixel perfect usually means taking the actual shape of the object into account, i.e. comparing their bitmaps. This is obviously a lot more expensive than just comparing the bounding rects. Rest assured that Python has no trouble doing integer arithmetic accurately, and will tell you for certain whether the bounding rects intersect or not. :-) (If you were using floats for your rect coordinates, you might have some accuracy limitations, but that's a general feature of float arithmetic, and nothing to do with Python.) On Wed, 28 Feb 2007 18:27:42 -0800 Bob Ippolito [EMAIL PROTECTED] wrote: Pixel perfect detection typically means that you're actually comparing a bitmap mask of two sprites, to see if the actual pixels overlap. Comparing rectangles or circles is a lot cheaper than individual pixels. You can check the pixels *after* you've found a collision in the rectangles (which means they're at least very close to touching visually), but usually you don't have to bother. -bob Thanks for clearing that up guys. I'll remember that.
Re: [pygame] Making a moving character in Pygame
On Fri, 16 Feb 2007 17:58:54 -0800 (PST) Dave LeCompte (really) [EMAIL PROTECTED] wrote: So... I've seen it done in like a billion ways, but I don't know which way is the best. Ok, what does best mean for you? Easiest to code for you? Easiest to maintain over the long run? Fastest execution speed? Closely resembling the feel of a specific game you wish to emulate? Once you decide what's important to you, you can evaluate possible solutions and pick one that most closely matches your requirements. I would like a balance between fast execution and easy maintenance if possible. If I could only pick one it would probably be maintenance. One of the ones that interested me was the one in the pyraider gamelet up on the pygame website. Sounds like a perfectly good starting point. -Dave What's the best pizza? LeCompte OK. Let's go with that then. The thing that puzzles me is what the advantage (or disadvantage) of those miniature def statements for deciding which way the player is moving.
Re: [pygame] pygame is a disgrace
Excuse me for hijacking this thread and asking, but how hard is it to compile programs in Windows? 'Cause in Linux you just type: ./ configure make make install and you're set to go after you settle dependency problems, which I found overwhelmingly easy the last time I tried it in PCLinuxOS. And since you compile everything in Gentoo Linux anyway, it was as easy as typing: emerge pygame and dependencies and everything were grabbed for me. so what do Windows users go through to compile stuff? I don't think it would be worth complaining this much about it...
Re: [pygame] Newbie needs help, what's the most efficient (or easiest) way to do this?
I figured I was doing something wrong... I didn't know I could include attachments. Sorry, this is really the first experience I've had with a mailing list... A few e-mails up, I said I was trying to get the game to display the letters and words you typed correctly in a row. Someone said to put the sprites in their own group, so I thought he meant class. So that's what I did. Yet, the text still doesn't show up on screen... What am I doing wrong? Yeah. So when I get back to my laptop I'll attach the code instead of sending it in the body of my message next time. Sorry about that. On Tue, 30 Jan 2007 16:26:30 -0600 Luke Paireepinart [EMAIL PROTECTED] wrote: Charles Christie wrote: Aww it still doesn't work... am I doin' it right? What doesn't work? it's easier to give you help if you explain the problem you're having and only include code snippets you think are relevant... I have zero desire to read through all your code and try to figure out what the problem is, especially since if you think there is a problem you probably know approximately where it is occurring... :) Also attachments are better than including the whole thing in your e-mail because then you can be sure that it isn't messing up your tabs, and you won't have problems with wrapping -Luke
Re: [pygame] Newbie needs help, what's the most efficient (or easiest) way to do this?
Actually, you would only move if you held the TAB button, else you'd type. On Tue, 30 Jan 2007 14:03:34 +1300 Greg Ewing [EMAIL PROTECTED] wrote: Charles Christie wrote: The game would be about typing english words as fast as possible to damage the boss, while moving around the bullet pattern it fires at you. The thing is that moving would be mapped, on a qwerty keyboard: WASD, IKJL, and the up, 5, left and right buttons on a numpad. There's an interesting idea in there somewhere. Suppose movement was *only* done using alphabetic keys. Then the words you typed would have the side effect of moving you around in various ways. To allow you some freedom of movement, you'd have a set of words to choose from at any moment. The game would then be to choose which word to type next to move you in the direction you want to go... -- Greg
Re: [pygame] Newbie needs help, what's the most efficient (or easiest) way to do this?
Saw that, but I didn't feel like getting ideas from other people's code until I understood it myself. Oh yeah, and I couldn't make sense of anything I read in that the first time I looked it over (I'd probably get most of it now, but when I looked last time I didn't even know how to get the typing portion, and I couldn't distinguish it from the rest of the code :P ). Thanks for the replies, guys. I was afraid of using mailing lists because I thought I would get loads of gtfo and noob replies and, well, I never tried to figure out how they worked. Thanks for not outcasting me. You guys totally remind me of the Gentoo Linux forums (which is a very good thing) so thanks again! On Fri, 5 Jan 2007 01:09:40 +0100 Kai Kuehne [EMAIL PROTECTED] wrote: Hi, On 1/4/07, Charles Joseph Christie II [EMAIL PROTECTED] wrote: Well, actually, after I finish all of the homework that's due tomorrow. After I get this down, I just have to get the combo timer system thing up... But I'll ask about that a little later. Thank you! Maybe you can find some ideas in TypusPocus: http://python.com.ar/juegos/TypusPocus Greetings Kai