sdaau | 2009-05-04 03:47
Sauer-planet - Sauerbraten procedural planet demo
Sauerbraten procedural planet demo (not fully functional yet)

Sauer-planet v0.001 - demo of procedural planets in Sauerbraten

# WHY??


This package is a, not fully working, demonstration of procedural planets in the open-source engine Sauerbraten ( It is based on CTF Edition (June 17, 2008) for Windows (, and includes sources, patch files and a Windows executable (a Sauerbraten installation is required to run the executable).

The procedural code is taken almost verbatim from GPL'd code by Sean O'Neil from:
* [ Sandbox Source Code]
* [ Sandbox Executables]

described in a series of articles on, "A real time procedural universe":

** [ "A Real-Time Procedural Universe, Part 1: Generating Planetary Bodies"]
** [ Gamasutra - Features - "A Real-Time Procedural Universe, Part Two: Rendering Planetary Bodies"]
** [ Gamasutra - Features - "A Real-Time Procedural Universe, Part Three: Matters of Scale"]
** [ Gamasutra - Feature - "A Real-Time Procedural Universe, Part Four: Dynamic Ground Textures and Objects"]


The contents have the same layout as the directory structure for Sauerbraten on Windows - you can just copy the package contents (all dependencies should be there too) over to a Sauerbraten installation folder, and run sauerbraten_planet-mingw.bat to start the executable. The executable is compiled with Mingw using Codeblocks.

Also, source code and a Codeblocks workspace project is provided - copying over should also replace the necessary files in Sauerbraten's source directory. There are also diff .patch files, both in respect to Sauerbraten CTF Edition (June 17, 2008) source, and in respect to Sandbox procedural planet code.



sauerbraten_planet-mingw.bat automatically starts a map called untitled (provided in packages/base), which is an empty map, in fps (first person shooter) mode of Sauerbraten. Once in it:
* Press E to activate edit mode
* (Alt: use /togpshade - see below)
* Choose a tile on the floor and type /newent planet 1
* Press E to exit edit mde
* Press E to enter edit mode again
* After a slight delay (and a noticeable framerate drop) the planets should start rendering.
Then, look for two small dots overlaid on the screen, and fly towards them. You should eventually arrive to two spherical renderings like on:

Additional to the new entity type 'planet', there are some added commands for the in-game console:
/togpshade N
(N can be 0, 1, 2) - toggle different shading of planet atmosphere (hardware shader, software shader, software scatter shader) - see below
/moveme X Y Z
A command like /moveme 100 100 100 will try to take you to x=100, y=100, z=100 position in the game world, by tossing you there with high speed, in an attempt to overcome the physics engine :) It doesn't take you exactly to the required location, but close enough. (Current position of player is also rendered in the console).


- There is no interaction whatsoever with the planet renderings.
- A serious crash of the GPU (at least on ATI Mobility Radeon) is caused by src\engine\planet/Planet_Quad/PlanetaryMapNode.cpp line 674: m_boVertex.Enable(&m_shape); unfortunately, it seems this step is required in order to properly render planet surfaces. So ...
- ... There is a bug with the graphics, so the planet surfaces, although calculated, are not rendered. Only planet atmospheres are rendered on screen.
- There is a bug with the planet atmospheres blending, so they are represented as a dense wireframe.
- Using the /togpshade command while planets are rendered can result with a crash; use before planets are placed.


By executing the command

/newent planet N

in edit mode, and activating the planet entity (by exiting then enteirng edit mode), will read the text file named "N.conf" in packages/planet. So, '/newent planet 1' will read the provided packages/planet/1.conf file, which is a near copy of Planet_Quad.conf (from Sandbox sources). Each .conf file can contains information about multiple planets, and properties for each of them (such as noise map specifications). Note that rendered planets will not be placed in respect to the entity placeholder - but instead at the absolute coordinates specified in the .conf file.

In the Sandbox sources:
- the Planet_Quad project shows procedural surface generation based on a .conf file and uses a hardware shader for the atmosphere. Note that the code in this package was produced using a graphics card without support for hardware shaders, so the atmosphere is rendered as wireframe:

- The ScatterCPU project shows a software atmosphere scattering shader, which on the same graphics card is rendered like this:

This demo package includes the code for both the hardware renderer and software scattering renderer (although due to the above blending bug, the software scattering renderer is also rendered as wireframe in this demo), which can be toggled using:

/togpshade N

where N can be:
- 0 (hardware), (38-41 fps)**
- 1 (software - simple),
- 2 (software scattering). (8-10 fps)

** Note that 38-41 fps was obtained before any software rendering code was present at all - after the software rendering and the toggle, framerate drops to about 19 fps, regardless of the rendering method used. In both cases, a debug MingW executable under Win XP was used; initially at empty map, before planets are placed, it displays about 120 fps. You can also try editing the 1.conf file, and setting one of the planets to be 'big' - say at (1000,1000,1000), with a radius of 500 - in this case, speed can drop to 9 fps.

From a Sauerbraten perspective, the planet class is a "dynamic entity" just as monsters (the planet.h file is based on monster.h) - this is so to allow for a possility to place and save "planets" in a map, using the map edit facilities of Sauerbraten - and the possibility to become a part of the physics engine. From the perspective of Sandbox procedural planet sources, it implements code in the Planet_Quad and ScatterCPU projects.


You can use the provided CodeBlocks workspace (and project) file. Maybe not trivial (CodeBlocks 8.02), see:
#11565: Menus not Building Correctly?

So needs
(exe that can be unpacked with PeaZip):

And also: (must build from source)
if there are problems..

# WHY??

I recently got to know Sauerbraten, and I found it to be most playable and smooth open source engine.. On the other hand, I'm fond of FPS, but not too much - I like a bit of adventure thrown in :) That is why I liked Freelancer - because it allowed the "seamless descent" from space to a planet, and had most of the "go shoot, go sell, go buy" mechanics..

So eventually, I'd love an open-source, single-player, open-ended game that would allow me to:

1. Start on surface
2. Shoot some monsters
3. Get into a ship and launch to space
4. Go mine resources (or shoot ships)
5. Descent on surface
6. Shoot some monsters
7. Possibly go in a portal loading an FPS map; finishing or exiting it takes you back to planet surface
8. Go to NPC, sell booty, buy ammo
9. Go back to 1 :)

