Posted on Sep 11, 2011

Summer recap

I’ve been quite low-profile all summer long. Long story short, I took a break from my pathfinding project, except my last post on pathfinding basics. I did take the time to experiment with some ideas & experiments I had.

SVG to Mesh
It’s been a mystery how some game were using vector graphics in Unity when everything in game engine has to be mesh & texture. But it struck me, SVG format could be imported as raw mesh with vertex color, thus resulting in a pure vector graphic. RageSpline offers in-editor controls over path + gradient + UV but I wanted a pure import from SVG.

It took me a few hours to put together a SVG import to Mesh with planar UV mapping. It does not support path/curve and outline, nor gradient fill. You can check the source code in my Google repo.

Rectangle, Circle, Polygon, UV

After opening my SVG in Blender, I decided to stop working on this code since I believe Blender (or any 3d-soft) will offer more customization to your resulting mesh: UV editor, modifiers, scale, etc.

Export scene to Collada
For my pathfinding project, I did tried to auto generate my navmesh with Recast lib, it turn out that it require DLL, and thus Unity Pro. So I had to look for Blender Recast plugin and I found out Nick’s implementation for GSOC 2010 (video) and supposed to be part of October’s Blender 2.6 release. So all I needed to build was a scene’s geometries exporter. Having worked with Collada format in the past month, I choose that format.

Export scene

It only supports geometry (vertices, triangles, normals, colors, uvs) and won’t support other entity (camera, lights, texture) until someone put some time to figure out how to translate Unity properties to Collada format. Sources in my Google repo: Collada Export and Scene Exporter.

Mono as server
Since my team was almost M.I.A during summer, I resurrected an old idea for a multiplayer game. Being a PHP5 Zend Certificated Engineer and my day job is web development, I wanted to search for more robust, faster server side setup. Unity3D using Mono Project as its core for coding, it was my first choice for some experimenting session. After a few hours I was amazed by Mono performance and workflow. I was a bit afraid of the fact that my server would require a compile/build each time I modified the code (PHP being an interpreted-language it does not require re-compilation). I think that using the same code-base as client/server is really a great setup: server / client could share a lot of code without the need to rewrite to Java/PHP. So I will most likely write some posts in the upcoming months about my experience with Mono as server/client.

In-game console
Having used a console for my last year Flash experiment with Cirrus (peer-to-peer UDP connection for Flash), it was clear that if I wanted to build a client/server communication pipeline, a console was needed. Why a console is so important? Running multiple instance of your game (web, stand alone, mobile), Unity IDE can only connect to one instance for the built-in console output. Debugging other instance become a pain as you cannot see any debug information. This is where an in-game console is really a savior.

In-game console

Working much like the Windows command line, you can type command and read output. You can grab the package here, drag & drop the prefab in your scene, change the toggle character (“~” on my keyboard is actually “#” on my bilingual keyboard).

  • Console.Log(object message): works like Debug.Log;
  • Console.RegisterCommand(string command, delegate(string args) {…}): register a callback for command;
  • Console.UnregisterCommand(string command): unregister callback for command;
  • Console.Halt(): prevent user input;
  • Console.Resume(): resume user input;
  • Console.Show/Hide/Clear: self-explanatory


		// basic echo command to console
		Console.RegisterCommand("echo", delegate(string args) {
			Console.Log(args +"\r");

		// parse argument in format "move -x=10 -y=100 -z=2"
		Console.RegisterCommand("move", delegate(string args) {
			Dictionary arguments = Console.ParseArguments(args);
			Vector3 position =;
			if (arguments.ContainsKey("x"))
				position.x = float.Parse(arguments["x"][0]);

			if (arguments.ContainsKey("y"))
				position.y = float.Parse(arguments["y"][0]);

			if (arguments.ContainsKey("z"))
				position.z = float.Parse(arguments["z"][0]);

		// stop input untill coroutine finish
		Console.RegisterCommand("get", delegate(string args) {

		private IEnumerator getWWW(string url)
			WWW www = new WWW(url);

			yield return www;


			yield break;


So that pretty much recap all my summer-experiments.

Latest Tweets