Monday, July 20, 2009

Happy Moon Landing Anniversary

Just a quick note to commemorate the landing of Apollo 11 on the moon 40 years ago today. I was but 15 days old when they landed and there is photographic evidence of me watching the landing (live in color from the moon on our black-and-white TV set :).
Twelve men walked on another celestial body. Let's hope that we'll soon be doing it again. Congratulations not only to those twelve men (and the six that flew above them in command modules), but the thousands that designed, built, and maintained the ships that flew them to them and safely back again.

Sunday, July 19, 2009

A Week?

It's been a week since I last posted an entry? Wow, time flies when you're behind the 8-ball. *sigh* It's been a rough week, but productive. Just not finding completion. The light is getting brighter, but I'm still surrounded by darkness. I have a deadline to get something out the door by Tuesday night. I hope that I can get questing done and perhaps get a stab at leveling by then. I believe that questing is close, but I haven't been able to finish it off yet. It's once again the integration with the iPhone code that's going awry. Plus I keep finding that I need to go back and re-factor a little more than I expected. It's good, in its way, but it's slowing progress.
One the alpha front, I do have several people signed up for testing. It's going to look reasonable for an alpha 1. There are obviously a lot more I want to do, but for an alpha it's a start. I do have several backgrounds in. Not exactly what I wanted stylistically, but they'll work as placeholders. I'm trying to write generic code since I expect to re-use some of it for a future endeavor, but that's also slowing progress. I know that one of the tenets of agile development is not to over-engineer things, but I find that it's not so much over-engineering as planning for the future development of the project. Since I know what still needs to be done and know that the game won't be released without those features, it makes it more of a necessity than one would normally expect.
Otherwise, things are progressing well but slowly. Inventory had a few gaps I needed to patch up before I could move on. I'd really hoped to have had more done (like the whole thing) by now, especially since Harry Potter 6 is out in the theatre (saw it last night). Still, if I can get something working in the not-too-distant future people may still be interested enough. And when the DVD comes out for Christmas (as is likely) I'll be well-positioned there, I hope.
That's the short of it. Questing is coming together and hopefully will be done soon. Then leveling. And then it's on to bigger, better things. And a LOT of testing. :)

Sunday, July 12, 2009

CodeSigning Hell

The best advice I can give to anyone who wants to develop iPhone applications is: When you get an error, READ THE ENTIRE ERROR MESSAGE VERY CAREFULLY. Here endeth the lesson.
I had decided to update my code signing certificates for the alpha that will be starting in the not-too-distant future. I also wanted to try to get it building for distribution on OS 2.2 devices because one of my testers is on an iPod Touch that costs $10 to upgrade to 3.0. Eventually I will need to move completely to 3.0 to get the in-app purchasing I require, but for now, compatibility is a good thing.
I made some new certs, read the instructions carefully on the Apple Dev Portal and things were going along smoothly. I had a bit of a hitch when I forgot to copy in the distribution and developer certificates to Xcode, but that wasn't too heinous. Then I tried building for 2.2. Error. And something that seemed completely odd. CodeSigning was complaining that I hadn't provided a certificate for 'Distribution' for SDK 'Device - OS 2.2'. Um, sure. Not terribly helpful. Can I build OS 3 builds? Yes - no problem. OS 2.2? No. I checked the build settings - yup, there's my certificate, it's setup for all iPhone Devices... What's your damage, Xcode? Okay, fine. You win. I'll ADD a special exception for OS 2.2. Bzzzt! Still not happy. What the HELL, man? C'mon, give me SOMETHING.
*sigh* After beating my head against it for a while, I went back and looked at the steps. Yes, I did that. And that. And thanks for the warning about making sure I did that - I did. Okay, let's Google it. I have to completely reset my Xcode to make it happy? I'm not sure that's the right answer.
Okay, one last time. Let's close Xcode, reopen, and try building it again. Nope. As expected, the same error. But wait. What does that error really say? Seriously? What configuration am I editing in the properties? DEBUG?!?! And it needs to be DISTRIBUTION?!?!?! *sigh* *facepalm*
So, let's make sure we're editing the configuration for Distribution and attach the certificate for all iPhone devices. Okay, Xcode, let's see if that makes you happy. And it does. And had I bothered to read the error message and double-check to make sure that I was actually editing the correct properties, life would have been better. But, thankfully, now it is.
Here endeth the lesson.

Friday, July 10, 2009

Good Progress

