Archive for January, 2009
New Mailing List
Wednesday, January 28th, 2009
I set up a new email Mailing List for Streaming Colour. You’ll see the button up there at the top of the page (if you’re viewing this on the website). I’ll be publishing important Streaming Colour news and promotions to that list. It won’t be like this blog. I expect to only send out news for major announcements related to the company or games.
Please sign up if it’s of any interest to you, or spread the word to your friends who are interested in Dapple but who don’t read the blog:
- Streaming Colour Mailing List (www.streamingcolour.com)
I also posted some new details on the game modes in Dapple to the Dapple Page. Once I go Beta, I’m hoping to do a couple more videos showing how the game is actually played. Hopefully those will go up sometime next week.
Now, back to bug fixing!
Owen
A Few Lessons Learned
Tuesday, January 27th, 2009
I fixed my memory stomp bug this morning. In doing so I learned a few important lessons:
- It’s important to walk away from frustrating problems. I don’t know why I keep having to relearn this lesson. Hell, it’s even advice I give to other people. Most of the time I do it, but sometimes I find it hard to walk away from a problem. In this case, getting away from the problem and sleeping on it allowed me to come back to it with fresh eyes this morning and fix it.
- Sometimes the iPhone simulator is a great debugging tool. I do most of my development and debugging directly on my iPod touch. There are slight performance differences with the way OpenGL behaves on the simulator vs the devices, so I figure it’s better to run it on the device when possible. However, the simulator has a few advantages. One advantage is that you can execute your iPhone app with “Enable Guard Malloc” turned on in your XCode “Run” menu. (Note: This does not work when debugging on a device. Only in the simulator.) This is the functionality that found my memory stomp. It’s amazing! It’s puts strict memory guards around blocks of memory every time they’re allocated. Once a block of memory has been freed, if anything else tries to write to that memory, it throws a Bad Access error. This allowed me to catch some of my code doing something really stupid.
- Never delete Object A from inside a callback from Object A, especially when Object A still has work to do. This seems like an obvious thing, but when you get into animation systems and callbacks, sometimes it’s not obvious that you’re doing it. This turned out to be my problem.
To elaborate, yesterday I tried putting some new loading screens into the game. Of course, I didn’t want a loading screen to just appear, so I put a couple of animations into the various game modes that allow the loading screen to fade in and fade out as you exit and enter a new game mode (note: I treat the front-end as a game mode for these purposes). The problem was, I was using the animation callback to trigger the change between game modes. When the fade in completed, I would tell the game to throw away the current mode and load the next mode. The problem was, in throwing away the current mode, I was killing the animation manager. However, upon returning from the callback, the animation manager would try to do some animation cleanup on the animation that just finished, but none of the animation manager existed anymore, so it would start mucking around with member variables that didn’t exist anymore. This would result in all kinds of nasty behaviour.
So, the solution: when the fade animation completes, it sets a flag in the game mode that says “on next update make the transition to the new game mode”. This allows the animation manager to do it’s clean up before it gets killed. It’s kind of messy, but what can ya do.
One more thing: this whole mess got noticed because I still have a breakpoint set inside “malloc_error_break“. If you’re doing iPhone development, you should always have a breakpoint set in there. It will help you catch so many memory issues. It’s helped me catch double-frees in the past, and a memory stomp this time. This time it gave me this error: “malloc: *** error for object 0×16330c: Non-aligned pointer being freed” This doesn’t look like a memory stomp error, but by default malloc allocates everything to 16-byte alignment on the device, so when the system tries to free something that’s not aligned, it usually means something’s stomped it. Good to know!
Feeling good having fixed that problem. I also had a good sleep last night, the first one in a while, so I’m feeling good. Onward and upward!
Owen
Still Looking for Testers
Monday, January 26th, 2009
I’m still looking for Beta Testers, if you’re interested in playing some Dapple before it gets released on the app store. I’m going to keep accepting new testers right up until I prepare to make the beta build; that will probably be sometime Wednesday or Thursday.
I fixed a whole bunch of bugs on the weekend and I was feeling good starting work today. Then one of my current testers sent me an email on a crash he’d experienced. So far I’ve been unable to reproduce the bug. Luckily he was able to send me crash logs, so I can see the sequence of events that led to the crash, I just can’t repro them.
So then I decided, instead of bug fixing, I’d put in a simple loading screen system. It should have been really simple, but for some reason it turned into a real nightmare. Somehow adding in a couple of animations, or triggering my game mode changes from an animation callback, is causing a memory stomp somewhere. The problem is, I haven’t been able to figure out where yet. It’s been incredibly frustrating.
I’m really feeling the stress now. I’m working too much and too many hours. I’m torn between wanting to slow things down a bit and wanting to get the game done. Right now my desire to get the game done is winning. I need to find some way to stop thinking about work when I’m not working. If anyone has any suggestions, I’m listening.
Owen
360|iDev
Friday, January 23rd, 2009
Some exciting news today: I’m going to be speaking at the 360|iDev Conference in San Jose, CA in March:
I’ll be talking about the process of creating Dapple from start to finish and the lessons I learned along the way. 360|iDev is shaping up to be a really interesting conference for iPhone developers. If you can be anywhere near San Jose, March 2-4, I suggest you at least take a look at the website and see if it’s something you might be interested in.
Owen






