• Stars
    star
    335
  • Rank 121,734 (Top 3 %)
  • Language
    C++
  • Created almost 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

3D rendered proc-gen world test. C++ homebrew voxel engine for agent-driven prodedural generation / world simulation

territory

3D rendered proc-gen world test

C++ homebrew voxel engine for intelligent agent-driven (NPC) procedural generation / world simulation.

Blog: https://nickmcd.me

Compiling

Use the make file to compile the binary.

make all

Tested on Ubuntu 18 LTS. I have been informed that on Ubuntu 19, the install folder for libnoise is different and needs to be fixed in the 'territory.h' header file.

Dependencies

  • gcc
  • SDL2 (core, image, mixer, ttf)
  • OpenGL3
  • GLEW
  • Boost (Serialization, System, Filesystem)
  • DearImgui
  • libnoise

Usage

./territory [world_name] [SEED]

If the world name doesn't exist, it will generate a world with the specified seed. If it does, it will load the world (and ignore the seed input).

By default, the world generation occurs using the SimpleHydrology system (described a separate repository). This can take a little bit, as it simulates erosion and then extracts the voxel data from the terrain.

Controls

Mouse and Keyboard Inputs:

- View Control Panel: ESC
- P: Toggle Pause (**PAUSED BY DEFAULT - BOTS ARE VERY FAST**)
- M: Play Music
- Change Camera Position (Move): WASD
- Move Camera Up / Down: Space / C
- Change Horizontal View Angle: Scroll Left / Right
- Cycle Vertical View Angle: UP- / DOWN-ARROW (for flat and top-down view)
- Zoom: Scroll Up / Down
- Right-Click: Select Block (and give task at that location using the panel)
	- Drag and Release: Select Block Region
	- V: Toggle See-Through Region (for building debugging)
- Fn+F11: Toggle Fullscreen

Panel

In-simulation control panel allows for manipulating the simulation.

- Tab: Simulation:
	- Control the Simulation Speed
	- View Position
	-	 Toggle Debug Messages
- Tab: Population
	- Observe individual bots
		- Follow Bots
		- Check their Task Queue
			- Manipulate their Task-Queue
		- Check the Memory
		- Check their Inventory
			- Manipulate their Inventory
		- Check their Sprite and Animation
	- Interrupt Bots
	- Kill Bots
- Tab: View
	- Change to perspective projection
	- FPS Counter
	- Change Skybox Color
	- Change Lighting Color
	- Change Picker Color
	- Change Render-distance (move out of current chunk to reload chunks)
	- Toggle Rendering Options

Screenshots

Perlin world generation, example of what the rendering looks like and what the control panel looks like. This is in fullscreen mode.

Fullscreen

Dense forest world gen. The leaf colors are varied using bezier curves, parameterized by the hashed block position in world-space (see my blog for more information).

Forest

Example of a "village" (which is really just a spot in the desert where I had the bots build a bunch of houses). It wasn't like this at world gen, but rather the bots built this 100% from scratch. Then I took the screenshot. There are tons of bots in this image.

Village

If you turn the camera just right, your 3D projection becomes this pseudo-isometric projection and looks really nice. Here is an example of a watery world-gen. Again using hashed bezier parameters for color variation.

Water

And zoomed out a bit.

Water Far

Updated world generation using the SimpleHydrology system

Hydrology Zoomed Out

And zoomed in a bit.

Hydrology Zoomed In

Source

Reading

In the wiki, there is a dedicated page to reading and understanding the source code.

You may not be interested in all aspects of this project. In that case, reading certain portions of the source code can give you insight into the system. This is also listed on the wiki page.

Features

A description of features and future plans for various elements of the simulation can be found in the wiki also.

I will try to keep the feature list as complete as possible.

Contributing

If you are interested in contributing to this project, with ideas or source code, please let me know.

I could particularly benefit from experience in the areas of:

  • 3D Rendering with OpenGL / Fast Shader Programming
  • GUI Programming (I am using ImGUI but would like to switch to a custom HUD!)
  • Voxel Data Storage / Large World Storage

There are lots of possibilities to include generative systems for the simulation, so if you have a nice concept I would be happy to see it.

Currently, this is 100% solo.

License

This software is available under the Mozilla Public License. Still, I don't want to clutter the source with header text, so I hope that's ok. Feel free to use and modify the source of this project.

The music and artwork used in the project (everything in /resource/) is not open source. That content was made specifically for this version of this project. If you plan on distributing your own variant of this software, you must use your own music and artwork, or contact me. Using the artwork and music yourself for personal use is fine of course.

Please see the copyright notice on my website for more information.

Articles

For the interested, there are some writeups on the various elements of this project on my blog, explaining the systems and the thought process behind their design:

More Repositories

1

TinyEngine

Tiny OpenGL Wrapper / 3D Engine in C++
C++
959
star
2

SimpleHydrology

Procedural Hydrology / River / Lake Simulation
C++
583
star
3

SoilMachine

Advanced, modular, coupled geomorpohology simulator for real-time procedural terrain generation.
C++
245
star
4

splash

Unix Data Splashing Tool
C++
172
star
5

SimpleErosion

Simple C++ implementatoin of particle-based hydraulic erosion on a square grid
C++
94
star
6

SimpleWindErosion

Procedural Wind Erosion / Abrasion / Suspension / Cascading / Aeolian Process Simulation
C++
65
star
7

t-pose

Two-View Pose Estimation and Direct-Mesh Scene Reconstruction from Image Triangulation
C++
41
star
8

c-embed

Naturally embed read-only filesystems into C99-C++20 w. a single header, zero dependencies and zero modifications to your code
C
32
star
9

proceduralweather

C++
29
star
10

MicroClimate

Tiny Climate Simulation
C++
25
star
11

TinyFluid

FV based Navier-Stokes / Transport Equation / Conservation Law Solver for Procedural World Simulation. Designed for CFD learning purposes.
C++
22
star
12

SimpleTectonics

Procedural Plate Tectonics using Clustered Convection
C++
21
star
13

.dotfiles

custom linux setup
Shell
15
star
14

dima

zero dependency commandline dimensional analysis tool for unit conversion and consistency validation
C
9
star
15

CoherentPointDrift

Single-Header Reference Implementation of Rigid Coherent Point Drift in C++ / Eigen3 in < 80 LOC
C++
7
star
16

simplemultiplay

Simple online multiplayer
JavaScript
6
star
17

gridsolver

Grid Integrator and Renderer
C++
5
star
18

drip

Melting Image Filter
C++
3
star
19

DynamicFoam

C++
2
star
20

joycon-

Joycon API / Driver for C++ on Unix. Example program with Joycon Mouse
C++
2
star
21

ctom

c++20 compile-time object-models and data serialization
C++
1
star
22

editBuffer

C++
1
star
23

spectral

C++ Single-Header Method of Weighted Residuals for n-D PDEs
C++
1
star
24

EigenBingham

Bingham Distribution Directional Statistics Library in Eigen3 / C++17
C++
1
star
25

EigenOperator

Generate nD Finite Difference / Lagrange Interpolation / Quadrature Matrix Operators for Eigen, with arbitrary orders and nodes
C++
1
star
26

circumcenter-map

Circumcenter Fractal Computation on the GPU
JavaScript
1
star