Monday, August 24, 2015

A Linux VirtualBox for Steam

Over the course of this year, I've had to re-create a virtual machine running Linux with OpenGL support three separate times.  The first two times, it proved to be a minor nightmare of searching through forum posts trying to find the right combination and order or library installations to make it happen, and I wasn't confident enough in what I actually did to try to write it down as the canonical method.  But this third time, the whole process went smoothly, and so I'm going to record it for posterity (read: me in a year).

This process will get you a virtual machine running Ubuntu Linux 14.04 LTS 64-bit, with enough OpenGL support that Steam will correctly install and run games built in Unity.  It won't necessarily run them fast, but they will run.

  1. Download and install Oracle's VirtualBox.  At the time of this writing, I used version 5.0.2 on my Windows 7 machine and test build 5.0.3-102290 on my Windows 10 machine.
  2. Create a new virtual machine.  It should be set for Linux, Ubuntu 64-bit, and the following:
    • 16Gb virtual hard drive (or more)
    • 2Gb RAM (maybe more, maybe less, but this is ideal)
    • 128Mb video memory (the max VirtualBox supports)
    • 3D acceleration checked
  3. Get Ubuntu 14.04 LTS 64-bit.  Download the ISO image from the website.
  4. Start up the virtual machine.  When it asks you for a startup disk, point it at the Ubuntu ISO.
  5. Use the standard install options, and ideally download updates along with the installation.
  6. Once installed, update once again with the latest updates.
  7. Install the VirtualBox Guest Additions.  In the VirtualBox window, go to Devices -> Insert Guest Additions CD Image
    • Make sure to reboot after this installation
  8. Now you should be able to go to the display settings and set the window size to something better than 800x600.
  9. Install OpenGL library dependencies.  This step is rather undocumented.
    • Open a command prompt/terminal.  Use Ubuntu's "Search your computer" icon at the top of its system bar and enter "terminal".
    • Run the following: sudo apt-get install libglapi-mesa libcheese7 libcheese-gtk23 libclutter-gst-2.0-0 libcogl15 libclutter-gtk-1.0-0 libclutter-1.0-0  xserver-xorg-input-all
    • Source
  10. Install Steam.  Go to the website in the virtual machine, download and run the Linux installer.
    • The Steam package downloaded from the site will install an actual Steam installer.
    • Running that installer will prompt a terminal window to install further OpenGL dependencies.
    • After all of that is installed, the normal Steam client will install and update
At this point, Steam should be ready to log in, and you can proceed as normal.  Log in to your account, install the games you wish, and test.

Tuesday, July 14, 2015

Blender editor script for Unity

We've been doing a lot of Unity development recently, and one of the things we find really awkward about it is its Blender support.  Unity's preferred axis doesn't match Blender's, in particular.  We've been using an editor script to help this, which I figured I'd post below.  It does the following things:

- Defaults to not importing materials.  It seems to cause a mess more than anything so we create these by hand.  This is easy to disable if you don't like that.
- Swaps the Y and Z axes so that up in Blender is also up in Unity, and fixes the right/left thing with the X axis.
- Adjusts coordinates so that the Blender object's origin ends up 0,0,0 in the imported mesh.
- Lets you ignore a mesh by putting _ at the start of its name.  For example, an object in the Blender file named "_reference" would not be imported.

We've been using this for static models and it's generally behaved well.  To use, copy/paste the below into a file called BlenderTweaks.cs, and put it in your Assets/Script/Editor folder.



using UnityEngine;
using UnityEditor;
using System.Collections.Generic;


public class BlenderTweaks : AssetPostprocessor
{
public override int GetPostprocessOrder()
{
return base.GetPostprocessOrder() + 10;
}

void OnPreprocessModel()
{
// Don't import materials.
ModelImporter modelImporter = assetImporter as ModelImporter;
modelImporter.importMaterials = false;
}

private void OnPostprocessModel( GameObject gameObj )
{
// Debug.Log( "OnPostprocessModel: " + gameObj.transform.name );

MeshFilter[] meshFilters = gameObj.GetComponentsInChildren();

for( int i=0; i
{
Mesh mesh = meshFilters[i].sharedMesh;

if( mesh.name[0] == '_' )
{
Debug.Log( "Ignoring mesh: " + mesh.name );

Component.DestroyImmediate( meshFilters[i].gameObject );
Component.DestroyImmediate( meshFilters[i] );
Component.DestroyImmediate( mesh );
}
else
{
RotateMesh( mesh );

meshFilters[i].transform.localPosition = Vector3.zero;
}
}

}

private void RotateMesh( Mesh mesh )
{
//switch all vertex z values with y values
Vector3[] vertices = mesh.vertices;

for( int i=0; i < vertices.Length; i++)
{
vertices[i].Set( -vertices[i].x, vertices[i].z, vertices[i].y );
}
mesh.vertices = vertices;

//recalculate other relevant mesh data
mesh.RecalculateNormals();
mesh.RecalculateBounds();
}
}

Friday, July 10, 2015

Ten new TransPlan levels!

We've just pushed an update to Steam that adds a new node ("Master II") along with ten more levels! This will be following shortly to Android and iOS, and includes a new achievement as well.

Friday, June 26, 2015

Unium & Transplan now available on Kindle!

... or at least all the "fire" variants anyway.  These are straight up purchases, no trickery with ads or anything, and we're hoping all the Kindle users enjoy!  Links are below!

Unium on Amazon Kindle
TransPlan on Amazon Kindle

TransPlan v1.0.1

- Bug Fix: Fixed occasional issue with undoing pins
- Bug Fix: Fixed save problem with Master achievement

This update clears away the last of the minor bugs we're aware of, in particular the Master Planner achievement no longer requires that all the master levels be completed at par.  This was mostly an issue since the description made no mention of that.

A bug was also fixed that caused pins to be relocated incorrectly when using undo on a mobile platform.  Sorry about it!