Sunday 9 April 2017

Alien Invasion - my first mobile app

I always wanted to write a game but after a couple of failed attempts I realized I was trying to do too much and the scope was just overwhelming so I stopped each time. They were essentially clones of games I like to play, a dungeon crawler and civilization style turn based strategy.

Watching this Unity3D Tutorial about Minimum Viable Product and also reading about Ludum Dare made me focus on just getting something done. 2 days to write a game? Challenge Accepted.

For the impatient, here is the final app on itch.io and the Google Play Store for Android devices:

Get it on Google Play

Day 1

What game to write?

Firstly what to write. We go down the pub most Friday lunchtimes at work and that's where a lot of ideas are generated (no often great ones but nevermind). Watching the USA Elections unfold from the comfort of the UK has given us the impression that Trump just wants to remove all Mexicans. Something about a wall, I don't remember the details. We joked about a game where Mexicans cross the border and you have to put them back into Mexico as fast as you can. OK, so it's not politically correct but I was kind of making a joke out the whole thing so I went with it. This was my first major mistake but it wasn't until later on that I realized it.

Which game engine to use?

Next what to write it in. I'm a C# programmer by day with my training in C++. That opens up a lot of gaming engines but my love of C# directed me towards Unity3D. All my previous failed attempts were also in Unity3D but I saw that as an advantage since I already had it installed and knew a bit about it.

What is the main game-play mechanic?

The I wrote out a basic game play on a piece of paper, together with a sketch:

  • Enemies appear
  • Move from South to North
  • Drag them back to the South to score
  • More appear faster over time
  • Game ends when a certain number stay in the North

Create (Google for) graphics assets

That's the game play sorted, next for an asset list, no more than I needed:
  • Map of USA and Mexico
  • Enemy
I went to Google in search of an image for the USA and Mexico and this is when I started to deviate from the Minimum Viable Product mantra. I found a great public domain (ok to reuse) SVG of North America:
BlankMap-Americas
SVGs I thought. That would solve the problem I hadn't had yet about how to nicely scale the graphics to fit any device resolution. I'd bought the excellent Unity3D asset SVGimporter a while back for a previous failed project.


Next I need an enemy, something to drag back to Mexico to score a point. I love the Icons8 website and I'd bought their SVG icon set for development a while back. I see that they have now added a Trump icon but I didn't have a license for the SVG so I couldn't use it, but they did have a great Mexican Hat icon so I used that:

Start Unity3D

Primed with the game idea, the mechanics and the graphics I confidently started Unity with an empty project and went to the asset store to download the latest version of SVGimporter so I could get going.

Failed at the first hurdle. It seems that the latest version of Unity3D (5.6.0f3) has broken the SVGimporter asset. Actually looking at the forum it appeared to break a while ago. I diligently logged it to the developer and then installed an older version of Unity3D (5.4.5f1) as I didn't want this to stop me, I only had 2 days to finish this.

This lost me valuable time uninstalling and reinstalling Unity3D version but finally I was able to import my assets. Then I was presented with a choice. Import them as UGUI, Transparent or Opaque. I'd never done anything with Unity UI before so I thought, how hard can it be, and went with UGUI for everything. Ooops. I regretted this on day 3. I know it was a 2 day project but in the developer world 2 days always means at least 3 days, possibly 2 weeks!

End of Day 1

After aligning the graphics and adding some simple drag and drop functionality I had a working prototype. The map scales as you hover an enemy over it using the free Unity asset LeanTween:


As you can see I already begun a bit of scope creep but I felt that they were needed:
  • Start Button (which slides of the screen using LeanTween again)
  • Spawn Point for the enemy to start at (Tent from Icons8)
  • USA and Mexico flags with Scores (public domain from Wikipedia again):
Flag of Mexico Flag of the United States

I finished the day pleased with myself for getting a working prototype.

Day 2

Sound Effects

I was dreading this. I have never done any coding (beyond beeps on the ZX Spectrum) that involved making sounds of any kind. Again I went to Google in search of sound clips that I could freely reuse and it took a lot longer than I thought it would. I was in option paralysis, unable to chose which of the many samples to include for different effects.



