Archives: June 2010


SDK 4.0 Bloated Executable

June 30th by Tommy Leung

In more SDK 4.0 learnings, we came across a file size problem with Propaganda Lander in moving to SDK 4. The Unix Executable File became twice as big as it used to be under the 3.0 SDKs. There was no rhyme or reason for this that we could see.

If you are someone who cares about keeping your app’s file size under the 3G download limit, it is important to optimize as best as you can do get it under 20MB. A lot of games really don’t care which will be an annoyance to someone who wants to buy the game but has no WiFi service nearby. Other games just can’t be that small and then there’s nothing you can do about it.

We are pretty adamant about keeping Propaganda Lander under 20MB. Even with all our wondrous musical tunes, movies with voice overs, and pretty graphics we demand to have a game that can be downloaded from anywhere there is a 3G signal. After all, we are making a game for a mobile phone first and a portable music device second.

The reason why the executable file was twice as big under SDK 4 was because it defaults to compiling for iPad as well as iPhone. I see no reason to have both binaries when most games have specific versions for iPhone and iPad. You can fix this by checking Build Active Architecture Only in the project settings.

You should enable Dead Code Stripping as well–it usually is by default. There’s also Optimization Level which defaults to [-Os] for fastest, smallest and tends to be best.

MoviePlayer in iOS 4

June 24th by Tommy Leung

In the quest to make Propaganda Lander run under iPhone SDK 4.0 and eventually utilize Game Center, I’ve run across some problems/solutions with multitasking. The most recent problem was with MPMoviePlayer. Propaganda Lander plays a movie on each planet plus a nice little video after you’ve beaten the game so movie playing had to work.

SDK 4.0 changes how the MPMoviePlayer works. I think it is now much better than it was before. You have more control over it. It will also, by default, mix with other audio as well. Right now, Propaganda Lander will kill your iPod if a movie plays. We didn’t particularly like that but, there was no choice in the matter. There is now! The iOS 4 version of Propaganda Lander will have this feature.

So, Apple has created an MPMoviePlayerViewController that you can use as a view to control the movie. MPMoviePlayerController still exists but is slightly different. In the past, creating an MPMoviePlayerController would just take over the device and play the movie. You now need to add your MPMoviePlayerController’s view to a UIView or UIWindow.

The MPMoviePlayerViewController will auto rotate if the device’s orientation changes. This was not ideal for Propaganda Lander as it only plays in one orientation: OrientationLandscapeRight. In order to get around that, we had to use the UIView from the MPMoviePlayerController and transform it accordingly.

Here is some code straight out of Propaganda Lander for movie player in iOS 4 :)

You’ll need this for the degrees to radians conversion

#define degreesToRadian(x) (M_PI * (x) / 180.0)

This is the actual code:

MPMoviePlayerController * theMovie;
theMovie = [[MPMoviePlayerController alloc] initWithContentURL: movieURL];
UIView * movieView = [theMovie view];

[movieView setFrame: CGRectMake(0, 0, 480, 320)];

CGAffineTransform landscapeTransform;
landscapeTransform = CGAffineTransformMakeRotation(degreesToRadian(90));
landscapeTransform = CGAffineTransformTranslate(landscapeTransform, 80, 80);

[movieView setTransform: landscapeTransform];
theMovie.scalingMode = MPMovieScalingModeAspectFit;
theMovie.fullscreen = TRUE;
theMovie.controlStyle = MPMovieControlStyleNone;
theMovie.shouldAutoplay = TRUE;

[[[UIApplication sharedApplication] keyWindow] addSubview: movieView];

If you would like to use the MPMoviePlayerViewController that has all the auto rotation features, it would look like this:

MPMoviePlayerViewController * movieView;
movieView = [[MPMoviePlayerViewController alloc] initWithContentURL: movieURL];

MPMoviePlayerController * theMovie = [movieView moviePlayer];
theMovie.scalingMode = MPMovieScalingModeAspectFit;
theMovie.fullscreen = TRUE;
theMovie.controlStyle = MPMovieControlStyleNone;
theMovie.shouldAutoplay = TRUE;

