Skip to content

Alex-CD/divide-and-concur

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Divide and Concur

DaC screenshot

What is is

A basic multithreading game engine, with collection of simple demonstration games.

This was my first foray into low-level graphics programming, my first big c++ project and was the product of the dissertation for my Software Engineering BSc.

Aside from getting my head around the ins and outs of graphics programming, this project taught me a couple of lessons about writing software.

  1. Always. Have. A. Goal. - It's not enough to specify a feature or use case and just 'code till it's done'. Brains are dumb, and I'll forget what I was working towards, and write a bunch of code that I'll never use (like a lot of the code in this project). Meeting smaller goals gives a tangible feeling of progress, which is a bonus.

  2. Know your tools - I spent many an evening smashing my head against the keyboard trying to fix inexplicable bugs, because I didn't really understand how CMAKE, or the C++ build process worked. Having more than a surface-level understanding savs time in the long term!

  3. Unit testing is a godsend in large projects - I gave up on unit testing fairly early on, I thought it took to long to run. Once you start to hit several layers of abstraction, you start to regret not having it.

What is does

Runs multiple different games at once (under the same process), with each game being run by several of its own threads, concurrently handling game logic and rendering.

It's a simple framework for games, providing utility for object creation, and automatically handling window creation and rendering.

Ideally, it functions as an example of how to handle multithreading with GLFW, if somewhat bloated!

What it's built with

Written in: C++, GLSL

Uses: OpenGL, GLFW, GLAD, GLM, Doxygen

Getting started

Generating Docs

This project is fully documented with Javadoc-style comments.

To generate documentation, run:

cd [project root]
doxygen Doxyfile

doxygen will then spit out HTML and LaTeX documentation in docs/ .

Installing dependencies

By the end of this section, your source folder should look something like this

docs
include/
  glad/
  GLFW/
  gml/
  KHR/
src/
tests/
...
OpenGL:

Depending on what drivers are installed, you should already have this installed. For a full list of packages that contain this, run

apt-file search libGL.so

Virtualbox additions definitely has this dependency, so if you really can't get this to work, try compiling it in a virtualbox dev environment.

X11dev tools

You'll need the x11 window manager dev tools to build this.

sudo apt-get install x11-dev
GLFW (v3.2.1 tested):

GLFW is the wrapper library for OpenGL, for things like window management.

If you're on Linux, you'll need to compile GLFW yourself as most package manager versions are out of date. You'll need to download the source files, then run:

cmake .
make install

this will place a compiled version of the library into your libs folder :)

There are pre-compiled versions of GLFW for windows available, though you'll have to modify some of the linux-specific dependencies in cmakelists to get it to compile.

GLM (v0.9.9.3):

An OpenGL maths utility used by the rendering module to calculate complicated stuff like perspective and field of view.

You'll have to get a copy from the GLM site.

GLAD / KHR

Generate a version of the glad loader through their web form, and drop it into the includes directory.

Compiling

You need to use cmake to build this project. It should work with up to date versions of g++, gcc and make.

Running

Compiling the project will spit out two executables, one is the program itself, one is a test suite.

How to create a new game

  1. Create a new folder inside src/Games
  2. Create two new classes, inheriting from Core and GameLogic respectively.
  3. Include boilerplate constructors (see Demo Game 1)
  4. Import any required classes from renderables/
  5. Write game logic code in GameLogic
  6. Add game to launcher in Main.cpp

License

About

A basic multithreading game engine.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages