Game Development Community

Development Journal for Torque X Builder 3D

by John Kanalakis · 04/07/2008 (2:07 pm) · 23 comments

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).

www.envygames.com/share/Simple.png www.envygames.com/share/Busy.png
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.

www.envygames.com/share/PlugIn.png
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.

www.envygames.com/share/ComponentEditor.png
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...

www.envygames.com/share/MaterialEditor.png
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.

www.envygames.com/share/AxisGizmo.png
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.

About the author

John Kanalakis is the owner of EnvyGames, an independent game development studio in Silicon Valley that produces games and tools for Xbox 360, Windows, and the Web.

Page«First 1 2 Next»
#21
04/12/2008 (8:32 am)
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.
#22
11/05/2008 (11:04 am)
I just wanted to an update on whats up with TorqueX 3D and I wasn't sure where to post.

I read a post on Gamedev.net about GG releasing Torque X 3D Octobet 1st.
http://www.gamedev.net/community/forums/topic.asp?topic_id=508463&forum_id=55

It said that the 3D WYSIWYG editor would be complete and that XSI Mod Tool Pro would be bundled with it. Is this still happening? I haven't seen anything on this site about the release.

Thanks.
#23
11/06/2008 (7:07 am)
yeah and update on this would be great
Page«First 1 2 Next»