[[[UIApplication sharedApplication] keyWindow] addSubview: movieView.view]

When you the movie is done playing, you will want to remove it. You can do so by using the NSNotificationCenter to get a callback when the movie is done.

[[NSNotificationCenter defaultCenter] addObserver: self
	selector: @selector(movieFinishedCallback:)
	name: MPMoviePlayerPlaybackDidFinishNotification
	object: theMovie];

When the movie is finished, it will call the movieFinishedCallback method which would look something like this:

- (void)movieFinishedCallback: (NSNotification*) notification;
{
	[[NSNotificationCenter defaultCenter] removeObserver: self
		name:MPMoviePlayerPlaybackDidFinishNotification
		object: [notification object]];

	MPMoviePlayerController * theMovie = [notification object];

	[theMovie.view removeFromSuperview];
	[theMovie release];
}

This ONLY works in iOS 4 devices. If you also need to target iPhone OS 3.0 or 2.0, you will need to check for the OS and then have the former MPMoviePlayer code as well. Since Propaganda Lander still targets iPhone OS 3.0, we made this function to check for the OS.

std::string getOS()
{
	UIDevice * device = [UIDevice currentDevice];
	NSString * os = [device systemVersion];

	if([os isEqualToString:@"4.0"])
		return "4.0";
	if([os isEqualToString:@"3.0"])
		return "3.0";
	if([os isEqualToString:@"3.1"])
	        return "3.1";
	if([os isEqualToString:@"3.2"])
		return "3.2";
	if([os isEqualToString:@"3.1.2"])
		return "3.1.2";
	if([os isEqualToString:@"3.1.3"])
		return "3.1.3";

	return "";
}

And for a much more robust way of determining iOS version that can be compared as numbers:

float getOSf()
{
	UIDevice * device = [UIDevice currentDevice];
	NSString * os = [device systemVersion];

	float osAsFloat = [os floatValue];
	return osAsFloat;
}

There’s some C++ and Objective-C in there as you can see. I actually wanted to return numbers but, strings will do for now. You can just as well return NSString’s exclusively if you’d like. As you can also see, we don’t care about OS’s below 3.0. OS 3.2 is the iPad OS and should have no effect for iPhone development but, I left it in there anyway. I believe 3.2 uses the same MPMoviePlayer code as iOS 4.0.

So if your movie player suddenly stops working in iOS 4.0, this is why and this is how to fix it. :)

Limited Propaganda Lander Sale!

June 24th by Tommy Leung

In celebration of the launch of iPhone 4, we are putting Propaganda Lander on SALE until 11:59pm Sunday, June 27th, 2010. It is 40% off at $2.99. Get it now if you haven’t already! It might make a nice gift for a friend who just got their shiny new iPhone 4. :)

Here’s our press release if you’re into that stuff.

###

EXCITING SPACE ADVENTURE GAME PROPAGANDA LANDER CELEBRATES IPHONE 4 WITH LIMITED SALE!

NEW YORK, NY, June 24, 2010 – In celebration of the launch of iPhone 4, SMASHWORX is lowering the price of Propaganda Lander from $4.99 to $2.99 starting on Thursday, June 24th 2010 through Sunday, June 27th, 2010! No other game of it’s kind can compare with Propaganda Lander’s charm, style, and buttery-smooth space-flight controls. It’s the unforgettable iPhone experience you haven’t had yet. Experience it now by visiting the App Store and purchasing Propaganda Lander at 40% off before the sale ends!

Propaganda Lander fulfills the dream of piloting an alien spacecraft through hazardous exotic environments. Players will need to develop some serious skills to survive an onslaught of missiles, giant sea serpents, and molten lava pits. Players will also have to put up with the ultimate jerk of a boss that doesn’t seem to mind putting the lander in precarious situations but, that’s the price of admission. Propaganda Lander is an iPhone experience you won’t find anywhere else. This highly polished and innovative game is normally priced at $4.99 but with the excitement of the iPhone 4 launch we couldn’t help ourselves but offer a sale to the Apple community.

