Twig is free open-source software distributed under the LGPL license. The source is currently distributed as a zip file. Download it, unpack it, and open Twig dist.sln in visual studio.
We now have the beginnings of a manual. It’s not fancy, but it covers the basics. More will be coming in the future. In the mean time, feel free to ask me questions, so that I can answer them and turn the answer into more documentation.
- Version 0.2 is in alpha test. This release finally has a manual (in progress). The code has also been refactored to simplify and otherwise rationalize the API.
- Version 0.1 is the current version. This version adds tables and chairs, automatic subgoaling using role-passing, an example client for the server, and a number of bug fixes.
- Version 0.0. Ported to XNA 3.0 and VS 2008 (see below).
- Version -0.1 used XNA 2.0, which is no longer released by Microsoft, but I will send you a copy if you want it.
This is research code. It contains a number of false starts and other general ickinesses due to my not knowing what I was trying to do with I started, and to my never having really written a serious 3D graphics program before.
In order to build the Twig source, you need some things that I’m not allowed to distribute to you directly:
- Some version of Microsoft Visual Studio 2008. If you don’t already have Visual Studio, the simplest way to get it is to download Visual C# Express, which is free. If you are an experienced programmer and either have money or are at a University that has Microsoft’s MSDNAA program, which makes their developer tools available for free, then I recommend Visual Studio Team Suite, which includes a profiler.
- XNA Game Studio 3.0, available from the XNA Creators Club, also for free.
- The DigitalStrip font, available from Blambot. Please note that the fonts distributed with Windows are not free, nor are they even Microsoft’s property. You can’t distribute XNA games that use them because the games would include rasterized versions of the fonts, and so you technically be distributing the font without authorization. Blambot’s fonts are free for non-commercial use.
Twig also includes code adapted from Christer Ericson’s excellent book Real-Time Collision Detection, published by Morgan Kaufmann. You don’t need to purchase the book to use Twig, but if you’re interested in collision detection algorithms, it’s invaluable.
Building the Twig source
- Download and install Visual Studio 2008 (any version so long as it includes C#).
- Start Visual Studio. If it asks you what kind of development you want to do, say C#. In any case, let it run until it stops saying it’s configuring itself, then close it.
- Download and install XNA Game Studio 3.0.
- Download the DigitalStrip font, unzip it, and drag it into the Fonts folder in the Control Panel
- Unzip the Twig source and click on the file Twig – dist. This should start Visual Studio and show you the various project directories within the Twig distribution. If you are running Visual C# Express, it will complain that that version of Visual Studio doesn’t support solution folders. You can safely ignore this. It just means that the readme and release notes won’t appear as items in the solution explorer.
- Right click on one of the example demos (e.g. Episode 0), and choose Set as startup project, then press F5 (selects Start Debugging from the Debug menu) to build the projects and run the selected demo.
Visual Studio essentially calls your projects "solutions" and reserves the term "project" for components of the solution (e.g. libraries, specific applications, etc.). The current Twig distribution contains the following projects:
The actual library code. To use Twig, you must add a reference to this project to your game’s References list.
Another library that implements a server class that listens to a TCP port and runs script commands. This code is still in its infancy. To use the server, add a reference to this in addition to Twig.
A library implementing extensions to the XNA Content Pipeline. If you want to put a script or gesture in your Content project, you need to add a reference to this project in the References list for your Content project.
- Episode 0
The is the source to the first episode of the web comic. It provides an example of using the system in scripted mode.
A pre-built application that opens a TCP port that you can send script commands to. The server interface is embryonic, but I’m interested in extending it for people.
A pre-built GUI for talking to the TwigServer object, e.g. using the ServerTest project above. This is useful for debugging purposes, and easier than using telnet.
This is a simple example of using the (limited) build-in AI features to let the characters run fully autonomously.