Wednesday, April 1, 2015

How to integrate Admob into Unity Android Build

I am using MacOS Mavericks, Unity 5 Personal Edition and GooglePlayService Rev 23 and Eclipse Juno.
For integrating Admob into Unity iOS see this post.

Download Unity plugin from here:

https://github.com/googleads/googleads-mobile-plugins/releases

At time of writing the latest  is Google Mobile Ads Unity Plugin v2.2

Download it and import to unity after creating a Plugins folder in Assets.

Insert the necessary code to call your Admob Banner and Interstitial ads. For me I wrote a custom script called AdsController.cs:

using UnityEngine;
using System.Collections;
using GoogleMobileAds.Api;
using System;  // For EventArgs

public class AdsController : MonoBehaviour {
   
    InterstitialAd interstitial;
    BannerView bannerView;

    void Start () {

        
//------ Banner Ad -------
        // Create a 320x50 banner at the top of the screen.
        // Put your Admob banner ad id here
        bannerView = new BannerView(
            "ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx"AdSize.SmartBannerAdPosition.Top);
        // Create ad request
        AdRequest request = new AdRequest.Builder().Build();
        // Load the banner with the request.
        bannerView.LoadAd(request);
        
        bannerView.Show();

        
//---- Interstitial Ad -----
        // Initialize an InterstitialAd.
        // Put your admob interstitial ad id here:
        interstitial = new InterstitialAd("
ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx");

        //Add callback for when ad is loaded
        interstitial.AdLoaded += HandleAdLoaded;

        // Create an ad request.
        AdRequest requestInterstitial = new AdRequest.Builder().Build();
        // Load the interstitial with the request.
        interstitial.LoadAd(requestInterstitial);
    }
    
   

    public void HandleAdLoaded(object senderEventArgs args) {
        
        interstitial.Show ();
    }

  
    void OnDestroy(){
        if (interstitial!=null) {
            interstitial.AdLoaded -= HandleAdLoaded;
            interstitial.Destroy ();
        }
        if(bannerView!=null){
            bannerView.Destroy ();
        }
    }

}


Put the script above in Game Over scene, or, Level Cleared scene. So that when the scene loads, the banner and interstitial ads get called and shown at the same time.

Open Eclipse Android SDK Manager and download the latest Google Play Service SDK:


Then copy and paste the google-play-services_lib folder located at ANDROID_SDK_LOCATION/extras/google/google_play_services/libproject,  into the Plugins/Android folder of your project as shown circled in red below:



Then modify the AndroidManifest.xml file shown above circled in green as follows:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" 
package="com.site.myappnameandroid:versionName="1.0android:versionCode="1">
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" 
  android:xlargeScreens="trueandroid:anyDensity="true" />
  
  <!-- Google Mobile Ads Permissions -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    
  <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false">
    <!-- meta-data tag for Google Play services -->
    <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
    <activity android:name="com.unity3d.player.UnityPlayerProxyActivity" android:label="@string/app_name" 
    android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" >
    <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
    <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" >
    </activity>
    <activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" >
      <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
      <meta-data android:name="android.app.lib_name" android:value="unity" />
    </activity>
    <activity android:name="com.unity3d.player.VideoPlayer" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" >
    </activity>
   
  </application>
  <uses-feature android:glEsVersion="0x00020000" />
  <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="19" />
</manifest>


Make sure you do not add the Ads Activity because it is already included in the GooglePlayService Lib manifest file and will be merged with AndroidManifest.xml above during build.

Next, build the Unity Android .apk file  with the player setttings shown here (on right side of screen):



Transfer the apk to your android phone/tablet and run.



Thursday, March 26, 2015

Power Ups

Power Ups can be:

1. Coin type
2. Kill all enemies
3. Invincibility
4. Strike
5. Powerup Magnet
6. Set Checkpoint
7. Next Checkpoint
8. Restart Checkpoint

Tuesday, March 24, 2015

Game Mechanics, Dynamics and Aesthetics

What is the difference between Game Mechanics,  Game Dynamics and Game Aesthetics?

Game Mechanics are the rules of the game.

Game Dynamics is the direction or resulting effect of the Game Mechanics.

Game Aesthetics is the experience of the player based on the Game Dynamics.

For example,  certain game mechanics might reward a player with power ups including shields.
The resulting dynamics is that the player is invincible and can defeat enemies easily (positive feedback loop). The aesthtics is the feeling of satisfaction and accomplishment on defeating the enemies.

Certain schools of thought in Game Design advocate starting with Aesthetics then work backwards to Dynamics then back to Mechanics. For example, first ask yourself, what sort of Player experience/feeling do I want the player to have?  Is it accomplishment, anger, fear, greed, friendliness?  Then find out what sort of Dynamics can bring that feeling/experience? Then determine what sort of mechanics can bring about those Dynamics.

So, designing game is designing experience.

A formal definition is:


Mechanics describes the particular components of the game, at the level of data representation and algorithms.
Dynamics describes the run-time behavior of the mechanics acting on player inputs and each othersí outputs over time.
Aesthetics describes the desirable emotional responses evoked in the player, when she interacts with the game system. 

MDA : A Formal Approach to Game Design and Game Research

Monday, March 23, 2015

How to Design Better Games than your Competitors'

Study your competitors' games.

Jot down what you like and what annoys you.

Design your game based on your competitors but leave out the annoying and improve on the parts that you like.

Saturday, March 21, 2015

Quick and Dirty Prototyping

Here's a good article on Quick and Dirty Prototyping

Basically, use placeholders to represent artwork. Get the playtesting done early and repeatedly.
Don't put in high quality graphics until the very end - to avoid Asset Guilt.




Graphic Assets

Where to get graphic assets? Below are some sources.

1.  Super Pixel Time

2. Open Game Art Tutorial

3. Making Pixel Art Tutorial

4. Graphic River

5. Construct2 Art Shop

6. Graphic Buffet

7. Open Game Art

8. Atelier Store


Game Themes and Styles

What is the difference between Themes and Styles?

Themes:

