A day of cleaning up, final submission time

My first task today was to finish off the user interface, which was done very quickly and I'm pretty happy with the result. I'm hoping that it's obvious what it's all about.

I 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.

(log in to comment)

Comments

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.png

Hope it helps!
Yup. The PNGs are missing all the way back to -r1.
Guess everyone is still coding and not yet playing other games :-)
Fixed upload
what does the "game over" symbol at the end means?
its the bunny baked into a pie! made me laugh the first time I saw it.
Yes, amusing stuff! Poor bunny!
Am I the only one who doesn't want a White Dress?
Am I the only one who doesn't want a White Dress?