And Sauerbraten actually provides most of this for me - except for the planets. So although I have very basic knowledge of C++ and OpenGL, when I saw how 'compatible' the sources for the Sandbox procedural planets and rest of Sauerbraten looked, it became almost an obsession to try and integrate them - at least as a proof of concept :)

As both Sauerbraten and the procedural Sandbox code are open-source, my particular work in their integration is also under the same terms and conditions.

:)n 2009 (2.43 MB)
 (0 votes)
User login
Users on Quadropolis
1 guest & no users online
points ]
 (2 votes)
Created 2016-07-28 12:06
3 years 35 weeks ago
points ]
 (3 votes)
Created 2020-01-15 07:47
10 weeks 6 days ago
points ]
 (2 votes)
Created 2020-03-16 20:09
2 weeks 1 day ago
points ]
 (7 votes)
Created 2020-01-24 22:26
9 weeks 4 days ago
points ]
 (4 votes)
Created 2020-01-23 12:57
9 weeks 5 days ago
points ]
 (4 votes)
Created 2020-01-26 14:10
9 weeks 2 days ago
points ]
 (17 votes)
Created 2011-09-05 14:13
8 years 30 weeks ago
points ]
 (8 votes)
Created 2018-08-22 19:15
1 year 31 weeks ago
Lord Kv
points ]
 (16 votes)
Created 2015-03-12 14:45
5 years 3 weeks ago
points ]
 (6 votes)
Created 2009-08-15 13:37
10 years 33 weeks ago
points ]
 (8 votes)
Created 2019-12-05 20:57
16 weeks 5 days ago
points ]
 (11 votes)
Created 2019-10-24 21:41
22 weeks 5 days ago
points ]
 (1 vote)
Created 2019-10-26 11:09
22 weeks 3 days ago
points ]
 (3 votes)
Created 2019-10-11 23:29
24 weeks 4 days ago
points ]
 (1 vote)
Created 2019-10-16 01:26
24 weeks 15 min ago
points ]
 (4 votes)
Created 2019-10-10 16:26
24 weeks 5 days ago
points ]
 (4 votes)
Created 2019-10-08 02:25
25 weeks 23 hours ago
points ]
 (1 vote)
Created 2019-10-08 13:32
25 weeks 12 hours ago
points ]
 (5 votes)
Created 2019-09-23 23:48
27 weeks 1 day ago
points ]
 (4 votes)
Created 2019-09-28 02:57
26 weeks 3 days ago
Who's new
  • Antknee55
  • gmiz
  • impala97
  • Fixxxer
  • Gangler