Virtools 3.0 Review

2004-05-21

I recently decided to try Virtools to prototype my team’s next game and it was one day it hit me: I was actually having fun making games again. Several of my programmer friends have mentioned to me before about how tedious making a game can be. There can easily be 5 to 10 man years of work involved in getting an entire game engine, tools, pipeline, etc, ready. Many of them also played around with web programming, generally for their personal webpage and they mentioned how much fun it was since feedback was immediate. You’d edit a few lines of code, press refresh on the browser and see if the result was what you expected.

Well, that is how I felt while using Virtools. What makes it so cool, so fun, is you are editing the game WHILE IT IS RUNNING! Some companies and middleware have systems were you can edit a few things while the game is running, tweak a few variables, adjust a few links but that’s about as far as they get. In Virtools you can adjust everything INCLUDING THE CODE while the game is running!

The time it really donned on me how cool Virtools is was while I was running the game I added an entire radar system and edited the code for computing the positions of the dots on the radar in real time. My formulas were a little bit off at first so I adjusted them, pressed compile and that function was recompiled WHILE THE GAME WAS RUNNING and the dots on my radar responded immediately until I got it right. This is the power of Virtools!

Testing it out

I’m hoping by now you are thinking about giving Virtools a try. If so I want to give you one piece of advice. Virtools, like Maya, 3D Studio Max and Flash, is a very large very complicated program. You will not install it and be making a game in an hour. For me I decided on the type of game I wanted to make and then I read the entire manual. I’d say all in all it took about 2 weeks for me to get comfortable with it, about the same amount of time as it took me for Max and Maya. Please keep that in mind. Pick a goal, set some time aside and expect it to take a couple of weeks to really get it.

Another issue is that even after that 2 weeks, to make my prototype would probably have taken less than a 1 week but there was time spent in learning the Virtools way of doing things and also its current limitations and workarounds. In other words, expect that it will take a little bit of time for you to grasp how to go about implementing particular ideas in Virtools.

Virtools, what is it?

Virtools is an “Interactive 3D software” editor. In other words is an editor for making interactive 3D software. Think of it as a 3D program like 3D Studio Max or Maya except that as you put objects in the scene you can give them behaviors to follow and that unlike Maya or Max, Virtools is designed to run in real time.

I’ll be honest, in the past I would generally dismiss this kind of software. There have been other products that tried to do this, some over 10 years old that ran on SGI Onyx machines back in the day. Even then they were not very impressive.

What made me sit up and look at Virtools was one of my co−workers, a non−technical game designer had managed to get hold of an evaluation copy of Virtools and convinced management to give him a month to play with it. In that month with no prior programming experience he was able to basically create an entire level for a character action game on his own including making his own graphics (He had previously learned Lightwave).

I’m not just talking about your typical “make a guy walk around a level” demo. There are lots of engines that will let you pop in a walking character and have it walking around in a short amount of time and it will look like you’ve made a lot of progress when in fact you’ve done nothing. No, this designer had his character walking around, he had animals you could hop on and ride, he had 3 or 4 kinds of enemies you could interact with, he had non player characters you could recruit and you could command them to do various things. He had several game setups, cliffs you could climb, moving platforms, all kinds of stuff and he had done all of this without any programming experience in a single month. He even had a PS2 controller connected to his PC and had it displayed on the TV so it felt like a console game and not a PC game.

It was his example that made me want to seriously take a look. Here is what I found

The Interface

figure 1 (click for a larger version)

Virtools, like many 3D programs, has a paned and tabbed interface that makes it generally easy to get around as there are so many different parts of the program that you’d need a 10 foot by 10 foot screen to display them all at once. Fortunately if you happen to have multiple monitors you can detach any individual display and then drag it to another monitor.

Generally the top left is your 3D view. Here you can place, orient and position objects, cameras, lights etc. The top right is your list of pieces, parts, 2D assets, 3D assets, sounds, logic items, etc. Virtools has resource folders similar to Maya’s scene folders. They represent a tree of folders on your hard drive and are updated in real time. The folders are for your convenience. One for 2D images, one for 3D objects, one for characters, etc. If you put some more assets into your resource folders they will automatically show up in Virtools interface ready to drag and drop into your scene.

The bottom pane is where most detailed editing happens. It is here you can set specific attributes on the various types of items you can put in your scene as well as edit scripts and code. See figure 7 for a short glimpse of some of the various editors.

figure 7 (click for a larger version)

One step at a time

Virtools has what they call “Building Blocks” or BBs for short. These generally represent small functions or systems that you can insert in your scene.

