Phil Hassey - game dev blog
Phil Hassey as Rambo
".. I've been there,
I know what it's like,
and I'll do it again if I have to."

Archive for November, 2010

Adding Retina / Multitasking support to my iOS apps

Tuesday, November 30th, 2010

Today I felt it was about time I got around to updating my Galcon apps with proper 4.x support now that everyone has it.

Adding retina is pretty easy. In EAGLView.m I had to add this snippet into initWithCoder:

	float scale = 1;
                
        if([[UIScreen mainScreen] respondsToSelector:
            NSSelectorFromString(@"scale")])
            {
             if([self respondsToSelector:
                  NSSelectorFromString(@"contentScaleFactor")])
                  {
                     scale = [[UIScreen mainScreen] scale];
                      self.contentScaleFactor = scale;
                 }
           }

Then in my code anywhere where the scale matters, I use that information to sort things out. I found that adding retina Icons, startup graphics, and other in-game graphics was as easy as adding an extra file: Icon.png becomes Icon@2x.png, my_game_stuff.png becomes my_game_stuff@2x.png, etc. It was pretty simple. Fonts were a bit more complex because I have different font data for each sized font, so I use the scale information I discovered earlier to ensure that I use entirely different font images, instead of using the @2x trick. The one goofy bit was importing to subversion. It doesn’t work, unless you put a trailing @ at the end of the filename, since subversion treats @ as the version identifier.

Doesn't work:
svn add Icon@2x.png

Works:
svn add Icon@2x.png@

Multitasking was even easier. In my AppDelegate.m I added these methods:

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    game->save();

    Event e; e.type = EVT_SUSPEND;
    game->event(&e);
    [glView stopAnimation];
    
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    Event e; e.type = EVT_RESUME;
    game->event(&e);
    [glView startAnimation];
}

The first is called when the app is suspended, the second is called when the app resumes. The iOS handles saving / restoring all the texture data, so really I didn’t have to do anything. The only catch was I had to add in the glView stop/start calls to ensure that no GL calls were made while the app was suspending. The app will crash if any GL calls are made while in the background.

I do not do any background work to keep the network alive. This seems sensible because it makes it so the game will timeout after 30 seconds but you’ll still be connected if you get back sooner than that. Anything fancier could keep a player on the network indefinitely even if they are really gone. This gives the user at least a momentary opportunity to duck away and check something then resume playing.

-Phil

Stealth Target: Day 39 – beta3 build

Saturday, November 20th, 2010

I’ve posted a new build of the game, so anyone who has bought it already can upgrade. It fixes almost all the bugs that have been reported. I sent out an email to the beta-purchasers with these questions:

– What do you like about the game?

– What do you dislike about the game?

– What could be improved about the game?

I hope those questions inspire some interesting feedback.

-Phil

Stealth Target: Day 38 – The grind

Friday, November 19th, 2010

At this point, I’m kind of in grind mode. I churned through a bunch of bugs in the past 48 hours. And did a bunch of user-interface changes. The game is getting more perfect. Here’s a shot of the bugs and changes I’ve made. I’m getting pretty happy with how things are feeling. I’ll thank the beta testers for all their feedback once again, and Tim (my brother-in-law, who does most of my music) for providing a number of pieces of UI feedback which really helped.

Google ChromeScreenSnapz003

The most visually interesting change is that now I tally up scores in sort of a jackpot style, like in most games. The shot doesn’t do the effect justice, but when the “Win” screen appears, each of the numbers is reduced to 0 while the score increases to the total score for that level. It’s pretty cool. This was Nan’s suggestion, and it seemed to be a pretty fun one! Makes beating a level feel that much more rewarding.

DynamiteScreenSnapz063

-Phil

Part-time iOS game maintenance job for Galcon

Wednesday, November 17th, 2010

jobadI’m looking for someone who wants to do maintenance on my Galcon games for the iPhone. There are a ton of great features that really need to be added to the game, but I just don’t have time to do them all myself!