   1. Fantasy

   2. Seasonal

   3. Racing

   4. Zombie


Styles:

   1. Minimal

   2. Pixel

   3. 2D

   4. 3D

   5. Isometric

   6. Retro

   7. Arcade

   8. Realistic

Tuesday, March 17, 2015

List of object types


Based on Buildbox object types:

1.  Object - other non player objects

     a. Platform

     b. Physics Object

     c. Enemy

     d. Enemy Bullet

     e. Character Bullet

     f. Decoration

    g. Wheel

2. Character - the player

3. Action

4. Background - sky, mountain, ground



General 2D Gameplay Categories

This list is based on Buildbox Gameplays:

1.  Avoidance

2. Side Shooter

3. Impossible

4. Motorcross

5. Shooting Runner

6. Runner

7. Platformer

8. Downward Bounce

9. Sticky Jump

10. Helicopter

11. Flappy

12. Jumping

13. Racing

14. Dogfight

15. 360 Shooter

List of 2D Gameplays

If you run out of ideas, here is a list of 2D game mechanics you use by itself or, mix and match to design new 2D games. It is modifed from Trey Smith's original list in his Build Box Game Challenge Day 3-4:

1. Dogfighting

2. Simple Jumping

3. Complex Jumping

4. Air Jumping

5. Top Down Racing

6. Flappy

7. Float

8. Avoidance

9. Finger Avoidance

10. Slide Avoidance

11. Touch To Move Avoidance

12. Platform Fall

13. Float Fall

14. Side Shooters

15. Space Shooters

16. Impossible

17. Runners

18. Jumping Runners

19. Shooting Runners

20. Indie Runners

21. Bouncy Motor?

22. Extreme Motor

23. Downward Platformers

24. Hardcore Platformers

25. Adventure Platformers

26. Jump Platformers

27. Simple Helicopters

28. Complex Helicopters

29. Elevator Platformers

30. Downward Bounce

31. Sticky Jump

Saturday, April 19, 2014

Make a Zombie in Blender for Unity games : Part 5 (Unity test)


Export to unity, create animation controller and test.

Make a Zombie in Blender for Unity games : Part 3 (Animation)


We create the animation clips Idle and Walk.

Make a Zombie in Blender for Unity games : Part 4 (Texture Paint)


In part 4, we shall UV unwrap the mesh, then texture paint the mesh, create materials and texture and assign to the mesh. Finally test render to see the results. In next part, we shall import to Unity.

Make a Zombie in Blender for Unity games : Part 2 (Rigging)


In this part, we add bones to the mesh, parent the mesh to the bones, fix any problems on deformations using weight painting.

Make a Zombie in Blender for Unity games : Part 1 (Modelling)


Simple low-poly zombie model for use in Unity. This series will document how I create a zombie. Videos include modelling, rigging, texture painting, animation, importing into Unity and testing.

Wednesday, January 22, 2014

Zombie Gold Run



Celebrate Chinese New Year with a Horse who runs in a temple collecting gold.

Celebrate Chinese Lunar New Year of the Horse with this Running Game.
The Horse has entered a ancient Chinese Temple and is running around to collect
Gold bars. He meets many challenges - avoid the fireworks and the Jiang Shi Zombie.
Collect the health kit to top up health and collect the Jade Talisman to get
shield.

Wishing you a very Happy and Prosperous New Year (Gong Xi Fa Cai Xin Nian Kuai Le)!






Sunday, January 5, 2014

Chinese New Year Horse


Celebrate Chinese Lunar New Year of the Horse with this game.
This cute horse can sing you Gong Xi Gong Xi song and also play a game of 
catch the Hong Bao (Red Packet), whilst avoiding the fireworks.

Wishing you a very Happy and Prosperous New Year (Gong Xi Fa Cai Xin Nian Kuai Le)!




Friday, December 20, 2013

Talking Christmas Penguin


How about a talking, singing, dancing & joke-telling Penguin for Christmas!

This cute Penguin talks to you and asks you if you like to hear it sing Christmas songs
and tell Christmas jokes. You can reply Yes or No and it will obey your command.  It can 
sing many Christmas carols for you and also dances to the beat while singing. 
Let it tell Christmas jokes and be prepared for some good merry laughs.

It will also ask you if you are happy and will react to your feelings. 

Let this lovable Penguin into your home and celebrate Christmas together!







Saturday, December 14, 2013

Singing Obama Christmas


Obama singing and dancing in the snow in front of the White House.
Control dance movements while Obama sings Christmas carols.
Songs include Jingle Bells, Auld Lang Syne, Deck the Halls and more...
Merry Christmas and Happy New Year!


Scan QR code below if you are reading this webpage and have a phone or tablet ready:




Sunday, December 8, 2013

Singing Santa


This cute and lovable 3D Santa Claus sings Christmas carols to you while you control the dance 
movements by tapping on the dance buttons. Provides loads of laugh and memorable Christmas 
experience for the family, friends and loved ones. Songs include Jingle Bells, Rudolph the 
red-nosed Reindeer, Auld Lang Syne, Deck the Halls, Joy to the World and more... 
Good for parties too!