Previous Blog Next Blog
Prev/Next Blog
by date

Development Journal for Torque X Builder 3D

Development Journal for Torque X Builder 3D
Name:John Kanalakis
Date Posted:Apr 07, 2008
Rating:5.0 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for John Kanalakis

Blog post
In case you haven't heard, Torque X is an amazing game engine that sits on top of Microsoft's XNA Framework. XNA provides a great foundation for bringing graphics, 3D models, and sounds together into a game that can run on Windows and any retail Xbox 360. And Torque X builds upon that framework to offer important commercial game features, like scene graph, templates, spawning, GUI, level loading, particle effects, and so on. Torque X Builder 2D is a great editor for assembling game levels, but now that the Torque X engine supports full 3D functionality, what about an editor for creating 3D game levels?

Last year, I started working on Torque X Builder 3D. As its name suggests, it is meant for assembling game assets into complete 3D scenes that can be loaded by Torque X. It was originally revealed at GDC2008 and then recently announced here by Brett Seyler. Development has turned out to be a real challenge and with this blog, I want to share my experience with talks about some of those hurdles (and how we've overcome them) while offering a deeper sneak peek into this project.

The Goal
Every project needs to have a goal, and my goal was to create a very user-customizable environment for creating 3D levels leveraging the power Torque X. That's a very specific goal with three core objectives in just the priority I want them: user-customizable, creating levels, and leveraging the Torque X engine.

User-Customizable
Not every game designer is the same, so why should their tools be?!? User customization was my top objective, so dockable panels was a must. Some may want the Assets window on the left, others on the right, while the rest just don't care. With TXB3D, you get to choose with your preferred layout saved for your next use. Here are a couple examples ranging from the minimalist (left) to the information dominator (right).



TXB 3D also supports user-created Plug-Ins. There's nothing too fancy here. I just wanted a mechanism for anyone that can code in C# to create their own Plug-In that can be loaded by TXB 3D, be given some screen real-estate, and handed access to the viewport. So, you can create any Plug-In you like, from an AI editor to an online chat tool.



Lastly, TXB 3D needs to really support (and embrace) Vista. I'm still just getting used to Vista, but it's enough to appreciate an application that can really take advantage of its strengths by "playing nice" with its security guidelines as well as parking application data where it's expected. Allow or Cancel? Allow or Cancel? Allow or Cancel?

Creating 3D Levels
This is the real meat of the application. When I first looked at this project, I broke it out into five areas: WYSIWYG Viewport, Loading & Saving Scenes, Adding/Editing Objects, Editing Components, and Editing Materials. It turns out that although these sounds like easy tasks, XNA makes them a bit more challenging. Remember, XNA is essentially a game-creating sandbox with a lot of restrictions.

Editing 3D Scenes
WYSIWYG (or what-you-see-is-what-you-get) is pretty much the expected norm for any Windows application. So, creating an editor in C++/DirectX that creates levels for C#/XNA wasn't acceptable to me. I decided that TXB3D has to have an instance of Torque X running inside of it to render the scene in real-time. It turns out that this decision had a lot of benefits and a lot of headaches. The biggest benefit is that creating the editor is now like creating an elaborate Torque X game - and I can use the scene de-serializer to load the scene, and use TorqueComponents for all the scene design objects, viewing paticle effects in realtime, and so on. The challenges were more along the lines of working with the XNA content pipeline and bringing uncompiled assets into your project and modifying components already registered with the TorqueObjectDatabase. The result was worth it and when you use TXB3D, you can be sure that your game will look exactly the way it does within the TXB3D viewport.

Loading & Saving Scenes
Loading scenes was easy, I just need to call SceneLoader.Load(); But saving scenes was a bit trickier. I decided to be lazy and make the .NET Framework do the hard work for me. So, I created a Serializer class that goes through all of the scene elements and use reflection to get their public properties and values and then write them to the scene data file. Easily reading and writing scene data lended itself well to creating a built-in XML editor for hand-coding/editing scene data.

Adding and editing scene objects is easy within a Torque X game, so no problem there. In fact, given that the editor is running a Torque X game in realtime, you can instantly see the effects of your changes. The only challenge here was that new components couldn't be added to already registered TorqueComponents. Now, you can easily add, remove, and modify any component attached to any object within the scene.



Working with Materials
Editing materials is also easy because of the great built-in support for materials within Torque X. You can create simple materials, lighting materials that can point to a normal map, or even an all new material linked to a new shader that you write... hmmm... a shader preview plug-in...



3D Axis Gizmo
But it's not all a breeze... creating a 3D Axis Gizmo for positioning scene objects is a lot easier in DirectX than it is within XNA. There's a lot of work involved in drawing a simple line within 3D space, when it comes to XNA. So drawing the Gizmo proved to be a challenge, but fortunately, it was do-able. There are still many refinements going into the Gizmo today to make it easier to work with.



Overall, this has been a really fun project to work on. I've been building desktop applications for a while with C#, but this has to be the most fun one ever. It's a great testament to the power and flexibility of XNA as well as Torque X. As for Torque X Builder 3D, it's nearing the finish line and you should see a lot more to get excited about in the next couple months.

John K.

Recent Blog Posts
List:05/04/08 - Torque X Book Completed
04/22/08 - Torque X Builder 3D Progress: The Axis Gizmo
04/07/08 - Development Journal for Torque X Builder 3D
03/31/08 - Torque X 2.0 Tutorials Updated
11/04/07 - A New Casual Game
10/26/07 - Torque X: Progress, Pics, and Free Code
12/25/06 - Rocket Commander XNA
07/06/06 - Solitaire Blaster Preview Images

Submit ResourceSubmit your own resources!

Davey Jackson   (Apr 07, 2008 at 21:36 GMT)
Awesome Work John, you're a Monster!

David Blake   (Apr 07, 2008 at 21:36 GMT)
That's like a ton of sweetness topped off with wicked awesome!

Dave Young   (Apr 07, 2008 at 21:51 GMT)
This *is* exciting :) Looks great John!!

