nwge-docs

Introduction to nwge

Nwge (for new game engine) is a small, light and fast game engine written in C++.

It’s hard to call it an engine, actually. It’s something of a middle ground between a full-blown game engine and a simpler development framework, such as SDL or Raylib.

Table of Contents

What does it do?

Rendering

When it comes to rendering, nwge is effectively an abstraction layer over OpenGL. It provides some basic primitives for idiots (like me, qeaml) to get simple graphics via code. Lower level building blocks of the rendering API are available as various engine objects. There is currently no exhaustive documentation on this.

Text rendering

When it comes to text rendering, nwge provides an efficient and idiosyncratic font renderer.

Screenshot of the nwgecfn command
The nwgecfn command is used to "compile" TrueType fonts into NwgeCFN fonts.

For more information, see the NwgeCFN docs.

Data loading

When it comes to data loading, nwge provides a simple bundle file format, allowing for multiple files to be stored inside one big file. This provides some advantages:

Additionally, it provides extra safety nets for how data is loaded, when it is loaded and how data loading is communicated to the user.

There are also data stores, which allow you to store things like save files, configuration files and other app-specific data.

Screenshot of the nwgebndl command.
The nwgebndl command is used to create, extract and view nwge bundle files.

For more information, see the data system docs.

State management

When it comes to state management, nwge provides a State base class, from which you can create your own states. State transitions allow you to handle data loading more efficiently as well as allow a quick exit in case of errors before jumping into the gameplay loop. A sub-state system is also provided, which allows you to run up to 16 smaller states on top of your main state. For a clearer image of they are used for, consider the following:

There is currently no exhaustive information documentation on this.

Console

When it comes to console, nwge provides an engine console which apps can use to output more low-level information to the user. The console is the #1 way for the user to inspect and manage app state. Apps may register a number of commands for testing or debugging (although nothing can beat an actual debugger!).

Console Screenshot
Console with some example commands.

For more information, see the console docs.

Memory allocation

Nwge provides a scratch-space, which can be used as temporary storage for various calculations. The scratch-space is a memory arena which does not require you free memory you allocated from but, it is very limited in size (5MB total!).

For more information, see the memory allocation docs.

Configuration

When it comes to configuration, nwge is rather configurable, both for the app developer and the end user. The developer may choose to restrict the user from certain behaviors, while the user’s configuration is always respected when not restricted by the developer.

For more information, see the configuration docs.

Audio

When it comes to audio, nwge comes with a simple wrapper over OpenAL with some additional niceties that make working with it simple. Additionally, the audio system integrates with the renderer to allow the audio listener to be synchronized with the camera currently being used for 3D rendering. The engine provides the ability to load WAV, FLAC and MP3 files out of the box.

There is currently no exhaustive documentation on this.

What doesn’t it do?

3D

3D rendering support is currently in its early stages. Thus, it may not be suitable for use in a game.

PBR

Nwge doesn’t support Physically-Based Rendering out-of-the-box, but it is certainly possible to achieve via custom shaders. Remember, even though you’re using nwge’s rendering primitives, you can still access the most basic OpenGL functionalities.

Automatic rendering optimizations

Currently, the engine performs no optimizations on the draw commands you execute. There is definitely possibility to improve repeat invocations of nwge’s primitive rendering functions (such as rect()) via automatic instancing, the engine simply doesn’t do anything and just forwards all draw commands to OpenGL directly.

Scripting

Earlier in development, nwge did have a scripting system. It, however, was not well thought out and not very well implemented either. It was removed from nwge and a new scripting system is due to be designed and implemented. Though, I wouldn’t hold my breath waiting for it.

Versions of nwge

As projects using nwge get released, multiple different versions of nwge will begin floating around. The Windows DLLs of nwge contain version information, which is also available via the e.ver console command. That command also prints out the compilation time, build number, compiler and platform.

Screenshot of the e.ver command
Example of the e.ver command in action.

Currently (April 2024), nwge is still under rapid development, so it is unlikely anything using it will be released anytime soon.

Nwge SDK

The nwge SDK, sometimes referred to as “NWDK”, is the set of headers and library files used to develop apps with the nwge engine. Currently, a limited amount of people have access to it as – as I mentioned above – nwge is still under rapid development.