Archive for April, 2009

StickWars 1.2 and StickWars Lite 1.1 Re-Submitted to Apple

Thanks to everyone for being so patient! After working very hard for the past couple weeks, the 1.2 update is completely ready. The changelog is enormous, as I put in a lot of time adding every feature asked for that was feasible in the time frame. We also added in tons of new graphics, which really add a lot of polish and fun to the game. In addition, we now have background music tracks composed just for StickWars! I hope everyone enjoys them.

Don’t worry though, I added more options, such as the ability to disable background music, so you can listen to your own music on your iPod. For a complete list of the changes, check out the post on my forums.

The 1.2 and 1.1 Lite are actually the same game, but Apple won’t let me skip the version 1.1 for whatever reason. I’m hoping the Lite version finally gets through so people have the chance to try my game to see if it fits them before they buy. I’d like to get more than a 3.5 star rating, but I blame Apple’s rejection of the Lite version for a lot of this.

I’ll be putting up some new screenshots on the StickWars page shortly.

63 Comments

StickWars 1.1 is #1 Paid App

Exactly one week after release, StickWars has hit the top spot in the App Store. For something that started out a little over a month ago as a project to help me learn Objective C,  I can say that I never expected this.

I want to thank all my friends who put so much of their time into playing my test versions back when it wasn’t really fun to play :) . I also owe a lot to my other testers who provided me a lot of valueable feedback.

I’m still hard at work for future updates, so enjoy playing and look forward to the game improving over time.

18 Comments

StickWars 1.2 Submitted to Apple

After a few days of intense labor, the graphics and tweaks are finished. The game visually is improved, but behind the scenes I did a lot of work to patch small issues and make the gameplay smoother. Of course, nobody will notice this, but I expect that the game will feel a lot more polished and people will enjoy.

I didn’t have time to add in new enemies or game modes as planned, but we have some pretty neat ideas for those in the upcoming weeks.

A few teaser screenshots are here.

Also, just noting for the record, StickWars is currently #10 in paid apps on the App Store :D .

2 Comments

StickWars Version 1.1 Accepted and in App Store

At last! Wizards, Archers, difficulty levels, global high scores, and more!

Enjoy.

11 Comments

Welcome!

Welcome to my site. I initially created it with the purpose of showcasing my development experience while creating my first iPhone game, StickWars. However, after the release and huge market response to the game, this site mainly serves to provide news and support for StickWars. You can find answers to many questions in my forums as well as post any other questions you might have.

While a lot of the posts are about updates about StickWars, I try to post code snippets and tips to get through roadblocks that I experienced while building my first iPhone game. If you have questions or would like to see some code to help you along, contact me and I’ll try to throw something up.

12 Comments

Integrating Chipmunk into Objective C iPhone Games

When working with Cocos 2d iPhone, a lot of the sample code provided that shows how to hook into the Chipmunk physics engine using static functions outside of any Objective C object. While this is the most straightforward way to get the engine up and running, it restricts what you can do later on.

Instead, you need to create a static function which takes two parameters, the object being updated and the objects container. Here’s some code:

This is the static function which goes outside your class implementation. Notice that we don’t actually do any of the object updates here. This is good, because we can’t access any of the internal state in the container in this method.

static void updateEachShapeCallback(void *ptr, void *parent)
{
	GameController *parentObject = (GameController *)parent;
	[parentObject updateShape: ptr];
}

Note that my container, called GameController, is a CocosNode so when were ready to start the game we can call

[self schedule: @selector(step:)];

to update the shapes.
This goes inside the implementation of your container.

- (void) step: (ccTime) delta
{
    int steps = 1;
    cpFloat dt = delta/(cpFloat)steps;
    for(int i=0; iactiveShapes, &updateEachShapeCallback, self);
    cpSpaceHashEach(space->staticShapes, &updateEachShapeCallback, self);
}

Add in the updateShape:(void *)ptr method to your GameController interface file and then implement as

- (void) updateShape:(void *)ptr {
	cpShape *shape = (cpShape*) ptr;
	Touchable *obj = shape->data;
 
	if(obj) {
		cpBody *body = shape->body;
		[obj setPosition: cpv( body->p.x, body->p.y)];
		[obj setRotation: (float) CC_RADIANS_TO_DEGREES( -body->a )];
 
		// do whatever else you want here! you have all the the state you should need!
		// just avoiding creating objects anywhere from here as that will slow your game down
	}
}

