Wednesday, April 22, 2015

Check for Network Connection Unity3d

Two type of devices are their when concerning about Network Connection,

  • Hand Held Devices - iPhone, iPad, Android, Windows Phone, Tablets etc.
  • Non Hand Held Devices - PC, Mac, Linux etc

There are various aspects need to keep in mind when checking for network connection in unity3d development environment.

Unity provides various classes to do so, some of those are listed below with best suitable example for that, hope this might get some relief..

Application.internetReachability can be use to check current reachable type, this can be use on all kind of device including hand held devices, this returns a member of an enum NetworkRechability, Bare in mind that this only checks all possible network connection on device but not guaranteed that device is connected to the internet. 

This can be use to distinguish whether device is connected via high speed wifi/local area network or using packetdata/career data network


Below are all network reachability options that NetworkReachability enum have,
  • ReachableViaCareerDataNetwork
  • ReachableViaLocalAreaNetwork
  • NotReachable


Usage Example:

using UnityEngine;
using System.Collections;

public class NetworkManager : MonoBehaviour

{
public static bool IsInternetConnection()
{
bool isConnectedToInternet = false;
if(Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork ||
   Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork)
{
isConnectedToInternet = true;
}
return isConnectedToInternet;
}
}


To check for Internet Connection,

IEnumerator CheckForConnection() 
{
      Ping png = new Ping("139.130.4.5");
      float startTime = Time.time;      
      while (Time.time < startTime + 5.0f)       
     {         
            yield return new WaitForSeconds(0.1f);      
     }
      if(png .isDone)      

     {
           print("Connected!");  
     }     
     else    
     {    
            print("Not Connected!");
     }
}

Friday, February 20, 2015

Create Windows Installer for Unity3d


Here easy steps are shown to create Windows Installer(formerly knows as Microsoft Installer) for your Unity game,


Tool to Use:

Inno Setup

You can easily download free installer from here,

Prerequisites:

1. Needed working windows build of your game which includes *_Data and *.exe files
2. Inno Setup


Steps:

1. Install Inno Setup with default settings


2. Launch Inno Setup

3. Create a new script file using the Script Wizard and press OK
The first time you open Inno Setup it will ask to create Script using Inno' powerful script wizard,
You just need to create New Script using it,

4. Click Next





5. Fill all the necessary information and click Next




















Most options of setup wizard are optional, so you can leave whichever don't suits you,

 6. click Next

7. Brows and add Application main executable file, also add parent folder to Other application files,  this is as in unity there exists one more file with main executable file named *.Data



















8. On adding parent folder it will ask for conformations, select Yes in it











9. Now select options whichever suits you and click Next




















10. If you have application documentation then browse and add in next option otherwise leave those as it is and click on Next




















11. Inno Setup also supports multiple language, you can specify it in next option, specify all languages you want to include in your setup and click Next



















12. Select the folder where you want to store the setup file and click Next



















13. In last it will ask to add Inno Preprocessor, this is for internal use only, just check Yes and click Next



















14. Finish



















15. It will prompt for compilation, click Yes












16. Also ask for saving script you have created, click Yes












17. Now you can see script compilation process, just wait for a moment and your Unity game is ready to install

















Just install and ...have fun! 



Tuesday, September 9, 2014

Draw Call and FPS

         Performance is the crucial thing while you are dealing with game development for hand held devices! Before going optimized and performance oriented game development, one should understand key terms for measuring device performance. The major unit(yes we can say Unit) for device performance is FPS and Draw Call


FPS:

         FPS is Frame Per Second, time taken by device CPU to complete one frame. Human eye can see about 30 framers per second. So for smoother game play generally it is set to 60 for all Android, iOS and other mobile platforms so that graphics and all visuals are visible in high quality. So as a game developer one should try to achieve 60 FPS for game.


Draw Call:

         Draw Call is another unit that is concerned with device GPU(Graphics Processing Unit) directly. They are generated each time the CPU has to send data to the GPU for processing. Draw call can be stated as no of calls that GPU need to made to render an image/texture or mesh. The higher draw call the higher GPU call is made which results in higher power consumption. Higher draw call might also reduce FPS but this is not compulsory.

Saturday, August 30, 2014

Best Practice for Game Development

Hello developers,
           Here i am sharing game development phases that one should go with, Especially for indie game developers and studios.




           If you are planing to being game developer then their are lots of factors you should keep in mind, as being a game developer is not as easy as playing a game. It is inverse it.

