Day 5 - I got a basic UI

I'm on an 8 day schedule here, since I'm counting both last Saturday, when I worked at night, and next Saturday, when I'll work during the day. So today is Day 5.

I spent all day yesterday refactoring my graphics engine. Normally I would advise against fixing what isn't broken during Pyweek, but it turned out to be worth it. I found several speed improvements, and went from 11fps to 30fps, and my machine is pretty slow. If I can keep it in the 20s I'll be happy; it should run faster for most people.

I've spent some time today getting the UI working. I still have a long way to go. After that I have a lot of work to do implementing the various gameplay components (organs) and balancing. Oh, and figuring out some sort of goal. Days 6 through 8 are going to be action packed.

Anyway, people seem to like the graphics so here's the latest. Just please keep in mind that good graphics don't necessarily make a good game! :)


(log in to comment)

Comments

be sure to lock your surface before you do your 1000's of pygame.draw calls.  it can help a lot.  keep it up!
That's great advice. That's one of the first things I checked. It turned out not to be the bottleneck in this case.

I'm blitting all the sprites onto an intermediate surface, which then gets blitted onto the main screen. I was instantiating this surface with pygame.Surface((sx,sy), SRCALPHA).convert_alpha(). When I changed convert_alpha to convert I got a huge speedup, and it works because that surface doesn't need per-pixel alphas. Calling just plain convert gives you a surface that's much faster to blit onto.

Also each pygame.draw.circle call I'm doing is accompanied by about 3 calls to random.uniform. Since it's just arithmetic, I assumed the random number generation would be relatively fast compared to the circle draw, but I found I got a speedup by caching the results. One of the rare times when speeding up the graphics has nothing to do with the graphics library calls.
@bitcraft: Lock the surface? Thanks, I'll try that too.

@Cosmologicon, is your game by chance a pipe-dreams sort of game?
I like the graphics. Seriously.