Categories
PC Nerding

Git and Unity3D

2012/08/11 Update: This post assumes you are able to set up and configure correctly a Virtual Machine. I strongly reccomend to follow my newer tutorial on the subject, Git, Unity3D and Dropbox, which is simpler.

This is not intended to be a tutorial for the masses, but it’s a list of things i did to set up a new Unity3D project and it’s relative Git repository. I made it for myself reading a bunch of other people’s tutorials, i don’t expect others understanding this. It also requires a bit of previous knowledge using linux shell, ssh and git.

Starting off, here are the tools you will need:
-I’m using Windows Vista Ultimate, so consider the first part Windows only.
Unity3D
Git. I suggest installing Git from the official installer wich adds Git commands in your context (=right click) menu.

First, create a new empty folder, in this example i will use:
C:\Users\USER\Documents\Unity\MyNewProject
Where USER is your Windows username. You can use any path you want, just remember where it is located.

Start Unity3D and then make a new project inside the folder we previously created.
Go to Project-Settings>Editor and under Version Control>Mode selects Meta Files.
Save an empty scene or import your assets and then close Unity3D.

Get back to your project folder and add a .gitignore file with this list (obviously stolen from another tutorial linked here, hope the original author doesn’t sue me 🙂 ).

#Folders
/Library
/Temp
/Builds

#Project/User Preference Files
*.sln
*.csproj
*.pidb
*.userprefs
*.user
*.suo

#OS Junk
Thumbs.db
.DS_Store*
ehthumbs.db
Icon7

Right click inside your folder window and select Git Init Here. After that, right click a second time and click Git Bash, this will show you a terminal like window.
Run the command
git add . (NOTE: dot included)
this will add all your files, excluding those defined inside .gitignore, to your repo.
Running
git status
will show you a bunch of files that will be added to the repo.
You can make your first commit running this command
git commit -m “Initial commit”
Running
git status
again will show you that there’s nothing else to commit.
From here, just use it like any other Git repo. I’m pretty new to Git, see git’s official docs to see on how to use it as my advice could be really bad ones 😛 .

Part2: Sharing on LAN
Ok, now that’s your local repository, working like a charm on your machine. But what if you want to make it available for all your computers? The best solution i found was using a lan git server inside a virtual machine. Now you can dowload your favourite linux/server distro and install it on your virtual machine, install git-core, openSSH and a bunch of random packets. But I always prefer the easiest way, and i suggest you to download Revision Control Appliance from TurnKey, wich happens to have git, openSSH and a lot of packets already configured and working out of the box. I personally use it in VMware Fusion on my Mac, but it can be used with VirtualBox or the free VMware Player on your pc, there’s absolutely no difference, just make sure the VM’s network is set to Bridged Mode.

Let’s see the steps we need to get our git server running.
First, download the virtual machine from TurnKey website.
Unzip the content in a folder you like (eg. your Virtual Machines folder) and run the machine.
On first run it will you to set a root password, choose one you like and remember it or write it down.
After that the vm will show you a screen containing the vm’s ip and a bunch of addresses for various services. Once you see this screen you’re done, write the machine’s ip somewhere, you will need it later.
Minimize the vm (without pausing or quitting it, we need the server running).

Now we need to create a bare repo for our project inside the server.
Get back to your main pc and SSH the server (this can be done from your Git Bash or any other SSH programs like putty), in my case the command was
ssh root@192.168.0.16
you will have to use the ip of your virtual machine. It will ask for a password, that’s the one we set on vm’s first run.
Navigate to git repository and make a new folder for our project, cd to it and make a new bare repo. In short:
cd /srv/repos/git/
mkdir mynewproject.git
cd mynewproject.git/
git –bare init

It should tell you Inizialized a new empty Git repo on /srv/repos/git/mynewproject.git/. Remember this line.
Logout from ssh.
From your Git Bash, make sure you’re still in your project folder and add the remote repository using this command (remembering to change ip and project folder):
git remote add origin ssh://root@192.168.0.16/srv/repos/git/mynewproject.git
Now push your local master copy to the server
git push origin master
Will ask for a password, wich is still the same we used for SSH access.

Part3: downloading a clone from your LAN Git Repo
Tested this using both Windows Git and Mac’s GitX
Using Git Bash or OSX’s Terminal, move to a folder you like and send this command:
git clone ssh://root@192.168.0.16/srv/repos/git/mynewproject.git
And you will be done. 😀

I didn’t test this deeply, maybe there are flaws here and there, but it’s a solution that’s works, at least on my machines.

Categories
PC Nerding

Expanding my reach: Mac OS X

Since i started using Unity3D last October, my will was to test my not-released games on every device i had. This was limiting me to Webplayer and PC only, but then Unity team offered for free both Android and iOS licenses and i got my chance to test apps on my old HTC Desire. But I felt it was not enough, so i decided to add a Mac to my desk and bought a not-so-cheap MacBoo Pro 15″, an used Mid 2010 model, with dual core i7 2.66GHz CPU, 4GB ram and NVIDIA GeForce GT 330M video card.
I personally prefer to use Windows for my programming needs, but having a Mac could help learn and test new things.

Next step? An iPhone and/or an iPad. Then a Ferrari 458 Italia. 🙂

Categories
PC Nerding

How to add Minecraft to your Xfire/Raptr

If you play Minecraft and you want to track your playtime, here’s how.

XFIRE
Please note that i just found it in Xfire official forum (this page).

First, locate your Xfire’s games list “xfire_games.ini”, usually found in C:\ProgramData\Xfire, then add this code to the list.
[6216_4]
LongName=Minecraft
ShortName=mcrft
PlayingDetectType=ByWindowSubstr
ProcessWindowTitle=Minecraft
ProcessWindowClass=SunAwtFrame
LauncherDirDefault=C:\Users\%USERPROFILE%\AppData\roaming\.minecraft\
LauncherExe=Minecraft.exe
DetectDirDefault=C:\Program Files\Java\jre6\bin\
DetectExe=javaw.exe
Launch=%UA_LAUNCHER_EXE_PATH% %UA_LAUNCHER_EXTRA_ARGS%
InGameRenderer=OGL
InGameFlags=USE_PRESENT|ENABLE_MOUSE|DISABLE_64BIT|USE_DINPUT_MOUSE
InGameDelay=10000

After that, make a copy of Minecraft’s exe into “C:\Program Files\Java\jre6\bin”. If still doesn’t get detected, try adding it manually trough Xfire options and it should work. Or, at least, it worked for me.

RAPTR
Raptr official forums
To get Minecraft detected by Raptr, create a folder called Minecraft in your Program Files folder and copy the exe inside it. The final path should be “C:\Program Files\Minecraft\Minecraft.exe”. Then make Raptr rescan your game list.

A final note. There’s no need to launch the game from one of those paths, i launch the game from a third copy inside my Documents folder and both program detect it.

UPDATE Oct 26,2012: As Doug pointed out in comments, if you’re using a 64-bit OS you must have Java 6 64-bit installed. Java 7 won’t recognize the game.