I adopted this solution from instructions I found at Using native Objective-C methods for C Callbacks.

6 Comments

Unofficial App Store Rejection Criteria

I found this post to be very informative, and possibly helped to prevent my App from being rejected the first round (I had enabled constant vibration while the player was under attack).

No Comments

AdMob Ad to Landscape Orientation

I checked around the net and found some people looking for this, but nobody who actually posted a code example. So here it is, code to make your Ad Mob ad shift to landscape orientation. My code makes it appear on the bottom, enlarged a little bit, with the device rotated to landscape counter-clockwise.

Add in a UIView called adContainer in your delegate interface declaration, and then update the standard Ad Mob methods as follows.

- (void)showAd 
{	
	adMobAd = [AdMobView requestAdWithDelegate:self]; // start a new ad request
	[adMobAd retain]; // this will be released when it loads (or fails to load)
	adContainer = [[UIView alloc] initWithFrame:CGRectMake(0, 432, 320, 48)];
}
#define degreesToRadians(x) (M_PI * x / 180.0)
 
- (void)didReceiveAd:(AdMobView *)adView 
{
	[adContainer addSubview: adMobAd];
	[window addSubview:adContainer];
	CGAffineTransform makeLandscape = CGAffineTransformMakeRotation(degreesToRadians(90));
	makeLandscape = CGAffineTransformTranslate(makeLandscape, -480/2 + 48/2, 320/2 - 48/2 - 12);
	makeLandscape = CGAffineTransformScale(makeLandscape, 480.0/320, 480.0/320);
	adContainer.transform = makeLandscape;
	autoslider = [NSTimer scheduledTimerWithTimeInterval:AD_REFRESH_PERIOD target:self selector:@selector(refreshAd:) userInfo:nil repeats:YES];
}
- (void)removeAd 
{
	[adMobAd removeFromSuperview];
	[adMobAd release];
	adMobAd = nil;
 
	[adContainer removeFromSuperview];
	[adContainer release];
	adContainer = nil;
}

This was actually my first experience using the CG transforms, so please be gentle if there’s a better way :) .

2 Comments

iPhone App Ad Hoc Distribution Gotchas

I spent more time trying to get Ad Hoc distribution work than any other issue that should have taken 15 minutes. There are a number of things which can go wrong, some of which are ridiculous and Apple will no doubt fix in time, but for now you should know these:

The biggest gotcha: you can not use the “Compress” option in Finder to bundle the Ad Hoc package. It adds files that cause iTunes to freak out. I wrote a quick shell script to bundle everything up and zip it together using the command line zip tool.

mkdir Payload
cp -rp MyApplication.app Payload/
zip -r MyApplication.ipa iTunesArtwork Payload

This way, you can give people the .ipa and .mobileprovision file. Tell them to drag the .mobileprovision into iTunes, and then double click the .ipa. How easy was that?

Another semi-obscure fact: iTunesArtWork is a 512×512 png, named simply ‘iTunesArtwork’ without the extension that needs to be included ONLY with Ad Hoc copies so the icon shows up in the iTunes window. You don’t need to include it, but if you do make sure you only do so when sending out Ad Hoc copies.

One more thing that caught me over and over again: don’t forget to increment the version number in your info.plist file before giving Ad Hoc users a new copy! iTunes is really sneaky about what happens here…in both cases it says the application is already installed, and asks if you want to replace it, but if you try to replace with the same or lower version number, it won’t actually do anything.

If you are getting

Application was not installed on the iPhone because it could not be verified.

then your profile isn’t valid and you should check out this post. This biggest thing to remember is

  1. Delete all the profiles stored in ~/Library/MobileDevice/Provisioning Profile.
  2. Double click your .mobileprovision file and it will get loaded into XCode.
  3. Quit XCode completely. I’m not sure why this is necessary, but often XCode refuses to build unless it starts up with the profile already ready.

Lastly, ensure not only that Entitlements.plist is included in your project (click File, New File, Code Signing, Entitlements), and that get-task-allow is unchecked, but in your “Ad Hoc” build profile (Project, Edit Active Target) expand the list to “All Settings” make sure the “Code Signing Entitlements” field is filled out with your “Entitlements.plist”.

21 Comments

StickWars – Siege renamed to StickWars

The new homepage for the game is located at http://johnehartzog.com/projects/stickwars/

22 Comments