| |||||||||||
PyWeek - A day of cleaning up, final submission timeI spent most of today cleaning up the code, fixing bugs in the AI pathing. Most of my problems today came from that old bugbear, multiple coordinate systems. My game world is predominantly a single coordinate system, the object space. A lettuce is about 2 units high. Movement, collision detection, etc. all work off the same coordinate system. Unfortunately the farmer's pathing uses an A* grid, so I have to chop up the world into discrete pieces. The farmer is about 4 units (2 lettuces) across, so that defines my A* grid cell size (otherwise the farmer could be seen to walk partially through obstacles that should be walked around). I generate the A* grid using the bounding boxes defined for all the objects that the farmer is going to try not to walk into (or over, in the case of lettuce). This was bug area number one. I spent a couple of hours tweaking the code that generated the A* grid "impassable" cells from the bounding boxes, and also the code that analysed the grid based on the current farmer and rabbit positions. There was a bit of refactoring in there too. Next I realised that it'd be much nicer if the static objects in the game were better-aligned to the A* grid, so I spent an hour or so bending my brain over the forwards and backwards transformations required to get a 4-unit grid into the level editor. So after all that I've got a much neater A* grid. During all that I distracted myself by modelling up a new prop. Oh, I also fill the grid now so that the farmer knows which cells of the grid are "inside" the farm (bounded by impassable objects, usually fences). This could be used in the future to have multiple farmers in their own farms. I've got a lot of things I'd like to do to the game but I'm not sure I'm going to have time - my Saturday is pretty fully booked. Hence I've uploaded what I've got so far. No music, no sound effects, not particularly amazing level design, no flashy intro screen or "you win" screen. I'm not even sure whether "hard" is actually hard :) Special bonus, if you're curious, try uncommenting the toon_program code at the top of map.py. You will need a shader-capable graphics card. — richard on 2006/09/08 12:20 of Bouncy the Hungry Rabbit Comments: |
Next Challenge
September 2008 [entries, ratings] Previous March 2008 [entries, ratings] September 2007 [entries, ratings] April 2007 [entries, ratings] > September 2006 [entries, ratings] March 2006 [entries, ratings] (June 2006) August 2005 [entries, ratings] Not logged in Login Register | ||||||||||
By Ron on 2006/09/08 15:45:
Hi Richard!
Great screenshots, but I couldn't run the game. It complains about .png missing, and really, there are no png files in the data directory.
Traceback (most recent call last): File "game.py", line 105, in ? game = Game(viewport) File "game.py", line 40, in __init__ textures.load() File "/home/ron/Desktop/bouncy-r8/textures.py", line 13, in load image1 = pygame.image.load(os.path.join('data', name + '.png')) pygame.error: Couldn't open data/tomato.pngHope it helps!By alecu on 2006/09/08 18:24:
Yup. The PNGs are missing all the way back to -r1.Guess everyone is still coding and not yet playing other games :-)
By richard on 2006/09/09 00:19:
Fixed uploadBy eltriuqS on 2006/09/12 21:04:
what does the "game over" symbol at the end means?By Cthulhu32 on 2006/09/12 21:33:
its the bunny baked into a pie! made me laugh the first time I saw it.By bishop on 2006/09/12 21:55:
Yes, amusing stuff! Poor bunny!