Propaganda Lander is scheduled for a massive update in the coming weeks with new planet-themed music, leaderboards with AGON, easy and hard modes, survival mode, and more! Get Propaganda Lander before it returns to it’s original price!

PRAISE:

“Propaganda Lander isn’t the only Lander style game available for the App Store, but almost none can claim as much charm and style as ‘The Rickster’ on his universal campaign of glory.”
-Andrew Nesvadba, AppSpy (4 out of 5)

“You will have to bring your A game in order to get through the 20 levels currently included… This $4.99 game is universal and looks beautiful on any sized screen.
-Michelle Lopez, The Portable Gamer iCasual Podcast

“Propaganda Lander: simple idea, unlikely hero, amazing game!”
-Emiliano Contarino, iPhoneItalia.com

FEATURES:

- The best motion-controlled flying in any game on the App Store.
- 20 levels that will kick your butt and that’s before the boss battle.
- Each planet features a short movie that’s more South Park and less Dora the Explorer.
- The baddest final boss you’ve faced on iPhone; so badass, he doesn’t fit on one screen.
- If you aren’t into dark humor, you won’t find any part of this game funny. Too bad for you.
- We have some hard to obtain achievements. We like achievers.
- Listen to your iPod while playing.
- Brag about your achievements on Facebook.
- Rule the galaxy!

Get Propaganda Lander Now!: http://www.smashworx.com/buypropaganda

About SMASHWORX
SMASHWORX is housed in NYC, the only city that could possibly withstand its chaotic force. SMASHWORX is here to to shake, not stir, the pot. We are made up of code breakers, delirium takers and the type of people your ma’ warned you about. Our intention is straight-forward: bash gamer’s heads in by ignoring the rules set by marketing cronies and corporate geezers. We take no prisoners. SMASHWORX has had enough with terms like “bleeding-edge.” We promise to produce addictive games that bring a little rock n’ roll into the gamer lifestyle. We are the folk that spent most of our time in detention. We are the stick in your spokes. We are SMASHWORX!

Visit Us: http://www.smashworx.com
Follow Us: http://www.twitter.com/smashworx
Like Us: http://facebook.smashworx.com
Our Pics: http://www.flickr.com/photos/smashworx
Videos: http://www.youtube.com/smashworx

###

Propaganda Lander and iOS 4

June 23rd by Tommy Leung

I installed iOS 4 on my iPhone 3GS the day it was available. It runs great and the new features are extremely useful. I’ve turned my 10 pages of apps into 3 pages using folders! I’ve been–as well as many others–waiting for multitasking for apps like Pandora and it’s finally here! I am now waiting for Rhapsody to provide an update with multitasking.

As is with every iPhone OS update, I need to install the new SDK to actually do any work. The update to iPhone SDK 4.0 wasn’t without a few hiccups! We are almost done with the rather hefty Propaganda Lander update and it will run just fine on iOS 4.

iPhone SDK 4.0 assumes every app that you develop will utilize multitasking. As of now, we don’t find much use for multitasking in our games. Propaganda Lander won’t have multitasking. When you close it, it will clear itself out of memory and won’t sit there hogging system resources.

While playing around with the new SDK, I have seen Propaganda Lander operate in the background. I’ve switched from Propaganda Lander to Safari and back. It’s kinda cool. Although, using any other resource intensive application will cause iOS to shut down Propaganda Lander anyway so it’s not particularly useful in that sense.

Implementing Multitasking

I had some difficulty trying to figure out how to opt out of multitasking! I followed the instructions Apple provides in their manual but, it just didn’t work–it had mostly to do with my shallow understanding of Xcode. Developers switching to iPhone SDK 4.0 will realize that their games will have an error upon exiting because it assumes the app is going to run in the background and you haven’t handled for it.

You can either handle for it using these two functions:

- (void)applicationDidEnterBackground:(UIApplication *)application
{
      [glView stopAnimation];
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
      [glView startAnimation];
}

They should reside in your AppDelegate and in this case we are stopping our animations when the app enters the background and restarts our drawing when the app enters the foreground. You are not allowed to make any GL calls while in the background.

That’s a quick way to implement background support although there are lot of other things that you need to account for depending on what your app is doing. Apple has a guide for that.