To give you a simple example if you have a character with animations you can drag it from your resources and drop it in your scene. Then you can go over to the building blocks and find the Character Controller BB, drag and drop it on your character. A dialog will pop up asking you what your walk, run, walk backward, and stand animations are. You select them and click OK. Then drag a Keyboard Controller BB on your character. Press play and you can now walk your character around using the numeric keypad keys.

If you know the interface and you already have your assets you can have a character walking around a level in approximately 30 seconds.

Schematic

Of course that is an extremely simple example designed to get you started. The real power of Virtools lies in its schematic system which is Virtools’ visual scripting language

If you go over to the schematic pane for the last scene you’d see something like figure 2.

figure 2

Figure 3 is the same thing with the inputs pulled out so you can see them.

figure 3

When you drop a BB into your scene Virtools automatically generates a schematic for them. Of course you can also directly drag and drop BBs into your schematics.

Each BB is represented by a box, on the top of that box you will see inputs or pIns (parameter In) as Virtools calls them. In the example above the 4 inputs are the 4 animations that represent walk, run, walk backward and stand. A loop BB might have start value, number of iterations and step. You can hover the mouse over any input to see what it is. You can also generally double click on the BB and a dialog letting you edit all the inputs will appear.

Those input values can come from static constants as they do in the above example or they can come from variables. (called local parameters by Virtools) They can also come from the outputs of other BBs.

Some BBs have outputs. Outputs appear on the bottom of the BB’s box. For example the Timer BB has 2 outputs or pOuts as Virtools calls them. One is the elapsed time, the other is the delta time or amount of time since the last loop iteration.  A Timer BB loops for a specified amount of time. Figure 4 is an example of fading the background color from black to yellow over time. The duration of the time is set to 3 seconds.

figure 4

The dashed lines represent the flow of data. The solid lines represent the flow of execution. The Timer BB loops through the Set Background Color BB which takes a color as its input. The color is computed by dividing the elapsed time output of the Timer BB by the duration giving a value from 0.0 to 1.0, the color we want is then multiplied by that result and finally fed into the Set Background Color BB.

Each BB also has Behavior Ins (bIns) on the left and possibly optional Behavior Outs (bOuts) on the right. For example the timer has 2 bIns and 2 bOuts. One bIn called “In” starts the loop”, One bOut “Loop Out” and one bIn “Loop In” represent the execution flow for the loop of the timer. Finally there is an “Out” bOut that represents the execution flow after the loop has finished

The bIns and bOuts are connected by solid lines and above them are numbers. In the above example they are 0 going from the Timer BB to the Set Background Color BB and 1 from the Set Background Color BB back to the Timer BB. Those numbers represent link delays. For each iteration of the Virtools game engine your schematics will run until each one hits a link delay greater than 0. For any particular script Virtools will check for infinite loops. I think the default is 8000 BBs executed without a link delay although you and adjust that value.

Now, if you are a non programmer, this might all make more sense to you. There is no such thing as variables. There are just inputs and outputs representing how data flows. This is probably one thing that makes a system like this easier for non programmers as they can visually see what is happening. But, for you programmers out there, I’m sure the math in that last example might be making you nuts, putting division and multiplication boxes out there, any slightly complex calculation and it could get really hairy.

VSL: Virtools Scripting Language

Fortunately, Virtools has a solution called VSL or Virtools Scripting Language with which you can make your very own BBs. Let’s change the above example to fade from one color to another. That might be a little too involved using lots of boxes for calculations so we’ll use a Run VSL BB.

First you drop a Run VSL BB into your schematic and rename it to something that makes sense like “Fade Between Colors”. Select it, right click and pick “Edit VSL Script”. Up pops a text editor, on the right is a list of all the bIns, bOuts, pIns and pOuts for your script and you can define more. I’m going to define 4 pIns. duration (float), elapsedTime (float), startColor (color), endColor (color) and one pOut called resultColor (color). Once I’ve done this I can reference those in the code. See figure 5

figure 5

Now if I go back to the schematic you will see my new BB has 4 inputs and 1 output. All I need to do is connect them as in figure 6. I connected the duration and elapsed time from the Timer BB and I’ve set the startColor and endColors to yellow and cyan respectively. Then I’ve linked the resultColor output of my new BB to the color input of the Set Background Color BB and wala!, I’m fading from yellow to cyan. I can change and edit any of those values while it’s happening as well, the 2 colors and the duration.

figure 6

If my BB needed to be able to branch or have multiple paths into it I could also add more bIns and bOuts as well.

Those 2 features, the schematic and VSL are what really make Virtools shine. They can be edited in real time while the game is running and that makes it extremely quick to work up some new idea.

