Back when I first started working for Novint, they gave me a contract job to build a game demo. The game idea was to build something like a kid's sandbox, where you could pick up and toss around various objects, including toy cars. However, you then needed to be able to zoom in to the toy vehicles and drive them around, all using the Novint Falcon controller.
If you want to try out the game demo I built, you can find it here:
To run it, just unzip the downloaded file on your PC somewhere, and then run the tr1_main.exe file (though you will need a Falcon attached to your PC... otherwise you will get a pop-up error that then exits the app).
Controls for this demo are simple... use the keyboard arrow keys to move the camera around, and use the W/S/A/D keys to rotate the camera. Use the Falcon to move the hand cursor, and grab or drop items with the main Falcon button, which you should kinda feel when pressing against an object. (Note that the hand cursor is a bit buggy... for example, it often starts under the floor of the game, so you'll need to pull it up above the terrain to see it).
Move the Falcon against the "Shrink Me" button to zoom in to driving mode (the last car you picked up will be the car you zoom in to, though it defaults to the car the game starts out looking at). To drive, push the Falcon forward or back to drive forward or back, and move the Falcon left/right to turn. Hold down the main Falcon button to bring up the hand cursor, and then push into the "Grow Me" button to return to the sandbox view.
If you want to see the source code for this demo, complete with the Falcon DLL that runs the Falcon side of it, find that here:
The source code is split into two parts... the 3DGameStudio project, and a Microsoft Visual Studio C++ project.
3DGameStudio is a small scale game engine that can be used to create 3D games. It has its limitations, but its great for prototyping ideas. You can import or create 3D models, build game levels, and then code your game using a scripting language called "C-Script" (which is something like a simplified version of the C/C++ coding languages).
I started building this project in late 2006, so some things are probably out of date now.
The version of 3DGameStudio I used to build this project was GameStudio Pro 6.40.5/WED V6.731. While you can get trial versions of GameStudio for free, I needed the full professional version to handle the physics objects in the game (the free version of the time allowed only a single physics object, while I needed to handle about twenty physics objects, between the two cars, their wheels, and the other objects in the game). Spending the money on the full professional version also allowed me to build games into a single resouce file, which came in handy with my later work at Novint.
The following is a brief description of each of the C-Script code files in the game, and a little extra info. You can find all the described files under the "src" directory.
At the end of the file there are several other functions... one for exiting the game (and cleaning up), a couple related to playing sounds, and a few other small things.
Much of the basics of the car physics came from an old GameStudio demo (the "car_demo"), though I heavily modified it, mostly to handle more than a single car in a GameStudio project.
The Haptics DLL runs all the Novint Falcon forces. This DLL (or Dynamically Linked Library) was build in Microsoft Visual Studio C++ 6.0, though it can probably be upgraded to later versions of Visual Studio. You can find all the project files in the "gs_haptic_dll" directory... open the "HapticDLL.dsp" file to open the project in Visual Studio. Building the project creates the "tr1HapticsDLL.dll" file that runs all the Novint Falcon controls in the demo.
Note that you need some knowledge of C++ programming to understand how this DLL works....
At the top of the file, there are several basic functions to create and run the Falcon haptics. The "tr1_dll_createHaptics()" function, for example, creates the haptics class object that runs Falcon controls. The "tr1_dll_startHaptics()" function starts the Falcon controller running... and so on.
The following functions do things like returning the current X/Y/Z position of the Falcon, as well as creating various Falcon force effects for the game.
The remaining functions in HapticsDLL.cpp mostly just return tuning values for the game (which are loaded from the "tr1_haptics.ini" file).
The most important function in the haptics class is "calculateForces()". This class method sums up all the current force effects into a single force vector that is passed to the Falcon, and is called a thousand times a second to match the high-fidelity the haptic controller requires.
Another important function is "initParams()"... this class function is called when the Falcon is initialized, and loads up all the tuning variables from the "tr1_haptics.ini" file.
There is a lot more going on with the haptics class for this game, but if you have some experience with C++ coding, you can probably figure out the details. At some point, I plan to expand on my descriptions of how it all works.