Galcon has large fanatical on-line multiplayer base who would absolutely love you if you were the one to help bring the features to the game that they are begging for!

While working together we would meet at least once a week to make plans and we would work towards being on a rather frequent app update schedule. The skills I’m looking for are:

– Proficient in C / C++ code and OpenGL.
– Strong experience with ObjectiveC / iOS.
– Knowing how to work with In App Purchases, Game Center, and iOS 4.x features a plus.
– You must own a Mac.
– You must own an iPhone / iPod touch. An iPad is a plus.
– Roughly 10-20 hours/week to start, this is flexible.
– Python or PHP experience is also a plus.
– Location: Anywhere! We’ll stay in contact virtually.

Contact me if you are interested, and tell me why you’re the best for the job! Payment would be hourly based on experience. This job has the potential to grow into a full-time position.

Thanks!
-Phil

Stealth Target: Day 36 – More iPad support

Wednesday, November 17th, 2010

So, Nan did a test run of the iPad version of Stealth Target today. There’s always a handful of platform issues to deal with in porting!

Like, on the iPad I don’t need a Quit button!

Or, I need to use some ObjectiveC code to open a web page. Thanks to OS 4.x I won’t need to figure out how to embed web browsing in the game due to multi-tasking support. I haven’t added that to the game yet, but I’ll do that before release. (Which reminds me to add that to my tracker so I don’t forget!)

As always, I need to modify the interface a bit more for touch. The mouse and touch interfaces are really quite different, so I always want to make the experience work “the best” given the interface being used.

A new challenge for me is adding pinch to grow/zoom support to the game. In the desktop version the mouse-wheel controls this. To implement this for a touch interface, I need to track where the center of all touch events is, so when a motion happens I can see if that motion is going towards or away from the center. This is a bit tricky, since finding where the center of a multi-touch event keeps changing as motion keeps happening.

I found that technique didn’t work. What did work was passing along with the event a distance value between that touch and each other touch. This way, no matter how many touches are down, a reasonable zoom value will be passed.

-Phil

Stealth Target: The pre-order/beta explained (and now 50% off!)

Tuesday, November 16th, 2010

Many people were confused by my announcement 10 days ago. So I’m going to try and explain it a bit better!

Stealth Target is not a finished game. If you look at the screenshots and video I’ve posted, almost none of the graphics you see are final, they are all free graphics or stuff I hobbled together quickly so as to get the game basically working. What you’re looking at is not what I will be selling to the general public when the game is finished.

beta2ml

I am a solo indie game developer. That means there’s just me doing the bulk of this project. My wife Nan helps with the testing and some of the ideas. And I contract out the art and music since I’m only so-so at those things myself. I don’t have a team of 50 Q&A guys in my basement who test my game for me non-stop. That’s what the beta is for, it’s a way for me to get feedback from the users who are interested in helping me out!

I did, however, make a notable mistake in my beta release! I priced it at $9.99 (my planned full-price.) This was a goof-up on my part, since I really want to thank people who are taking a chance and trying out my games before they are done. I’ve changed this to $4.99 so people who pre-order get the special price. (The few brave users who went and paid the full $9.99 for the game last week I gave full refunds to, so they got the game for free!) And, yes, whoever buys the game at this pre-order price will receive the full desktop game when it is finished. (I’m also planning on releasing it for the iPad. A pre-order will not count towards that.)

Anyway, I want to give a huge thanks to the people who have played the game already and given me feedback. I’ve just posted a new build of the game with a bunch of new features and fixes based on their feedback. You can check my blog to see what all changes I’ve made and how the development has proceeded.

To the people who wondered “Where is the demo??!” Don’t worry, I haven’t built it yet, but I think I’ll be making one available sometime soon. I’ll send out a mailing when I do so don’t feel like you have to rush and buy the game right now if you’d rather try the demo first :)

So, all that said, if you’re feeling brave, go ahead and pre-order Stealth Target for 50% off the full-price, today! For the less brave, feel free to wait it out until I have a demo ready.

