Friday, March 11, 2011

A Transition


Looking at that, you'd think I'm back at the beginning. Looks can be deceiving though.

For starters, that's now a Voxel engine.  I am generating the mesh by hand and only drawing the sides facing the air.  With my old engine, I was struggling to draw a 16x16x16 chunk.  What you see in front of you is 16x256x16.  The chunk is generated in less than a second and I still have lots of room for optimization.

More importantly, though, is that what you see there is not Unity.  That is XNA.

As I was moving more and more forward with Unity, I felt like I was learning Unity-specific techniques instead of 3d-specific.  I wasn't happy with this and questioned my tool of choice.  After a couple days of looking around, I decided on XNA.  While it only exports to Windows, XBox Live and Windows Phones, it's a lot of fun to work with.  It can also take a lot more and handle it gracefully.

Integration with the XBox is awesome.  I purchased a wired 360 controller and setting it up was just a matter of plugging the USB into my computer.  The code for controls looks like this:

1:          Vector2 movement = GamePad.GetState(PlayerIndex.One).ThumbSticks.Left;  
2:          if (movement.Y != 0)  
3:          {  
4:            lspeed = speed * movement.Y;  
5:            cameraPosition += cameraDirection * lspeed;  
6:          }  

Suffice it to say I'm very happy with my switch.  I paid the $99/year so I can also upload and test on my 360.

So in a way, I am starting over on a whole new platform.  Thanks to Unity, though, I was able to learn a lot of 3d techniques in a relatively short amount of time.  For a smaller 3d or 2d game, I wouldn't hesitate to use Unity.  For what I want to do I need more.

For my next step, I'm going to learn about lighting and shaders.  From Unity to XNA, placing full blocks to a voxel engine I've made some great strides.  I look forward to the future.