Skip to content

Contributions & Code Style Guide

Lucas Damian Johnson edited this page Feb 13, 2023 · 6 revisions

In case anyone wants to contribute to the project here are the guidelines:

Contributions

It must be relevant to the project and be generally useful to different types of projects. Also, any direct code contribution must not hinder performance. The optimal chunk build/rebuild time is below 100ms.

But if you want to help you could work on one or more of the following:

  • Documentation
  • Example worlds
  • Voxel shapes
  • Shaders and materials
  • Engine improvements and features

You can also help by providing feedback and reporting bugs.

Code Style Guide Lines

To keep the code consistent and understandable I follow some guidelines.

Basic Stying

  • Camel case for variables. No capital letters unless it is an acronym.
  • Camel case with first char capitalized for classes and imported functions.
  • An object that handles many functions and actions must be called a Manager.
  • An object that handles communication with other threads must be called [Name Of Thread]Comm.
  • All files that just have types must have .types in the file name.
  • All files that have an interface must have .interface in the name.
  • Each function and variable name must make sense and actually describe what it is and what it does.
  • Do not use classes only use objects unless an object needs to be made more than once.
  • Functions with a $ sign are meant to be called only once.
    • Such is the case with all the main contexts' main managers.
    • Each has an "$INIT" function.

Project Structure

  • The source code is split up between the different contexts.
    • The exception is the Fluid Mesh Builder which is nested in the Builder Context folder. Since they are so close together in function.
  • The Meta folder is just for types and interfaces.
  • Important objects are grouped together into a parent object in each context.
    • Their parent classes for each context are:
      • Divine Voxel Engine - DVER - Render Thread
      • Divine Voxel Engine World - DVEW - World Data and Processing Thread
      • Divine Voxel Engine Nexus - DVEN - Entity and Logic Thread
      • Divine Voxel Engine Constructor - DVEC - Mesh Builder & Light Propagation Thread
  • Important initial logic is set up in special init functions.
  • If a bunch of contexts needs to use some specific code it is attached to the UTIL object.
  • If in a context there needs to be a lot of interaction between several classes then it must be broken out into a function.

Philosophy

  • Simple
  • Elegant
  • Effective

My aim is to keep the engine as easy to use as possible (as anything like this could be).

All the stuff that can be hidden away should. The user of the engine should not have to do too much work to get exactly what they want. You should just be able to make a few files and import a few things to get a beautiful voxel world of your design in twenty or fewer minutes.

Everything you could want as an artist and a developer should be easily available.

Clone this wiki locally