Thanks!
-Phil

Stealth Target: Day 34 – More bugs resolved!

Monday, November 15th, 2010

I fixed 14 bugs today. Here’s my “resolved items” list. It includes the 3 things I did last week (resolution support, WASD support.)

Google ChromeScreenSnapz002

I’m quite happy with all the feedback I got from the beta-users. Tomorrow I hope to post a build.

-Phil

Update: as an added note – the primary features added are keyboard controls, full screen / resolution options, and better mouse controls.

Stealth Target: Day 33 – Beta feedback

Thursday, November 11th, 2010

I’ve gotten a ton of great feedback from users in the paid beta. Today I re-read all the emails and forum posts and entered all the unfinished items into my bug tracker. Then I spent the day getting through a few of them:

– Added WASD key controls for the character
– Added ability to change resolution
– Added ability to switch into fullscreen

DynamiteScreenSnapz062

I’ve got 10 other items in my tracker, and I’ll see how many I can get through. I’m hoping to post a new build on Saturday and send out another mailing.

Google ChromeScreenSnapz001

-Phil

Stealth Target: Day 32 – iPad interface

Wednesday, November 10th, 2010

So .. I spent today making the game feel good on the iPad. The key items I had to get working work some “smart navigation” so that mis-touches would send the player towards an open spot and not just onto a wall. This makes navigating much easier as most locations you would want to walk to are along walls anyways. This also improves the desktop interface with the same features.

I also added the ability to pan around the level by using two fingers like in many other apps. This works well. I haven’t decided if / how I will support zoom in and zoom out.

I’ve gotten a ton of emails from artists and musicians, but it’s all pretty hard to sort through! I haven’t done much contracting out, so it takes me a while to figure out what I’m doing. Hopefully it’ll all start to make sense soon.

The response from the beta sale has been excellent. I’ve gotten a number of people giving me great feedback. Over the next few days I’m going to use all that feedback to update a build for this weekend. I may also try and get it working as a demo version so that I can expand the beta to more people.

Getting the editor working took a few UI tweaks as well as handling of the keyboard when it pops up. What I’ve noticed today is that my game has 4 different coordinate systems that all have to “get along”:

– The OpenGL physical coordinates
– The iOS event coordinates
– My user interface coordinates
– The game world coordinates

And getting all those systems to work nicely together when say, the devices is reoriented, or the keyboard pops up is a bit of tricky business!

-Phil

Stealth Target: Day 31 – iPad cleanup

Tuesday, November 9th, 2010

It took a bit of messing with provisioning profiles, but I got it to deploy to the iPad, eventually.

I also add to add setup for the depth buffer into ES1Renderer.mm .. This is not included for whatever reason.

Then I got to do some iPad specific tweaks – since the game was first for the desktop, some of the code is specific to the mouse interface. I’ve wrapped some #ifdefs around those things to check for BUILD_DESKTOP or BUILD_TOUCH so I can have some code that checks for certain mouse buttons and some code that doesn’t.

There’s a pretty good list of things I need to do however:

– Get music and sound effects working

– Get the mini-level preview screens working better.

– Do some smarter backface culling

– Avoid overdraw as much as possible

– Smarter touch interface

But in general, the game seems to work alright 🙂

So by changing my rendering to use GL_ONE (additive) blending, I can easily see where I have overdraw happening in my scene.

DynamiteScreenSnapz061

That shot has GL based backface culling enabled, but I’m going to disable it so I can do my culling on the software size so I don’t use so much memory in my buffers. Not sure if that will give me a performance gain or not, but it’s something to try out.

To get the music working, I converted my .wav file to an .aac file using this command on OS X:

afconvert music1.wav -f adts

That seemed to produce an .aac file.

From investigating speed issues on the rendering, it seems my use of GL_LIGHTs is slowing down things considerably. If I disable all my lights it renders much faster. I may have to investigate some other options here.

Anyway, it’s nice getting this game started on the iPad. I think it’ll come together pretty quickly with another day of tweaks.

-Phil