Sunday, July 7, 2013

Surprise level editor!

Yes, the next thing I am going to be working on is the level editor. I didn't actually plan to do this for quite a while because it seems like a nice but not essential feature to have. For reasons I will make clear shortly, I need to build the level editor before I can continue.

What is this garbage?
Menus are the best showcase of my work.

Wrenching animations

I'm so sorry for the pun. What I really wanted to work on after the procedural fracturing was repairing of the fracture sites. Hit the debris with a wrench until it's close to its non-fractured position, and then weld it into place. Here's a spiffy gif of the wrench animation:
+1 for perfectly looping wrench
Here is a video, but it's not the greatest. Everything is 100% broken at the moment; I guess that's what I get for building my game with the Unity betas.


The video shows off some cool stuff, even if it looks horrible. There's the inverse kinematics on the hand placement. Inverse kinematics is a way of calculating the shoulder, arm and elbow position required to place a hand at a certain position. There's also the physics on the debris and well, you can see the lighting is broken (Unity's fault) and the scale is all weird (my fault).

Everyone is three feet tall

That's right. The reference I was using for the scale and level layout pretty much has everyone being three feet tall. After making the wrench animation, I naturally tried to apply it to a character and animate it. The problem here is that a standard character model is 1.8 meters tall, or almost twice the height of the ship. Changing the scale of the ship to be twice as tall reveals just how incredibly cramped the place is.

It's interesting how making the place bigger actually makes it look smaller.

Scaling the character models is a no-go because you'll have to scale down all the animations too and reimporting stuff is a nightmare in general. The ultimate conclusion is that I'm going to have to build the level editor a lot sooner than I expected. I need to test out different scales and room sizes, and I can't do that easily with my current set up. As for the level editor itself, Unity editor scripting is in some respects quite easy, but implementing a custom tool for laying out floor pieces and walls is difficult. There is some artificial difficulty here because most of the problems are caused by the complete lack of documentation. My techniques thus far have relied on snippets from the forums and wishes. Example: Editor.OnSceneGUI()'s documentation consists of:
function OnSceneGUI () : void 
Description 
Lets the Editor handle an event in the scene view.
In the OnSceneGUI you can do eg. mesh editing, terrain painting or advanced gizmos If call Event.current.Use(), the event will be "eaten" by the editor and not be used by the scene view itself.
That's all you get. Now go implement a level editor!
...It's coming along, but there are bugs and I don't really know what I'm doing. Expect to hear more about the level editor next time. Also, it's my last week at Intel(!!!). Let's all celebrate this new era of starvation and potential homelessness!