Skip to content

samboyer/unity-voxel-game-2017

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Untitled Voxel Game, 2017

A note from the Future (2023)

Hello! I recently found the source code to one of my largest Unity3D projects, and thought it would be worth sharing here for posterity and educational purposes. While the game was never released, I'm reasonably proud of the features that I did get working, and the code might come in handy for future projects. (Ideally, each 'cool feature' would be pulled out into its own repository, but I don't really have time to make/maintain those right now.)

Fair warning: this code was written when I was 17yo, and with about 2 years of coding experience. While it does everything it needs to, there will be issues with class design, lack of comments and code layout, which I do not intend to fix right now. I hope that if you can get it running inside the Unity editor then the Scene layouts will help you understand the project.

Thanks and have fun!

- Sam

Some cool features of this game

  • Infinite* random world with configurable, layered Simplex noise and distance-based LOD.
    • Inspired by Kerbal Space Program's terrain engine, a world tile can be generated at various 'octaves', with additional vertices at the edges to ensure they join properly to neighbouring meshes (this was a massive pain!)
    • See NoiseGenerator.cs,TerrainChunk.cs, WorldTerrainGenerator.cs
  • Parse Magicavoxel .VOX or .XRAW files & convert into Unity meshes via greedy mesh generation.
    • (works for at least Magicavoxel v0.99)
    • See VoxelModel.cs, VoxelModelIO.cs, VoxelMesh.cs.
  • In-game voxel art editor
    • See VoxelEditor.cs and the VoxelEditorMulti.unity scene.

Roadmap

(I'm almost certainly not going to be working on this again but here's some things I think would be cool):

  • Triplanar textures (so the side of hills don't look as grassy, or so you can add snow to the top)
  • Multiplayer (sync seeds for worldgen & object placement via IPC, save/load via server instead of zip file, sync player movement with usual object tracking)

Gallery

(^from an earlier build, just to demonstrate the world tile LOD system)

Setup

This project was made in Unity 5.5.1. Any 5.5+ version should work (plus maybe 2017.X), but anything newer than that will probably need wrt shaders, deprecated Components etc.

  1. Create a new empty Unity project

  2. Clone this repo into that project

    • (I think this is the right order because Unity is not happy creating a project in a nonempty directory).
  3. Download and import the following plugins/assets:

  4. Build and run :)

Notes/quirks

  • I've removed the sound effects/anything I might not have rights to redistribute

  • VoxelEditorMulti is an editor for multiple models at once, whereas VoxelEditor only supported one model. The former was needed to support editing character models/anything with multiple 'parts' (models), and the latter can probably be deleted.

About

Procedural exploration & voxel building game demo, for Unity 5

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published