Saturday, July 3, 2010

Building PolyVox and Thermite3d

Thermite3d is a Voxel Based game engine, cross platform, under the terms of the ZLib License and aimed to be "easily integrated into exiting game engines". This software is being developed by David Williams.

One possible set up used by the Thermite3D team, uses the following third party libraries:


Voxel technology and its implementation in the Termite3d called PolyVox, is one of the reasons to apply it in my video game design.
Voxel technology haven't been used in video games as much as one would expect, but the discussion is open Thoughts on voxels?.
For this development I'm working with VS2008, Win7x64 and keep compiling the project in 32 bit version.
Let's start!

Ogre3D
Get the ogre and dependencies source according to your OS, Ogre Source. I recommend you to set an special space in your hard drive, out from your OS structure, C:\project\thermite. For simplicity we will use PROJECT_ROOT to make a reference to this path.

Extract the ogre and dependencies source inside your project structure in a subfolder, PROJECT_ROOT/ogre.
For the ogre source, I use an open source version of 7z to extract it. For the dependencies source, a common WinRar or WinZip compressor would be enough.


  • In the PROJECT_ROOT/Dependencies/src path, locate the solution OgreDependencies.VS2008 and build it for the Release and Debug targets, you should get bin and lib outputs.

  • Open CMake GUI (you will need to install this build system if you don't have it yet). "Browse source" to locate the ogre source PROJECT_ROOT/ogre/ogre_src_v1-x-x, this path should contain a file CMakeLists.txt used by the CMake. "Browse build" to select a path where to build the binaries, same as the source will be OK for this set up. Once you have built the solution about to be created, a bin folder will automatically be created to output all the exes and dll.
    In the CMake GUI environment, click "Configure" and verify no errors occur, a red list will appear showing all the configuration found. If everything is OK the "Generate" button will be activated to create the solution files. Open the PROJECT_ROOT/ogre/ogre_src_v1-x-x, you should notice the solution file Ogre.sln, build it for both the Release and Debug targets as before. Check the demos in the bin folder and test everything runs OK.



Bullet

Get the Bullet source, extract it into the PROJECT_ROOT/ThirdParty/bullet path. Generate the solution files using CMake and locate the solution file (BULLET_PHYSICS.sln).Build the solution for the Release and Debug targets, test the demos, I like very much the PROJECT_ROOT/ThirdParty/bullet/Demos/RagdollDemo.


OgreBullet

Now time to integrate Bullet with Ogre, which will be the most tricky one to configure. Since the source code is located in a repository, I recommend you to install a revision control software like Tortoise Snv. After the installation you will notice its windows explorer integration.

Use the "Tortoise->Repo browser" right clicking the windows explorer, to set the ogreadd-ons repository, https://ogreaddons.svn.sourceforge.net/svnroot/ogreaddons/trunk/ogrebullet and download it into the ogre workspace, PROJECT_ROOT/ogre, next to the Dependencies folder. Open the solution OgreBullet_SDK.sln, and build it for the release and debug target, run the demos OgreBulletDemos.exe which will be created where your ogre source is.

Problems found.
In order to do things the simpler way, a system variable for your OS will be needed to create, OGRE_HOME. Set its value as the ogre source path, PROJECT_ROOT/ogre/ogre_src_v1-x-x. The Termite3D project uses this system variables as well as others, it will be useful later too.

  • The solution include paths


    • $(OGRE_HOME)\Samples\Common\include

    • $(OGRE_HOME)\OgreMain\include

    • $(OGRE_HOME)\..\Dependencies\include


  • The ogre resource cgf file


    • You will need to add the following tags and resource values, depending on the ogre source version you are using.
    • [Bootstrap]; if you are using the latest ogre source, version 1-7-1, then an old resource from the 1-6 version, OgreCore.zip, will be needed. If you already have the 1-6 version, you can skip this step.
      Get the resource and read further discussion in the Ogre Add-ons Forum, it can be also downloaded from the ogre add-ons repository.
      Set the resource as:
      Zip=PROJECT_ROOT/ogre/ogre_src_v1-x-x/Samples/Media/packs/OgreCore.zip

    • [Bullet]; paths for the media resources in the ogrebullet workspace.
      FileSystem=PROJECT_ROOT/Ogre/ogrebullet/Demos/Media/materials
      FileSystem=PROJECT_ROOT/Ogre/ogrebullet/Demos/Media/models
      FileSystem=PROJECT_ROOT/Ogre/ogrebullet/Demos/Media/overlays
      FileSystem=PROJECT_ROOT/Ogre/ogrebullet/Demos/Media/textures

    • [OgreBulletCollisions]; path for the collisions resource.
      FileSystem=PROJECT_ROOT/Ogre/ogrebullet/Demos/Media/gui





Qt

Get the Qt framework for VS2008 and extract it under PROJECT_ROOT/ThirdParty/Qt path, locate the INSTALL and follow the instructions to compile, for windows is enough to run configure in the console within the Qt root path.
Verify you can run the demos.



QtOgreFramework

Use the "Tortoise->Repo browser" to set the QtOgreFramework repository https://ogreaddons.svn.sourceforge.net/svnroot/ogreaddons/trunk/QtOgreFramework and download it next to the OgreBullet and Dependencies folder. Use CMake to produce the solution file, QtOgreFramework. Build it and verify both the release and debug version have the QtOgre.lib and QtOgre_d.lib PROJECT_ROOT/QtOgreFramework/build/QtOgre/Release-Debug.


Boost

Get the Boost source and extract it in PROJECT_ROOT/ThirdParty/boost. For windows is enough to run bootstrap
and .\bjam in the console within the boost root path.



PolyVox and Thermite3d

Use the "Tortoise->Repo browser" to set the Thermite3D repository https://thermite.svn.sourceforge.net/svnroot/thermite and locate it in the root path of your PROJECT_ROOT, 3 projects you will get; PolyVox, tehcDemo and Thermite.
It is need to build the PolyVox project on the first place. Again, open CMake locate the PROJECT_ROOT/PolyVox/trunk and create the solution files.
C99 standard library problems for the VS2008 compiler

2 comments:

  1. Im a little confused when it comes to the configure file, which one is it i should edit?
    thanks

    ReplyDelete
  2. i have a problem , when i build the thermite i got the error of can't fine application.h cstdint gamelogic.h

    ReplyDelete