Welcome to ochre’s documentation!

ochre is a 2D game engine using OpenGL and SDL2, implemented in c++. It is being developed and maintained by NANDerthal Games.

The documentation is organized into several sections:

Information for developers is available here as well:

Installation

Dependencies

External dependencies are listed below, and the installation instructions for these can be found on the respective libraries’ websites. Note that if your machine’s version of OpenGL is insufficient, you can usually solve this by updating your graphics drivers and/or installing Mesa.

Downloading ochre

To download the source, go to the location in which you want to save your game and clone the repo using git. (The git repository can be viewed on GitHub here.)

git clone https://github.com/NANDerthal/ochre.git

The ochre engine does not have a GUI and is intended to be used in its source form, so no further installation is required.

To test that your environment is configured correctly with the dependencies listed above, go to the ochre folder and make the test as follows:

cd ochre/
make
./main.out -t

If all went well, you should see a window with nothing in it. It will close itself after two seconds.

Hello ochre!

Library Structure

When developing with ochre, you will primarily work in the game/ folder. This is where all of the code you implement will go. When running make from the ochre folder it will compile game/Game.cpp and game/Game.h in order to run your game. Currently those files will contain our sample game code.

Inside the game/ folder, you will also find the skeleton code Game-template.cpp and Game-template.h that outline the essential parts of the Game class.

Implementing Your Code

After successfuly completing the test, you can remove the current Game.cpp and Game.h, or move them somewhere else if you would like to refer to them later. Then rename Game-template.cpp to Game.cpp and Game-template.h to Game.h.

Engine class

Window class

Sprite class

ShaderProgram class

SpriteHelper class

Contributing

We appreciate any and all efforts to help improve ochre. However, currently, we are still building the core of the engine, and need to finish this before considering any source contributions. Once this is complete, we will add documentation about how to contribute, so stay tuned!

Useful Resources

Although it is entirely possible to assist in development without knowing about the underlying libraries used in ochre, it will likely become necessary to learn more about OpenGL and SDL2 if you want to contribute more extensively.

To that end, here are some resources that the current developers have found to be especially useful.

OpenGL:

SDL2:

Library Structure

Within the ochre folder, the library is organized as follows:

  • backend/: functionality which users of ochre should not need to access. These generally are layers of abstraction between underlying libraries (such as OpenGL and SDL) and the ochre API.
  • game/: the Game class definition and any user-defined functionality, as well as testing functionality in the sample Game.h and Game.cpp files. In general, actual ochre library functionality should not go here.
  • include/: header files for functionality which is part of the ochre API, and which the user can and should interact with. All underlying library functions and types should be abstracted away from API-interactable functionality here (return and input types of public members).
  • lib/: cpp files defining the declarations given in include/. No new functionality should be defined here.
  • src/: files which include a main() function. Most importantly, contains main.cpp, which runs all the code the user defined in game/. It should not be necessary to modify main.cpp.

Backend

Game

Include

Lib

Src

Writing Documentation

When developing for ochre, make sure to write documentation for the functionality you introduce and/or change. There are three main methods of documentation: code commenting, the GitHub readme, and Read the Docs (this website).

Our goals and standards for each method of documentation are outlined below.

Code commenting

We are currently deciding on a consistent style for code commenting, and will update this section once we have done so.

README.md

This is the readme on the ochre GitHub repo. It is intended to give a very brief overview of what ochre is, with brief instructions and links for how to get started and get help. It is not intended to be an extensive or detailed guide or reference.

Read the Docs

The documentation you are reading right now is hosted on readthedocs.io. We have attempted to make this documentation both easily accessible and detailed enough to satisfy the needs of more advanced users who want to delve into the engine source.

License

Indices and tables