C++ plugins

Sometimes you need something more, like maybe you have a physics system you want to implement or a complex character animation system. In that case you can make BBs in C++. Virtools comes with an SDK and you can make whole sets of BBs that fit into a DLL and appear as part of Virtools. In that case the sky is the limit.

In fact, Virtools themselves sell a few of these. One is a Havok based physics integrator. Another is an A.I. pack that gives you access to various A.I. algorithms. There’s also a mutli−player pack for online networked games.

Behavior Graphs

Virtools also allows you to build BBs with other BBs.  You can select any part of a schematic and turn it into what they call a Behavior Graph or BG. They are basically the same as a BB except built out of schematic. You can add pIns and pOuts as well as bIns and bOuts so if you make some particularly useful function or behavior out of BBs you can turn it into a BG and start using it in other places.

Tips

If you are just starting out there are a few things you should know. The biggest issue with Virtools is knowing all the BBs. Think of BBs as your library. Like Perl and Java the libraries are so large it seems impossible to know them all but if you at least skim through them you’re more likely to find a solution than make one up.

One of the coolest and well thought out things about Virtools is that they went through and made all the BBs connect to their corresponding help so you can double click almost any BB in the Building Blocks pane and the help for it will appear. This is especially great if you have two monitors. Just move the help window to your second monitor and you can read the help while you use the BB.

On top of that, almost every BB has a sample scene to show how to use it. The help has a link to the scene which if you click on it will run the scene in the Virtools player. The scene’s source is included so you can load it into Virtools and go inspect the schematics and see how it all works.

Arrays

Virtools has something called Arrays. When I hear the word array I think of an array of integers or an array of characters. But, Virtools arrays are arrays of structures. You can have pretty much any Virtools data type as a column in your array.  For example: animations, cameras, 3D entities, meshes, materials. Remember that, if you need a table of something you can use a Virtools Array. For example an array of monsters: The first column might be a column of strings, the name of each monster. The second column could be the 3D character data needed to display the monster. The 3rd might be hit points, etc.

Virtools arrays can also be built on the fly and you can add columns on the fly as well so if you need a way to store stuff at runtime that’s one way.

The only disappointing thing about arrays is the columns are referenced by index, not by name. There is a little bit of help with the Get Row BB and Set Row BB which give you inputs or outputs for every column by name but setting or getting individual cells is unfortunately by index. That means adjusting an array can break your scripts and schematics, something that wouldn’t happen in a standard higher level language.

Attributes

Virtools allows you to a ttach attributes to various objects. While Virtools uses this for various options you can use it as a way to pass information to spawned objects. For example if you have an enemy generator when you generate the enemy you could attach some attributes to it and fill them with values that are specific to that enemy.

System BBs vs Functional BBs

Some BBs act like a C++ function. The Set Background Color BB above is an example of this. All it does is set the background color of the scene and exit. Other BBs actually start up parallel processes or systems. An example of one of these is the Character Controller BB. You’ll notice in the schematic above it’s started and then that’s it, there is no program flow following it and no loop to execute it each frame. That’s because that BB represents a system that is running in parallel with your other schematics.

What’s important to know is that that one Character Controller BB represents one and only one instance of a Character Controller system. If you wanted to control 2 characters you’d need two of those boxes, one for each character.

The particle systems are also similar so you could not make a loop that started 6 particle systems using only one particle system BB. The BB represents one and only one particle system.

Initial Conditions

Virtools has this concept of initial conditions. By default, most items don’t have them.  That means if you drop 3d object in your scene, position it, orient it and align it and then run your game and your game logic moves the object, if you did not set initial conditions the position and orientation of the object when you save is the value that’s saved as well as the value used when you restart the game again. To prevent this you select any objects which need initial conditions and select “Set Initial Conditions”.

You can set initial conditions on almost anything, for example a 3D mesh. You wouldn’t normally need initial conditions (IC) on a 3D mesh since most likely you would not adjust the mesh at runtime but if you do adjust it at runtime you’d better save IC on it.

Another example is Arrays. If your arrays are just static data then you don’t need IC on them. If on the other hand, some cells get updated during runtime you might need to save IC on the array. Once you’ve saved IC on an array though, that is the state that will be saved to the file. If you adjust a value and forget to Set the IC again the new values will not be saved.

Saving Pieces

You can save almost anything. For example if you setup an Array, select it, right click it in the Level Manager and pick Save As… and you can save it to a file which can then be loaded into another scene. If some things are used together select all of them together before you save.

Flexibility

