+91 9591117915 info@pixtell.net
Unity3D check-in using GIT

gamedev tips unity3d

Unity3D check-in using GIT

Posted By pxteam

Unity 3D is a powerful engine but can get hard to maintain on your local machine. ( A small game can easily run into a gb or more of data ) . The best solution would be to check it into a revision system. yay ! Simple !! ( Bazinga !! , no it aint simple ) .

The whole of Unity project is made of lot of binary files and we all know while we can checkin the files into git ( yes thats what I love to use ) , it can get nearly impossible to diff between 2 revisions. So what do we do now ?

Welcome the .meta files 

Meta files convert or rather keep all the important data related to your prefabs, scenes etc in the form of text files. This helps the process of maintaining it on git easy ( easy to diff , see the idea ? ) .

Unity Editor settings
Unity Editor settings

Some changes to your projects needed.

Go to Edit -> Project Settings -> Editor , launches Editor Settings dialog and make changes as shown.

Choosing a repo : Chose bitbucket ( latest favourite GitLabs ), why ?

  • free unlimited repo’s ( both private and public )
  • Supports git and mercurial ( like git )
  • SourceTree application maintained by bitbucket that provides a visual tool for git ( aah the bliss )
  • Free for upto 5 members ( have a bigger team ? easy to upgrade )
  • Has a wiki and bug tracker part of repo ( wow ! )
  • Get checkin mails
  • Use it to create builds on Unity Cloud

Some roadblocks before doing a first commit !!

Though we have a repo and meta file issues sorted out , the biggest concern is the gazillion files that Unity generates for your project. They are need only to make your project work faster ( the Library folder for example with its huuuuuge cache ). We don’t wanna check that in do we ?

.ignore file to the rescue. git allows the creation of a file called ( .ignore ) which allows one to mention what should not go into a project.

Checkin this file and you are all set. You now have a lean mean project folder that gets checked in to git.

Install SourceTree , clone your repo , RTFM and have a peaceful life with all your code backed up safe !

Read More
Using GitLab with Sourcetree

gamedev tips

Using GitLab with Sourcetree

Posted By pxteam

Gitlab is the new beast in town when it comes to GIT Repositories.

Why is Gitlab so awesome ?

  • Its faster than bitbucket when it comes to pull and commits. ( As the project size increased we found BitBucket to crawl ) . Github is good but costs you for private repos !!
  • Free unlimited Private Repo’s for up to 5 users to collaborate with
  • Continuous build integration ( yet to figure it out for Unity 🙂 )

How to configure Gitlabs with Sourcetree ?

STEP 1 :  First generate the SSH key ( cant use the https way with Sourcetree due to lack of options to connect to Gitlab ).

  1. Log onto GitLab
  2. In the left pane, click Profile Settings.
  3. Click SSH Keys.

You should now see something like this :

SSH screen gitlab
SSH keys screen in Profile settings when you login to gitlab.com

STEP 2: Creating your SSH key on local machine

When you’re prompted to “Enter a file in which to save the key,” press Enter. This accepts the default file location.

At the prompt, type a secure passphrase.

STEP 3: Copy the SSH key into the key text-area in STEP 1.

  1. Open the file ( /Users/you/.ssh/id_rsa ) created in STEP 2 and copy the content starting from ssh-rsa all the way to your email id.  
  2. Add a title , Save and you are done !

STEP 4: Configure your Sourcetree to use SSH and connect to your gitlab repo

1.Clone from URL

Clone from URL

2.  Enter your repo details

cloneRepo_dialog If you enter the right details you will be able to hit the clone button 😉 .

You should be all set now to use Sourcetree with GitLab. Happy #gamedev !!


Read More
Character movement with vectors- Unit Length vectors

gamedev Tutorials

Character movement with vectors- Unit Length vectors

Posted By Kirti P

Character movement with vectors- Unit Length vectors

Normalized Vectors or Unit length vectors are very useful and used everywhere in game development.

Consider the example of Pacman(P) and the ghost, Inky (I). Lets say we want the Pacman to move away from Inky but also keep an eye on Inky. So Pacman wants to face Inky even as he is going down away from Inky. \vec v id the velocity of Pacman in downward direction. We are interested in the vector that pacman is looking along i.e. \vec PI


We learnt in the previous tutorial

\vec PI\vec I – \vec P

Ideally when we store vectors that represent where characters are looking, we use a unit length vector which means the character can face whereever it wants to but its magnitude is one. We are going to denote this unit length vector by

PI^ = \vec PI\mid\vec PI\mid


In terms of x and y coordinates:

PI^ = ( \vec PIx\mid\vec PI\mid ,  \vec PIy\mid\vec PI\mid )

PI^ is always a vector whose magnitude is one.


Read More
Character movement with vectors- Vector scaling

gamedev Tutorials

Character movement with vectors- Vector scaling

Posted By Kirti P

In this tutorial we are going to learn how to scale vectors. A scalar has magnitude (size) only. A vector has both magnitude and direction.

Consider the previous example of Pacman(P). Let us assume that the Pacman is moving along the right with a velocity \vec V.


If we want to double the velocity of Pacman, we should multiply with 2 i.e 2*\vec V . In terms of x and y componets, 2 \vec V = ( 2* \vec Vx , 2*\vec Vy).

We can also half the velocity, in which case  \vec V /2 = (  \vec Vx /2 , \vec Vy /2).



Read More
Quick Distance comparison

gamedev Tutorials

Quick Distance comparison

Posted By Kirti P

Quick Distance comparison:

In this tutorial, we will learn how to quickly find out the shortest distance comparison. We add a new character to the previous example Blinky (B). The goal is to find out If Inky(I) is closer to Pacman(P) or Blinky(B).



Using the vector length calculation, we are going to compare the length of the vector \vec IP with the length of vector \vec BP

Applying Pythagoras theorem to calculate the length, we have

\mid\vec BP\mid=\sqrt{\vec BPx^2 +\vec BPy^2}   (compare\mid\vec IP\mid=\sqrt{\vec IPx^2 +\vec IPy^2}

where Compare means we are trying to find out if |BP| is bigger or |IP| is bigger.





Eliminating the square root on both sides by squaring, we have:

\vec BPx^2 +\vec BPy^2   (compare)  \vec IPx^2 +\vec IPy^2

Rewriting these in the original form:

\mid\vec BP^2\mid  (compare)   \mid\vec IP^2\mid

This factor is faster computationally to compare the lengths, rather than the vectors themselves.



Read More