Gamieon is a privately owned entertainment software development company located in Tampa, Florida. Since October of 2004, we have aimed to provide quality video game software which emphasizes both intellectual and action-driven challenge to the gaming community. Gamieon depends on the talent of individuals working as a team to develop video games and video game engines with a focus on exceptional game play and surrealism.

Image RSS Feed Latest Screens
Dominoze Construction Kit
Blog RSS Feed Report abuse Latest Blog: Skillz iOS, Unity 3, and I

0 comments by Gamieon on Feb 24th, 2014

In December 2013 I entered into a small "venture" with the Skillz team to make a simple game called Tiltz Tournament where players could compete for game coins or real money. I developed the core game, and they provided the tools for matchmaking and account management. Here I write about my experiences in hopes other Skillz developers can benefit, find solutions to issues, and avoid the mistakes I made. This entry is laid out in six parts:

  • Getting the Unity project set up for Skillz
  • Getting the XCode project set up for Skillz
  • Setting up Parameters and Tournaments on the Developer Portal
  • Completing the Skillz integration in Unity
  • Completing the Skillz Integration in XCode
  • Testing production mode

If you're the impatient type like I am, just go to QUICK BUILDING REFERENCE to see how to build a Skillz-enabled game for your iPhone.

Getting the Unity project set up for Skillz

After the core game was created in Unity 3 and tested on my iPhone, I followed the instructions on the Skillz homepage to integrate their SDK into the Unity side of the game. Upon trying to import the Unity package, Unity crashed. This was because the package I got was exported from Unity 4 and is not compatible with Unity 3. My project would no longer open in Unity 3. I fixed it by doing the following:

1. Going into Finder and deleting the SkillzDelegate prefab from the project's folder.
2. Starting Unity
3. Making my own Skillz prefab by:

A. Making a new empty game object
B. Adding the Skillz and SkillzDelegate scripts to it.
C. In my Unity Project tab, click on Create, select Prefab.
D. Drag and drop the game object to the prefab.

Before continuing the integration, I wanted to make sure I could still build the project and deploy it to my iPhone. Since Skillz requires iOS 7, I had to go into my Unity project settings and make sure I maxed out my iOS version settings. Unity's deployment target only went up to 6.1, so I had to change the app deployment target to 7 from XCode later on. I also had to make sure my project was set up for iPhone only. I then proceeded to build the project from Unity so it would generate the XCode project.


Getting the XCode project set up for Skillz

XCode didn't open automatically because Unity 3 doesn't know how. Still, the iPhone assets were created, and I was good to move forward.

The first thing that tripped me up in XCode was that the deployment target (at the top left next to the Play and Stop buttons) was set to the simulator, so I got a bunch of build errors. I plugged in my iPhone 4 and made sure the deployment target was my iPhone.

I went to the General tab of the project, made sure the deployment target was iOS 7, and that the Device Orientation was only Portrait. Scrolling down further I noticed that some app icons were missing. Again, Unity 3 didn't know to put them there. I had to generate icons in the missing dimensions using The Gimp, and import them into my XCode project folder. Then I assigned them to the icons in the General tab.

I then followed Skillz' instructions to integrate their SDK into the XCode project.

After that, I tried building using the Command-B button. I got several linker errors indicating the std library was missing, and some Game Center-related functions were missing. A little puzzling, but I found the solutions. Under the Build Settings tab, I selected (All) and (Combined) at the top. Then I scrolled to the section called "Apple LLVM 5.0 - Language - C++." There was an entry for "C++ Standard Library." I set it to "libstdc++" and that fixed the std linker errors. After that, I went to the Capabilities section and turned on Game Center (it is bound to my Apple account so you may not have this problem).

I then attempted to build the app again, and it succeeded. I was then able to deploy it to my iPhone 4. Of course I did not actually invoke Skillz functionality in the project, so the app behaved just as it did before.

At the top of the screen was the pesky status bar (battery life, time, etc.). I made it go away in subsequent builds by going to info.plist, adding "View controller-based status bar" and setting it to NO.


Setting up Parameters and Tournaments on the Developer Portal

The next step was to set up the tournaments on the Skillz developer portal. My journey began on the page where I had to enter Parameters. It took me a while to realize that the Parameter list was a collection of every possible unique property of a game for any tournament, and the Parameter list values are the DEFAULT values that the tournament-specific parameters get populated with on the developer portal in the next page. In my game, the Parameters which defined a unique game were the duration of the game and the existence of obstacles. So on my developer portal, Tiltz Tournament has a grand total of two parameters called "TimeLimit" and "Obstacles". TimeLimit has no whitespace because I got errors trying to fetch "Time Limit" from the parameter dictionary from Skillz, and decided I didn't want to deal with it. The value of "Obstacles" is "On" because most tournaments have them turned on. The value of "TimeLimit" is "90" for the same reason.