Key phases for game development,


1. Market Research


           Before planning for any kind of game development one should make some research on current game trends, game user audience, game platforms etc. This would help a lot for your game and make you more clear what should you choose for your game.

         For example: If their is currently trend of 2048 kind of game then you can either go for same game development or similar kind of game development, so that you can easily redirect 2048 game users to you game and make money. Or if you are planning to rock the game market then you can choose your own concept and make it on stage. Its up to you how you are going!

Area of Research:

1. Current market trends
2. Targeted audience and country
3. Targeted platforms
4. Game category and scope
5. Age group

2. Game Design

           Game design is the main factor after market research if you are planning to develop a game, and it is ignored by most of indie game developer but i recommend to spend much time on designing a game rather planning for other stuffs. The more effort you made on designing the game the less effort would required on developing and marketing your game.

           For example : If you are planning to do like Subway Surfer like endless runner game then you will probably gathers basic requirements for your game and start development but in between of actual development if you will find more entertaining game then Subway Surfer then probably you would change your game design and this will result in delay of your product as well might be costly to packet.

Topics covered in game design:

1. Game story/Game concept
2. Game category
3. Game play and HUD design
4. Power ups
5. Future update
6. Dealing with developer team
7. Game engine selection and limitations
8. Multiple platform support
9. Marketing scenario

3. Graphics Development

           Once game design phase is completed the product would come in development phase, here it will come in graphics and UI development phase.


           If game is 3d then it would come in animation/model development and this would start your actual product development.

           Graphics development is very important part of your game as graphics is the one who makes first impression when you game is released. If game is containing eye catching graphics then use would probably download and play your game at least once.

4. Game Programming

           This is where your product is got rigged. Yes game programming is the phase where product is actually got rigged and lead to playable game.

           Game programming phase is one of most expensive phase of game development. Previous three phase would be gathered and programming team starts on product development. The more effort on programming makes product more engaging. This is where programming team is adding Physics, Animations, Event system, Third party tools, VFX(particles and all) and Sounds.

           Once game is downloaded journey is not stooped here, it is started actually. User would only sticked to game he/she found something engaging or unique in game otherwise he/she will simply uninstall game and never recommend others to play it. If he/she will found something engaging or unique in game they game would be played and also recommended to others. That would result in inter user marketing and of course that makes your pocket heavy.

5. Game Marketing(App Store Optimization)



           Once your product has been developed, tested and released successfully this phase starts. This is where your actual journey starts! Yes it is, your game is containing pretty and eye catching graphics, is has been executed nicely on game programming phase but if there is no marketing there is not installs of your game.

           This is where most of indie developer/studio got punched,  their are lost of game stores/portals are available, their are millions of games/apps on the game market, hundreds of game are released per day.. Out of them where your game would be ? Area of thinking.. Like any newly released website for game also their would require lots of marketing to attract user to download and play the game.


Marketing Agenda and Type

1. Social media marketing
2. Google AdMob or other advertiser platform 
3. Video marketing
4. Inter game or Inter user marketing
5.  Content based marketing

Tuesday, August 26, 2014

Getter and Setter in C# Unity3d

C# Unity has support for Getter and Setter properties which is very important in terms of Object Oriented Programming, Here is a simple example of Getter and Setter properties which shows its usefulness,
Without getter and setter properties:
  1. public int getX()
  2. {
    1. return x;
  3. }
  4. public void setX(int newX)
  5. {
  6. if(newX < 0)
  7. x = 0;
  8. else
  9. x = newX;
  10. }
To change the value of x you have to write like
  1. setX(getX()+4);
With getter and setter properties:
  1. public int X
  2. {
  3. get { return x; }
  4. set
  5. {
  6. if(value < 0)
  7. x = 0;
  8. else
  9. x = value;
  10. }
  11. }
Now in this case you can easily change value of x with 
  1. X += 4;
Getter and Setter is very usefull properties of C# programming language and can be utilize interestingly in Game Development also in Unity3d.

To know some basic but important key points about C# programming language go HERE,


Some basic use of these properties listed below,

1. Flexible way to get and set values conditionaly.
2. Works great with Unity3d Transform and other Vector properties.
3. Use mainly in Score/Health calculation/computaion etc.

Popular Posts