Opting Out

The other alternative is to simply opt out of running in the background. Apple has a guide for that as well but, it’s not exactly as they describe! Maybe I’m just not as Mac-savy–and I’m not–but, I followed their instructions and added the key/value pair to Propaganda Lander’s Info.plist and nothing happened.

With a little help from Nik–a Mac veteran if you will–we figured out that you can’t simply write YES as a string in the key/value pair. You need to right click in the value box and change the Value Type to a Boolean. This is seemingly obvious except I didn’t know you could do that. I’m from PC-land and we don’t use plists.

So if you are like me and can’t seem to figure out why Apple’s instructions aren’t working, this is what you need to do. It is also possible that I’m the only person developing for iPhone that didn’t know that in which case, hope you had a good laugh!

Favorites from E3 2010

June 18th by Tommy Leung

Unfortunately, none of us were at E3 this week. We were all busy working. That didn’t stop me from tuning into the press conferences on GameTrailers, GameSpot, and other places. I wasn’t surprised by any of the big announcements as I knew that they were coming: Nintendo 3DS, Kinect, PSN Plus.

Surprised or not, I am still excited for some of the new hardware and games!

Nintendo 3DS

Being that I wasn’t at the show, I couldn’t get a first hand experience of 3D portable gaming without glasses. In fact, there’s really no way to demonstrate the 3D except to play with a 3DS so I am excited purely on the speculation that it will be awesome. It is a Nintendo product so unless it’s another Virtual Boy, it should be pretty awesome. Can’t wait to experience the 3DS this Fall.

I’m not a big Kid Icarus fan but, if that’s the flagship title to show off the 3DS, I will have to get it. There’s a whole slew of N64 remakes at E3 showing off the 3DS. I wouldn’t mind some updated StarFox 64! Loved that game.

The Legend of Zelda: Skyward Sword

Even though the presentation of Skyward Sword looked horrendous due to wireless interference, I am still excited by the trust I have in Nintendo that they wouldn’t release a Zelda game that doesn’t control well. Again, my excitement for this Zelda game is purely speculation that it will be awesome because Nintendo is behind it.

As you can see, I have great trust in Nintendo to make great games–9 times out of 10 I am right.

I was expecting something different for this new Zelda but, if the sword controls are as good as I am expecting, it should still be incredibly fun. I would have liked to see some departure from the Ocarina of Time model that we’ve seen for over 10 years.

Crysis 2

I have not played Crysis or was ever interested in it. However, I saw the gameplay demo of Crysis 2 and was in awe. I have a soft spot for games that take place in NYC and who doesn’t love super soldiers? The movie alone has me excited about the prospects of this game!

Metal Gear Solid Rising

I love the Metal Gear Solid series and didn’t think much of Rising until I saw the demo from E3. The ability to cut things every which way looks really cool. A lot of people didn’t like Raiden from MGS2. I’m not one of those people. I thought Raiden was pretty cool. I have no problem with a MGS game that features Raiden–he’s kinda badass.

Kinect

It might be shocking but, I’m not interested in Kinect for it’s games. I’m interested in Kinect for what it can do for interface interaction. I would love to voice control my XBOX when watching Netflix and scroll through my queue with my hands. The video chat also looks awesome.

However, the games aren’t that interesting to me. The rumored $149 price tag doesn’t make me want it more either.

Metroid: Other M

I am quite excited about this game even before E3 and Nintendo only showed a small clip of it. This is on the list simply because I haven’t powered on my Wii in a very long time. In fact, I gave it to my brother so I’ll have to buy the shiny new black Wii to play Other M.

I have changed all my computer’s wallpapers to be Metroid themed. Just sayin’.

***

I haven’t mentioned PlayStation Move because it didn’t really interest me. I am interested in the highly accurate wands but, there aren’t any games that are particularly attention grabbing. Sorry Sony! If I see a great title for Move, I will get it. I’ve been using my PS3 the most as of late. None of the 3D games that require me to wear glasses were remotely interesting to me. I don’t want to wear glasses.

And that’s my favorite of E3 2010! :D