Submitted by , posted on 24 April 2002

Image Description, by

NOTE - Not a terrain engine, but it can do terrain.

These are some shots from an engine I've been working on for about 2 years. I've still got a long way to go before it's finished, but since I finally got a windows version up and running I decided to post an IOTD.

I originally posted an IOTD quite awhile back, some people refered to it as green swiss cheese. I've decided to call the top left image furry swiss cheese (I'm using animal skin textures for my test now). The top right image is the left image in wireframe. The bottom left shows the top side of a smooth cube with some odd structures on it. The bottom right shows a few seconds later with some edits applied. The edits are near-realtime.

Originally the engine was supposed to be a voxel engine, inspired from some work by Stan Melax. But as I kept working on it I ended up switching it to metaballs. It seems to me that voxels are kinda like a degenerate form of metaballs anyway, at a certain area one unit squared they have a field value of infinity and everywhere else they are zero. Metaballs have some nice properties that voxels don't give you like simple normal calculation and reduced memory overhead.

Well now the engine takes a whole lot less memory than before and I've gotten edits much faster. This demo allows you to edit in one of two ways. You can fire (spacebar) a bullet that hits the terrain and destroys it (actually adds negative metaballs). You can also move to a spot and hit 'E' and deposit a positive metaball in your location. Both of these will be quickly calced and added to the new scene, on a fast system in less than a second. Please read the readme.txt before you run the program.

I've got ideas to build a game, that allows real-time deformation of the terrain (grenades, bombs, etc!). Also when I add the physics system I can use the field values from the metaballs to calculate gravity so that you can walk over the surface of the metaball structure. Think of the game "Tribes" in space, fighting on deformable metaballs.

It supports LOD using a modified binary triangle tree algorithm. The BTT seemed a bit slow, sending single triangles to the screen at a time, so instead of a triangle being a leaf node in the BTT, a large group of triangles are the leaf node of the BTT. Also LOD only occurs in the XY plane. Z LOD always stays the same. The meshes that exist in the leaf nodes of the BTT are optimized for the Geforce vertex cache.

Ok, now for my feature list:
  • Underlying data structure are metaballs.
  • Dynamically Generated Mesh and Texture coordinates.
  • Terrain doesn't have to be flat. It can have holes and caves in it easily.
  • Allows modifying of the metaballs which in turn causes all affected meshes to be recalculated (very fast!).
  • Real time editing (now it's fast, but it will get MUCH faster!) LOD implemented using a variation of binary triangle trees.
  • Saving and Loading of all data structures.
  • Console can change most system variables while the app is running.
  • Implemented in C++ and OpenGL under Linux, ported to Windows using Borland C++ (only tested under XP). Currently only tested on TNT2, Geforce2MX, Geforce2 GTS(thanks Zelcious).
  • Multithreaded (A little jerky under windows, still working on figuring that out).
  • The longest project I've ever been able to concentrate on without getting distracted (Hey that's a very cool feature!)
  • To download the source code, linux binary, or windows executable go to Larger screenshots are also available. Prebuilt maps are available as a seperate download (they aren't very fancy!).

    Image of the Day Gallery



    Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
    Please read our Terms, Conditions, and Privacy information.