Tuesday, May 11, 2010

Progress

Well, progress is going a little slower than anticipated, mainly due to the fact that I finally got into the Starcraft 2 beta, so my spare time is being split between Anguna and Starcraft.  But that aside, things are going fairly well.

The framerate issue from before is trivial to fix, so that's been addressed.

Performance was more interesting.  If I render the entire background every frame like I planned on doing, things USUALLY worked fine, but would occasionally get sluggish if the device was doing stuff in the background (checking mail, getting push notifications, doing whatever else that crazy thing does).  So I decided as a workaround to prerender each background to an offscreen surface, then just blit that to the main display every frame.  Which worked fine, except that there was some sort of odd behavior in the graphics system where it wouldn't actually destroy/release memory from offscreen surfaces when I was done with them (or at least do so in a timely fashion), so after about 10 room transitions, I'd run out of memory and crash.  Of course, since it was only on the device, it took quite a while to figure out exactly what was happening.  Turns out Apple has a nifty tool called the Iphone Configuration Utility which, believe it or not, actually runs on windows!  It lets you view the device console logs in real time, which was amazingly helpful in tracking down the issue.  Fixing it was then just a matter of reusing the same offscreen surface for every room, drawing over the last one, instead of destroying and recreating them with each room transition.

I'm also running into long load times -- I'm not sure how I managed to see only 5 seconds before, but it's often taking 7-10 seconds to load the resources for the game, and that is with them being marginally broken up.  That's a bit higher than I'd like.  I think that I might be able to reduce the perceived load time by doing part of it while showing a splash screen, doing some more at the game start, etc, but I'd still like to get that a lot lower.

Overall, though, things are running well.  The first dungeon is completely working (although a lot of the UI to make it really play right is missing, such as life bar, subscreen, button for activating secondary item, etc), and the first little chunk of the overworld is mostly functional.  (the graphics for the bridge to the desert area are messed up right now).

I really need to start messing with the UI now.  Which should be a lot easier than it was on the GBA or DS, but still a good amount of work, as it's going to be completely different than the GBA UI, meaning a lot of it will have to be completely rewritten from scratch.  So that's my next task....(well, after I play some more Starcraft 2).....

Monday, May 3, 2010

Running on Hardware

I just got into the developer program, so I can finally run things on hardware!

Unfortunately, I had the same experience as last time I did the switch from purely testing on simulators/emulators to testing on hardware.  Things were working great in the simulator, I loaded it on hardware, and it just crashed and died.  It took it about 5 seconds sitting at the loading screen, then crashed back to the menu (or whatever it's called on the iphone/touch).

A couple hours of debugging turned up the same issue as last time -- I was initializing some things incorrectly, which led to some bad pointers, which somehow, out of pure luck (would that be good luck or bad luck?  I'm not sure) worked just fine in a simulator, but caused seg faults/null pointers on the real thing.

Luckily, it wasn't as hard to track down as it COULD have been, so as of today, it's running on hardware!

A couple thoughts/surprises:
1.  My framerate is too high.  The framework I'm using locked things to 30fps on the simulator, so I assumed it would do the same on the hardware.  Nope.  So I need to manage that myself.

2.  It'll also be nice to really see how the performance works.  In the simulator I was running into performance issues blitting the tiles for large backgrounds.  I found a workaround, but it'll be nice to do some experiments to see what I can get away with and what I can't.

2.  I can actually now observe how much time it spends loading.  My biggest gripe with a lot of the iphone games is the long load times -- for small portable gaming, you should be able to get into the action very quickly.  I'm at about 5 seconds right now.  That doesn't include music or sound effects, but does include loading ALL the graphics up front.  I can probably lower it a bit by breaking up the art assets and loading them as I need them.  We'll see.

If I had a camera handy, I'd take some video or at least a photo of it on hardware, cause pictures are fun.  But I don't, so you'll just have to use your imagination.

Level loading and scrolling engine

Well, after a bit of work here, a bit there, between baby feedings and lack of sleep, I've managed to get the first bits of my level-loa...