As for the Tournament list, I could not add or remove entries. I could only change existing ones. Furthermore, the entry fee and player counts seem to be linked. I'm cool with that. I also decided I didn't need more tournaments than they had existing; having more than eight would be overwhelming to the player I think. I ended up using 5 tournament slots for myself, and renaming the other 3 tournaments to N/A so the Skillz team knew not to include them. One of the N/A tournaments was a special developer tournament where I made "TimeLimit" a value of 5. This enabled me to test the game ending due to the clock running out without having to wait 90 seconds.

By the way, after you fill out the Parameters and Tournament List, you go into sandbox mode automatically. Another important bit: You can ALWAYS GO BACK AND CHANGE YOUR TOURNAMENTS, PARAMETERS, AND MOST ANYTHING ELSE. I find that to be a particularly helpful facet of the Skillz developer portal.

Completing the Skillz integration in Unity

What threw me off the most was not understanding the flow that Skillz had intended for the game. The flow is basically this:

  1. Main Menu
  2. Skillz Interface - Game selection / matchmaking
  3. Game
  4. Skillz Interface - Game completion
  5. Skillz Interface - Game selection / matchmaking
  6. Game
  7. (repeat 4-6)
  8. Main Menu

The main menu is the launch point for a continuous back-and-forth between your game and Skillz. If a player quits from Skillz, only then should they be taken back to your main menu.

As I implemented the Skillz functionality into my game, I learned that the Skillz package doesn't seem to like Unity calling Application.LoadLevel from a Skillz callback; at least in Unity 3. When you write your game in Unity 3, you should make sure you have a reset function in one of your scene components so that you can effectively "reload" the scene without actually reloading it. Even if it doesn't crash for you like it did for me, you save yourself the time of reloading all the scene assets. Be sure that your reset function also pauses the music.

One thing I was not a fan of were the developer TODO comments in the Skillz scripts where I had to write my own code. This is because if I download a new package, I could overwrite their old scripts and therefore my changes to them. I wrote my own static class with functions to be called from Skillz's callbacks to minimize any pain of re-importing their scripts.

Completing the Skillz Integration in XCode

After finishing the Skillz integration on the Unity side, I was ready to take a test drive in sandbox mode on my iPhone. After building and running it, and learning the lessons that I wrote about above, I was able to get it working smoothly with two exceptions.

First, there was a bug where if you tilt your iPhone in a way ideal for landscape, and you quit the game, the Skillz interface would get all glitchy and messed up looking. I fixed this by opening Classes/AppController.mm, going to the function

(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *window)

and commenting out the landscape enumerations so that they were not included in the return value.

Secondly, I noticed my app icon was missing from the Skillz interface next to the "Go back to " button. I never did figure out how to fix that.

Testing production mode

Now it was almost time to make the release. I turned off sandbox mode, uploaded an App Store-provisioned .ipa file to my Skillz developer portal, clicked the Sync button on the Skillz developer portal, then clicked on the Play button in XCode to build and deploy it to my iPhone. I kept getting this error when going into Skillz: "Sign Up Error - Invalid client serv request." After going back and forth with the Skillz team, I figured out that the problem was the manner in which I installed the app onto my phone. I fixed it by deleting the app from my iPhone, and then adding the .ipa file (the one I uploaded to Skillz) to my iPhone by using XCode Organizer. After doing that, the error was gone, and testing seemed to work out.

In subsequent builds, I got the same Sign Up error again because I had forgotten to upload and Sync my latest .ipa to the Skillz portal.

I also asked the Skillz team to help me test because I only have one device, and they have several they could test with at the same time. Besides that, it's also in their best interests that the game is solid Posted Image.

After all that, I had Skillz help me with the app description and the app rating. I then submitted the game to the App Store.

Post production

The first release of my app was with the Skillz 2.x SDK. I summarily made a new build with a 3.x version of the SDK. None of the Unity-side scripts appeared to change, though I made sure all of the non-Unity assets were updated.

I accidentally tested on a device that was not connected at the time. Once the game attempted to enter the Skillz portal, I got a notification that the device was not on the internet. Nothing happened after that for an indefinite period of time. This will be a cause of frustration for players, so in a subsequent update I will use Unity's functionality to determine whether the device is online when the player taps the play button. Keep in mind the device could still lose connection in the game (like if they're playing and get on an elevator, or they go out of wi-fi range). I informed my contact over at Skillz about it.


QUICK BUILDING REFERENCE (Dec 2013)

Here is the process I would undertake doing a build with Unity 3 from scratch in December 2013:

1. Follow the Skillz instructions for importing Skillz assets into your Unity game (but don't import any prefabs unless you're 100% sure they're Unity 3)
2. In Unity, make sure your build target is iPhone only and using the most recent iOS version settings possible. Make sure your orientation is Portrait.
3. In Unity, do a Build and Run. Select the Replace option (since I assume you want to build from scratch).
4. After Unity finishes what it's doing, open XCode to the created project if it's not there already.
5. Follow the Skillz instructions for integrating the Skillz SDK
6. Make sure your deployment target is iOS 7.0
7. Make sure your orientation is Portrait.
8. Make sure all your icons in the General tab of XCode are assigned.
9. Make sure all your necessary capabilities are assigned in the Capabilities tab of XCode.
10. Open Classes/AppController.mm, go to the function

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *window)

and comment out the landscape enumerations so that they are not included in the return value.

11. Under Build Settings, scroll to the section called "Apple LLVM 5.0 - Language - C++." There is an entry for "C++ Standard Library." Set it to "libstdc++"
12. Go to info.plist, add "View controller-based status bar appearance" and set it to NO.
13. Connect an iPhone to your machine and make sure XCode is set to build and deploy to it.
14. Go to the Product menu and select Clean
15. Click on the Play button to build and run.

Check out my homepage and social feeds

And my projects!

Groups
Desura

Desura

Official group with 10,053 members, open to all members

Desura is a community driven digital distribution service for gamers, putting the best games, mods and downloadable content from developers at gamers...

Desura Publishing

Desura Publishing

Official group with 178 members, open to all members

Desura Publishing group is a group dedicated to all questions regarding game & mod publishing on Desura. Official features and updates on publishing progress...

Gamieon

Gamieon

Developer with 4 members, open to all members

Gamieon is a small independently owned company devoted to developing innovative and high quality video games.

Gamieon, Inc.

Gamieon, Inc.

Developer Open to all members

Gamieon, Inc. is a privately owned entertainment software development company located in Tampa, Florida. Since October of 2004, Gamieon provides quality...

Team Gamieon

Team Gamieon

Fans & Clans group with 3 members, open to all members

"Team Gamieon" is a community of developers and gamers who are assisting the production of a 3D Physics Puzzle Game called "Dominoze". Gotta knock 'em...

Unity devs

Unity devs

Hobbies & Interests group with 1,069 members, open to all members

For all Unity developers and developers-to-be, both beginners and professionals!

Post comment Comments
ArtisanCodesmith
ArtisanCodesmith Sep 24 2012, 7:38am says:

I'm new to IndieDB and ModDB and wish to invite a few people (random people picked from the online list lol) to view my game and start generating a few opinions, do you mind taking a quick look? The game is called Arkanius. Thanks, Artisan Codesmith. :)

+2 votes     reply to comment
AlexVSharp
AlexVSharp Jan 30 2012, 6:07pm says:

Wow, well written. You should include this article in the Unity Dev's group. ;)

+3 votes     reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Level
Avatar
Avatar
Offline Since
Apr 17, 2014
Country
United States United States
Gender
Male
Member Watch
Track this member
Accolades
Desura
Statistics
Activity Points
923
Rank
2,112 of 446,446
Watchers
5 members
Time Online
13 hours
Comments
17
Site Visits
2,067
Profile Visitors
55,470 (2 today)
Contact
Homepage
Gamieon.com
Private Message
Send Now
Email
Members Only
ICQ
387263084
Twitter

Latest tweets from @gamieon

#papercowboys alpha is almost ready! See details and videos at T.co

Apr 17 2014, 7:31pm

Help make it happen for Develteam - A Community for Indie Game Developers on @indiegogo T.co

Apr 16 2014, 6:20pm

Last one from @Coyotevolants for the night! T.co

Apr 15 2014, 9:09pm

Also thanks to @IsNotShort for #papercowboys art! T.co

Apr 15 2014, 9:02pm

@Coyotevolants thanks for the #papercowboys art! T.co

Apr 15 2014, 8:59pm

New #papercowboys attack: Air Strikes! Historically inaccurate? Who cares! T.co

Apr 5 2014, 9:09pm

RT @mrfiskers: Streaming some Mr. Fiskers dev; actually game-related this time! Wave warnings and balance testing for the demo. :D T

Apr 2 2014, 9:22pm

RT @PlayOtherworld: We've now got a sweet #devlog going on over @tigsource where we can get more in-depth about #Otherworld T.co

Apr 1 2014, 7:16pm

#papercowboys news update: End of round sequence and hawk attacks! T.co

Mar 29 2014, 8:55am

Check out the awesome animated level completion sequence in #papercowboys T.co

Mar 28 2014, 9:13pm

hermesdavidms
hermesdavidms friends since Jan 2, 2011
swiftseraph
swiftseraph friends since Jun 3, 2011
shaulhadar
shaulhadar friends since Nov 29, 2011
Original_Speeder
Original_Speeder friends since Jun 4, 2011
Namelessness
Namelessness friends since Apr 26, 2013
NullSoldier
NullSoldier friends since Jun 4, 2011