Skip to content

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

Notifications You must be signed in to change notification settings

codingwatching/territory

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 87.5%
  • C 12.2%
  • Other 0.3%