Github, Voxels, and TPVs, Oh My

Github, Voxels, and TPVs, Oh My

I’m going to go ahead and start introducing updates to the underlying networking stack of SL for a new project I’m working on for Luna.  In addition to breaking compatibility with SL due to the TPV, these will enable a new terrain technology that should have been added to OpenSim a long time ago:

Voxels.

Think of voxels (volumetric pixels) as a series of cubes stacked in ways that produce the appearance of a much larger shape. They’re used in MRI visualizers to reproduce the internal structure of organs (you can’t easily just “slice” off a layer of that organ if it’s displayed as a mesh) and are slowly growing in popularity with other game engines (CryEngine 2, Blue Mars).

These are voxels, they are stacked

What a series of cubes may look like.

In Luna, I’ll be leveraging the abilities of voxels in order to produce more detailed and varied terrain.

What’s so great about this?

  • You can dig holes in the terrain, and not just vertically, like you can with a heightmap.  You can tunnel diagonally, horizontally, etc.
  • The new terrain materials subsystem I’m adding will allow for more than 32 different standardized rock types, including strata, gems, ores, and even the automatic generation of underground terrain features, such as chasms, pits, and underground lakes.
  • I plan to eventually add in a more natural resource limiting system, whereby you can only build by mining and processing raw minerals.  Scripts will be controlled in a similar way, by either using gems, Tritium deposits, or (if the server is configured with hostile NPCs), the “souls” of enemies.  Region administrator gets full control over ores.

I’m currently modding the crap out of a local OpenSim to handle the additional packet types required, not to mention new script functions, settings, and terrain storage.  The client, paradoxically, shouldn’t take that much time to change over, as most of the rendering code is already in place.

Server-side changes

  • Extensive terrain rewrites
    • On-disk backups (Done)
    • In-memory storage format (Done)
    • Materials storage and definitions (Done, granite is default)
    • Scripting hooks for each voxel (Done)
  • Scripting API changes
    • llAddTerrain(vector point,integer materialID) – Adds a voxel to the specified point with the indicated Material ID.
    • llRemoveTerrain(vector point) – Converts the specified voxel into an air voxel (water will eventually “fall in”).
    • llGetTerrainMaterial(vector point) – returns material ID
    • llGetTerrainFlags(vector point) – returns the specified voxel’s flags (DAMP, SOLID, LIQUID, TOXIC)
  • Message Template Changes
    • Server to Client:
      • VoxelLayer
      • VoxelUpdate
      • VoxelMaterials
    • Client To Server:
      • AddVoxel
      • KillVoxel
      • UpdateVoxel
      • GenerateTerrain
      • GenerateSubsurface (fills all sealed underground passages  with lava (killing occupants) before regenerating subsurface features and ore deposits.  Will not affected passages open to the surface (mines, bunkers))

I’m only working on the server for now.

An Explanation of Ores

The Ores feature that I plan on adding is a type of limiting resource.   If the grid/server is set up appropriately, the following rules come into play:

  1. You can mine for and collect various types of ores, stone, and gems.  They are not stored in inventory, but as a type of currency.
    • Stones and metals are used to construct objects.  You cannot build an object without at least one type of these.
    • Crystals and tritium deposits are used to power scripts. You cannot rez a script without  one of these.  Too many and all of your scripts in the parcel “overload” and enter stasis.  If this occurs, removing a few scripts back into inventory will result in the scripts exiting stasis.
  2. Sims have a finite amount of metallic ores, capped at the maximum number of prims the sim supports.  By default, these ores are deposited in a way where they take work to find, but are still relatively available.
  3. They can be traded over sim borders,but when ores are added to the point where the total amount of ore exceeds the maximum prim/script count, native ore (ore already wthin the sim) begins to decay into useless rock.
  4. Various mining tools can be used, ranging from picks to explosives.  Each material has a different density.  You can, for example, use wood to remove soil, but it’ll take a long time to mine a single voxel of stone.  An iron pick would make it faster. (Voxels can also be removed and added via terraforming tools, but they will not produce valuable ore, just relatively worthless stone or soil).
  5. Purchasing products involves not just finding the money for it, but the ore.  The value of the ore will be factored into the cost of the product (diamonds might be worth OS$1000 per stone, for example).  Therefore, more valuable ore can result in a cheaper product.  (Products can’t be deconstructed.)
  6. Flesh (for e-penises, for example) can come from scripted NPCs or by killing another user  (in a combat sim).  Flesh will also have a certain value (chicken flesh might be worth only OS$5, while Daemon Prince Flesh might be worth L$1000 per pound).
  7. Sims with ore will have underground magma plumes that will kill you and destroy your mineshaft if you’re unlucky.

About the Author

I am a meat popsicle.