Take a look at all the sample BBs. Virtools has examples of using pixel shaders and other technical examples as well has physics examples with the Havok physics pack including the standard simulations and also car simulations making it easy to get started on a vehicle based prototype. Their A. I. pack has a small 3D RTS game where you can drag select multiple characters in 3D and command them around. It’s a great place to get started with an RTS prototype.

In the real world

If I discount the learning curve, I was able to make a prototype for our game in about 8 days. I think that is far faster than I could have done it most other ways.

There were some issues. Virtools’ current character animation system is fairly simplified. I needed to be able to apply multiple animations to a character with full control over the specific frame of each animation I want applied. Virtools didn’t support this yet. I found a kind of hacked workaround but it has serious limitations. If I start prototyping a new game I will have to seriously consider whether or not I should spend the time to write a new character animation system BB. I’m not sure how much time would be involved in that so I hope they will provide a new one soon. They do provide the source code to the current one so it might be a simple matter of going in and adding some pIns for inputs that are not currently exposed.

Another issue is one of updating. Virtools allows you to manually re−import your assets but unfortunately it’s that manual bit that needs to go. In real development most of us are used to putting the new assets into the build and having them just get used, no manual intervention required. I’m sure they are working on that issue. Some of it may have been solved with their Alienbrain integration. Unfortunately I don't have Alienbrain so I didn’t get a chance to check that part out.

The 3D exporters for Max, Maya and Lightwave, while capable have some serious limits to there usefulness for a full production product. For example there is no automated re−export so if you add a node to a character you’ll have to manually re−export each and every animation. As well there is only linear function curve animation (no curves there) or sampled animation. The ideal would be something more like Granny3D that samples first and then generates function curves from the sampled data. Also, there is no way to specify which nodes/joints in a character need animation on a per joint / per animation basis so small secondary animations have to have all that kind of information applied at runtime. I could go on as I have a particular personal button with exporters. See my article on 3D exporters. Fortunately Virtools provides the source code for their exporters so if they don’t step up and provide production ready exporters there is the possibility you can write your own.

Also, as cool as the visual language is it can sometimes be cumbersome. Like I showed before, expressing expressions can get large. While there are workarounds, sometimes your schematics and get pretty large and hairy. You can break them down into BGs kind of like breaking down a large C++ function into multiple smaller functions but ultimately visual editing may not be for everyone. One thing that would help is a better auto formatter. I’m sure it’s a hard problem, but if you want to insert some code and you want to keep your BB understandable you need to select all the stuff to the right and move it. That’s not too big a problem, the bigger issue is that if you move only a few pieces Virtools will automatically reformat some of your links and often it will reformat them so that your schematic is no longer readable at a glance forcing you to manually format your links.

figure 8

To give you an example there is sample with an oscillating fan. It uses the Sequencer BB but looking at the schematic as in figure 8 it is not at all clear how it’s working until you start dragging the links around and you can see that what made no sense is actually overlapping links. Once you un−overlap them as in figure 9 it will make sense but drag any individual BB and the links will snap back to unreadable and overlapping.

figure 9

I don’t mean to come down in Virtools. Most of the issues above can be resolved either by adding your own plugin or modifying one that comes with it.

Real Production

I’ll be honest, when I first heard about Virtools I was interested in it for real production more than prototyping. While I can 100% recommend it for prototyping, in my opinion it is unfortunately not ready for real production yet mostly due to the issues above. I know they are working on it. Version 3 adds integration with Alienbrain for supposedly better asset m anagement.

Another big issue would be code re−use and sharing. If you were making a character action game ala Mario and you had one person programming the goombas and another person programming the koopas, as it is now, Virtools has no way I know of to share those behaviors across levels. When they figure out an elegant solution for that issue it will go a long way to making Virtools more than just a prototype or small project tool.

I haven’t gone this far yet but Virtools is designed so that you can replace the renderer. This would allow you to adapt it to some specialized system like a location based system for example. I’ve even heard that Virtools has their runtime engine running on a PS2. I’m sure there are several categories of games that could work there.

The Future

The thing is, it’s clear to me that on the next generation of consoles (Xbox2, PS3, Gamecube2) the systems will be powerful enough that the overhead of using a tool like this will not be the difference between your game performing well or not and in fact it might just be the opposite, if you don’t use a tool like this you might not have the time and flexibility to tweak your gameplay and add all the features to the game that you want so, regardless of whether or not you end up using Virtools I think it’s important for you to take some time to evaluate it and learn what development could be like in the future.

We’ve all seen how easy Flash has made 2D development. Games that used to take months can now be made in Flash in days. Virtools or something like it is set to do the same thing for 3D games. It’s in that vain I recommend you take a look.

Comments
Alice
Tokyopia.com