After resolving my problems with the modal view this morning (MUCH faster than expected), I spent a lot of the day working on integrating my server back-end with the app. Things have been working well there, but I've got a little left to get sorted out. I've written a lot of server code recently, but thankfully I had some code base to work off of, so it hasn't all been new code. As things stand now, I'm hoping to get questing started tomorrow. Once I get quests in I think we can start looking at doing an alpha. :) There should be enough stuff that people can start playing with it. There are still quite a few gaping holes, but there is a light at the end of the tunnel. I'm thinking that if I continue on with the rate of progress I've been making I should be able to stick a fork in this thing by the end of the month. A lot behind when I wanted to get it done, but about in line with how long iPhone apps take to develop and test.
Anyway, it's been a long week but I've managed to get some things accomplished. Now I'm into the more mundane database work that I know pretty well, so things may start to pick up a bit. That's my hope. And my hope, certainly, springs eternal. :)

Finally Working

The rabbit holes I went down were for naught. I found a much easier way to do what I wanted to do - presentModalViewController. I had been trying to hide the tab bar and swap the views and a whole lot of other rigamarole trying to get a very simple concept working. And one that I had seen other applications use before.
Regardless, it's all done and working now. I need to add a page with some verbiage about the game and the types of magic and such, but the main flow is in, working, and looking reasonably good. It just took a different Google search to find the answers I was looking for. :)
*sigh* I guess a good night's sleep really did help rejuvenate and restore.

Thursday, July 9, 2009

Differences Between Windows and Mac Development

Well, after beating my head against a problem for like 6 hours today, I have finally gotten back to where I was... 6 hours ago. *sigh* Okay, it's not that bad. I do have some other work that happened in that 6 hours that's still around, but I made one change in the program and Bam! I felt like Elzar cranked my head up a notch with a spice weasel.
I was creating the character creation screens which are shown only if it's your first time running the game. I need to make it so that it's modal - meaning you can't avoid it - so I needed to do it before you had access to the tab bar. And things were going along well. I had a root view controller that was handling both character creation screens. I got my locations displaying for people to select where they wanted to start... It was going along great. And then... BAM! Spice weasel.
I had added the root controller's view to the main window as a subview. This seemed reasonable and rational and worked wonderfully. But I couldn't seem to remove it and add the tab bar. The tab bar simply refused to display. So I went down a whole clutch of rabbit holes trying to figure out a way to get the tab bar to display AND have the character creation pages come up. And then I managed to get so far down the rabbit hole I got stuck and couldn't find the way out. I hit up a friend of mine who's on Facebook - Don Metzler. He owns his own consulting business and we've known each other for almost a decade now. He's a Mac programmer AND a Windows guy, so he's familiar with the benefits and detriments of both platforms. He and I went looking at the code and tried to get it back to where it was semi-working. And, thanks to the chat, we got it back there. Yay.
What this pointed out to me, though, was one of the things that I really have to laud (that's approve) Microsoft for doing. They make all of the MFC (Microsoft Foundation Classes) available as source code. So when you're deep in the bowels of a combo box you can figure out why your particular hook isn't getting called, you have the proverbial snowball's chance to figure out why. With Apple, on the other hand, there's a sort of mystique to the internals. You don't get to know what happens in there and some things happen so automagically you can't possibly figure out how to replicate it.
Case in point: when you attach a tab bar controller to a MainWindow.xib file, there's some special magic that happens inside Apple's foundation code that hooks everything up. You get all of your view controllers laid out, the tab bar looks good, and things happen without having to write any extra code. If you try to replicate that, though, things kinda go south quickly. I found a few people online trying to do what I was doing (albeit slightly differently), but they ran into the same frustration I did. Had I access to the source, I could have replicated it and avoided the spice weasel. Instead? BAM! Spice weasel.
I've finally gotten back to where I was 6 hours ago in terms of the main game play. I need to spend tomorrow morning going through trying to hook up the character generation screens but at least they're done - I just need to get them to display and that will hopefully not involve a spice weasel and my eyes. :)

Tuesday, July 7, 2009

Gotta Love It