Russell Fincher   (Apr 07, 2008 at 22:00 GMT)
Three out of three Daves approve!

Davey Jackson   (Apr 07, 2008 at 23:12 GMT)
Uuhh, there is actually only *one* Dave here. : )

Chip Lambert   (Apr 07, 2008 at 23:38 GMT)
John man, when do you sleep? Between this, your book, and everything else TX you're doing, something's up. Has GarageGames perfected cloning? Great work man, I'm really looking forward to this.

Dave Young   (Apr 07, 2008 at 23:53 GMT)
There can be only one

Jonathon Stevens   (Apr 08, 2008 at 01:03 GMT)
Holy Christ John =O

John Kanalakis   (Apr 08, 2008 at 01:11 GMT)   Resource Rating: 5
Hey everyone, thank you for the kind words. The credit all goes to Torque X since the 3D designer is really just a very complex hybrid Torque X game. This is really another example of Torque X power and flexibility, so hats off to the GarageGames developers. I'm doing my best to get this out quickly so you can all make awesome 3D games.

John K.

James Brad Barnette   (Apr 08, 2008 at 01:20 GMT)   Resource Rating: 5
frickin' sweet! bravo man!

James Brad Barnette   (Apr 08, 2008 at 01:24 GMT)   Resource Rating: 5
About the transform icon. Instead of drawign lines perhaps using a mesh drawn as wire frame or flat shade?

John Kanalakis   (Apr 08, 2008 at 03:01 GMT)   Resource Rating: 5
Yeah, those lines look pretty sad. I been taking a SCRUM approach to building this tool out. My goal was to get basic file load/save working, along with simple component and material editor, and a basic gizmo to render. Once the core features were in, I circled back to start fleshing out the remainder of the functionality. The code I was most proud of writting was the SceneSerializer, which uses .NET Reflection and simply walks through the scene graph, scanning objects and properties, ,to dynamically build out the levelData.txscene file. But to your point, I still need to get the Axis Gizmo (or drawing lines) to looks a lot better... wireframe rending sounds like a cool idea. At the moment, I'm trying to get them to look like and work like the Axis Gizmo in TGE(A).

John K.

James Brad Barnette   (Apr 08, 2008 at 16:44 GMT)   Resource Rating: 5
yeah but the ones there are not that great either lol.

just some ideas

move
rotate
scale
Universal
Edited on Apr 08, 2008 16:46 GMT

John Kanalakis   (Apr 08, 2008 at 20:42 GMT)   Resource Rating: 5
James, thanks for the reference pics. By the way, the Gizmo currently implemented (and shown above) are implemented a dynamically created mesh shapes... actually as 3 boxes. So, improving as you suggest is not a big challenge. I'll have to add this to my very long 'to-do' list. Thank you for the great suggestion!

John K.

James Brad Barnette   (Apr 09, 2008 at 02:12 GMT)   Resource Rating: 5
might I make another suggestion of having eh hot key for them follow the qwerty convention used by most 3D apps

q=selection
w=move
e=rotate
r=scale
t=universal

Edward F. Maurina III   (Apr 09, 2008 at 03:12 GMT)   Resource Rating: 5
Your work is extremely impressive. I am very much looking forward to your future refinements, additions, and of course posts about them.

Good luck in your endeavor.

-Ed

John Kanalakis   (Apr 09, 2008 at 03:52 GMT)   Resource Rating: 5
Thank you Ed, that's really cool of you ;) Likewise, I'm looking forward to the new book!

James, I like the idea of hotkeys to streamline interaction. At the moment, w is mapped to "camera forward". I've mapped WASD to camera axis movement and the arrow keys to the pan and tilt rotations. But that shouldn't really conflict with W as a move key.

John K.

James Brad Barnette   (Apr 09, 2008 at 04:32 GMT)   Resource Rating: 5
yeah I would thing that you would have a key for toggeling back and forth between eidt mode and moving the camera around

Chris Kim   (Apr 11, 2008 at 12:19 GMT)
It looks great!!!
Any chance of seeing GUI editor along with Torque Builder like editor for 2D? There is TorqueX builder, and what's going to happen to it? Will it eventually merge with this 3D Editor?
Thanks.

John Kanalakis   (Apr 12, 2008 at 03:03 GMT)   Resource Rating: 5
Thanks Chris, there's no immediate plan for a GUI editor, but I'm sure one will be coming out sooner or later, it's such an important element that I can't imagine it not coming out eventually. As for the existing TXB 2D, I'm not sure about that either. It's a great tool for making 2D games and this software is mostly focused on creating 3D games. But anything is possible.

John K.

Chris Kim   (Apr 12, 2008 at 15:32 GMT)
John, I really hope so. I was little concerned that GUI editor is one of the most important feature, and not so difficult to implement since Torque Builder already has it, but neglected in TXB.
I guess it's upto TXB developer(who is the right person to ask?) to support it and further enhance the 2D features.
I thought for a moment that 2D and 3D editor was going to merge somehow.
I think it's pefectly acceptable as long as I can import 3D project into 2D editor to work on GUI and vice versa.
Please keep the good work.
Thanks.
Edited on Apr 12, 2008 18:17 GMT

You must be a member and be logged in to either append comments or rate this resource.