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 «Previous 1 2
#1
04/07/2008 (2:36 pm)
Awesome Work John, you're a Monster!
#2
04/07/2008 (2:36 pm)
That's like a ton of sweetness topped off with wicked awesome!
#3
04/07/2008 (2:51 pm)
This *is* exciting :) Looks great John!!
#4
04/07/2008 (3:00 pm)
Three out of three Daves approve!
#5
04/07/2008 (4:12 pm)
Uuhh, there is actually only *one* Dave here. : )
#6
04/07/2008 (4:38 pm)
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.
#7
04/07/2008 (4:53 pm)
There can be only one
#8
04/07/2008 (6:03 pm)
Holy Christ John =O
#9
04/07/2008 (6:11 pm)
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.
#10
04/07/2008 (6:20 pm)
frickin' sweet! bravo man!
#11
04/07/2008 (6:24 pm)
About the transform icon. Instead of drawign lines perhaps using a mesh drawn as wire frame or flat shade?
#12
04/07/2008 (8:01 pm)
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.
#13
04/08/2008 (9:44 am)
yeah but the ones there are not that great either lol.

just some ideas

www.pixollusion.com/GG_posts/move.jpg move
www.pixollusion.com/GG_posts/rotate.jpg rotate
www.pixollusion.com/GG_posts/scale.jpg scale
www.pixollusion.com/GG_posts/Universal.jpg Universal
#14
04/08/2008 (1:42 pm)
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.
#15
04/08/2008 (7:12 pm)
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
#16
04/08/2008 (8:12 pm)
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
#17
04/08/2008 (8:52 pm)
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.
#18
04/08/2008 (9:32 pm)
yeah I would thing that you would have a key for toggeling back and forth between eidt mode and moving the camera around
#19
04/11/2008 (5:19 am)
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.
#20
04/11/2008 (8:03 pm)
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.
Page «Previous 1 2