When my brain doesn't work, it doesn't work BIG. Here's the problem I've been having. I have inventory UITableViewCells that show information about a particular item. I wanted to reuse the cells in both the store and the player inventory (I know - how very C++ of me). Anyway, I used overkill to get it done with one cell. I had some trouble getting the item type images (wand, spellbook, etc.) to load on the fly in the cell, so I decided to just use the big ol' mallet and created several different UIImageView objects - one for each type. Then, when the cell was displayed, I was going to just remove the ones that weren't needed from the superview and it would all be happy. (For the un-Cocoa-initiated out there, I made several overlapping images and then hid the ones I didn't want seen). This worked fantastically the first time I tried it and I celebrated exuberantly. Until I scrolled down and scrolled back up. And my images were gone! WTH man?! I mean, c'mon - it JUST WORKED.
So I was trying to find some other less-desirable way of doing it. Not that the way I came up with was in any way, shape or form a good solution, but enough of that. So I was thinking - okay, maybe I can create a different cell for each type of item. But that means that I'll need that many different UITableViewCell classes. And my re-use of cells gets a little nasty. And then it dawned on me - re-use. Because we're using a simple object pool for the items displayed (a small collection of objects that are created when needed and stick around and are re-usable), each of my cells after the initial creation are going to be the same cells. What I had been doing was checking the type of the inventory item and then removing all of the OTHER images from the cell - but I wasn't putting back the one that was needed. So when I created a cell with a wand, say, it would show a wand. If that cell was then used for a spellbook, the wand image would get removed. And then if I needed the wand image back it wouldn't be available - it had been removed.
Eureka! So, now it's back to what I had before with a few minor modifications. I just hope that Xcode has a pretty substantial undo operation list... :) Overall, though, it is more than a little hacky at the moment and I need to clean it up and hopefully make it better before I release this puppy. And yes, that's a reminder to myself. ;)

Friday, July 3, 2009

Progress and Pakled-ness

One of the pitfalls of technology is that you kind of get used to things working automagically. You don't have to do anything particularly difficult or, in many cases, that require much thought to do some pretty amazing things. A perfect example of this is my recent experience trying to get my application to install via iTunes 8 on Windows.
When developing an app, you need to create what are called "ad hoc distributions" - builds that are not loaded from the App Store and people just just drop them on iTunes and then magically appear on their iPhone or iPod Touch. There are two things required to make this happen. One is a provisioning file that tells iTunes that your device is allowed to load this program and the other is the program itself (which is a directory containing all of your files). It's a simplistic but effective way of distributing applications.
There are two quirks to this process. The first that I ran across was something I had known but forgotten - Mac ZIP files are different from Windows ZIP files. They have extra files that make uncompressing them normally impossible. You have to actually uncompress them by hand (the curtain begins to reveal the real Wizard of Oz). But that's no big deal - I'll just have to repackage them for Windows distributions. The second is that the provisioning files can't just be "dropped onto iTunes" on Windows. Drag and drop on Windows is a relatively hand-crafted experience and files ending in ".mobileprovisioning" don't make the cut for "drop targets". :) What this means is that you can't drop the provisioning files onto iTunes, you need to add them to the Library manually. (Perhaps you can drop them onto the Library itself, but File | Add to Library worked better for me). And now we can see the short man behind the curtain.
So while I was spooked that Windows and iTunes 8 weren't going to work, they do. Because I'm an idiot sometimes who doesn't try more than a few paths to get something working. Because I've become dependent upon the magic working. And I've become more than a little Pakled sometimes.
Regardless of all of that, I do now have things working from Windows and I can stop messing around with iTunes on my Mac (which was taking for-freaking-ever to add songs to the library). And with alpha only 4 days away, I have LOTS to do - especially since I'm taking the 4th off to go to Elitch's with the family and fireworks with my parents. Cogito ergo sum. And I'm a little scared by that. :)

Wednesday, July 1, 2009

Simple Tasks Gone Awry

I've been working a little bit on what I thought would be a couple of simple things, but apparently not. I created a very simple splash screen to display while my app is downloading the XML files (and before the game is actually playable). I read in a few places that all I needed to do was create a file called default.png (or Default.png depending on who wrote it) and it would work automagically. Apparently not quite.
My second task to to try to get the game running on my iPhone. Because, you know, that's like where it's actually going to be played. :) So I followed Apple's directions on how to create an "ad hoc" release (as opposed to an App Store release). I installed it on Windows and sync'd my phone. And was told that it couldn't install Wizards. *sigh* Some poking around leads me to believe that it's a problem with iTunes 8, of all things, and that until Apple fixes iTunes I'm pretty much SOL. :(
The third thing has been going much better, though, which was creating the images for inventory items. That seems to be relatively complete now (LOTS of trolling the web for images). I'm not sure that I'm providing enough inventory items, but it seems like it's coming together. At least ONE thing is going as anticipated. :)
Lots more to do, but I want to get the splash screen done (I found a tutorial to try out) and then I need to start looking at character creation. Then I think it's time to build the DBs online and start pulling data from the net. And then the fun stuff - combat!