In the end I settled for these from FreeSound.org, after procrastinating for over two hours...

'Pop' sound effect for scoring a point:

'Let's Go' sound effect for starting the game:

'Footsteps' sound effect for the enemy advancing:

'Lose' sound effect for game over:


Music

I wanted a song that didn't have any copyright issues so I went for the classic Mexican Folk Song and La Cucaracha. I found a piano tab of it on tabsby.net which had a download MP3 button.

Thankfully playing a song or a sound clip is exactly the same in Unity3D so I just had to learn about the difference between AudioSource and AudioClip and I was done.

Google Play Store

I finished my game in Unity and tested it on my son's Motorola G3 (Android 5.1.1) and it all looked good so I decided to publish. I registered as a Google Play Store Developer and paid my $25, excited to be publishing my first App. Here is a screen shot of it:


It was a fairly painless process and within about 2-3 hours my app was available on the Store. I emailed a few friends and asked they to try it out. The reports were all the same. It's very hard to drag the hats as they're really small. It turns out that the Moto G3 resolution is 1280x720 but the Samsung Galaxy S7 is 2560x1440 and my app didn't handle that.

End of Day 2

End of the second day and I'd acheived a lot. I'd added sound to the game, deployed and tested on a real Android phone and to my amazement it all worked and navigated the Google Developer registration and uploaded my first APK and had it published. Success, albeit with some issues.

Day 3

Making it Resolution Independent

I went back to Unity3D tutorial videos and learnt how Unity UI anchor points worked and how to add new resolutions and aspect ratios into Game window in Unity to see how the game would react on different devices.

It didn't take too long and then I had another version of the app, version 2, which fixed the resolution issues and I uploaded it to the App Store, again pleased with myself that I'd not only shipped but I'd also fixed the bugs that were reported and uploaded a new build to the Google Play Store, something which I thought would be a formality.

And then I got an email from Google...

Hate Speech


What? All I'd done was change the UI so it scaled properly. Where did this come from? 
Hi Developers at Arlorean,
After review, Border Patrol, com.Arlorean.BorderPatrol, has been suspended and removed from Google Play as a policy strike because it violates the hate speech policy.
Next Steps
  1. Read through the Hate Speech policy for more details and examples of policy violations.
  1. Make sure your app is compliant with all policies listed in the Developer Program Policies. Remember additional enforcement could occur if there are further policy issues with your apps.
  1. If it’s possible to bring your app into compliance, you can sign in to your Developer Console and submit the policy compliant app using a new package name and a new app name.
Additional suspensions of any nature may result in the termination of your developer account, and investigation and possible termination of related Google accounts. If your account is terminated, payments will cease and Google may recover the proceeds of any past sales and/or the cost of any associated fees (such as chargebacks and transaction fees) from you.
If you’ve reviewed the policy and feel this suspension may have been in error, please reach out to our policy support team. One of my colleagues will get back to you within 2 business days.
Regards,
The Google Play Review Team
Hate Speech
We don't allow apps that advocate against groups of people based on their race or ethnic origin, religion, disability, gender, age, nationality, veteran status, sexual orientation, or gender identity.
Something that was a bit of fun and a chance to learn about Unity programming and Android Apps, had suddenly gone to DEFCON 1. Once your app has been suspended you can't see anything about it anymore so there's no way to work out what the problem is. You can't download it or update it, it's just gone and there's nothing you can do about it.

Politically Correct Graphics Update

So. I'm surprised at what's happened but I guess it's my own fault. I thought the concept would be funny and harmless but Google didn't. I set about changing the graphics so that it wouldn't offend anyone:
  • The Hat was replaced with an Alien
  • The Flag was replaced with a Planet
  • The Tent was replaced with a Rocket

I uploaded this new version with a new name, Alien Invasion, since you can't use the same name once it's suspended. A few hours later I checked the developer console and it had been published:


Lesson Learned

What seems harmless can get you into a world of trouble. Be careful what you publish and try not to offend anyone. Stick with space aliens and you should be fine.

No comments:

Post a Comment