Library Development

Memory Library

Library features:

  • Memory leak tracking
  • Per heap allocations
  • Normal heaps
  • Fixed block heaps
  • Manual alignment requests
  • x86/x64 support

TThe memory library contains multiple quality-of-life features, such as memory leak tracking and per heap allocations. While building programs, it's easy to forget about the ownership of allocations and not actually free the memory before destruction. Within this library, not only will leaks be detected, but the exact line where the memory was allocated will be given. Memory leak detection is only injected into debug builds; this ensures that builds created in release will run as fast as possible.

This library can also be used for embedded systems, or where memory must be limited to an artificial amount per resource. By allowing the use of seperate heaps, each development group can allocate out of their own Heap with their own limit. This will ensure that any projects stay within memory budgets.

The library also supports the ability to add secondary overflow heaps, if the user would like a back-up heap for any overflow allocation requests.

Individual heaps also provide an additional perk. If a 3rd party API allows for the hook of overriding memory allocation, we can give the API its own heap to play in. Even if the 3rd party API leaks, this will ensure it will not affect the rest of our program by spiraling out of control.

Math Library

Library features:

  • 3D/4D Vectors
  • 4x4 Matrices
  • Quaternions
  • Optimized for speed using SIMD
  • Vector Linear Interpolation (LERP)
  • Quaternion Spherical Linear Interpolation (SLERP)
  • x86/x64 support

Every game engine needs a fast and accurate math library. This library is optimized for speed using SIMD operations, where possible, and verified for accuracy with many unit tests. The library supports 3D Vect, 4x4 Matrix, and Quaternion classes. The library is const correct in order to ensure no collision with any user frameworks or coding styles.

The library supports conversions between rotation-only Matrices and Quaternions, if needed.

Using setters/getters and nameless unions, each vector and quaternion can be accessed similar to arrays or by function call. This allows the user to access each float individually, but allows the library to use __m128 for use with SIMD operations.

The library contains interpolation functions that can run on a single vector/quaternion or an array.

PCS Tree Library

Library features:

  • Component-Based design pattern
  • Object-Oriented implimentation
  • Forward/Reverse iterators
  • x86/x64 support

The PCS Tree structure is a component-based system which can be thought of as a three-dimensional linked list. Each node contains parent, sibling, and child pointers. This allows for vertical and horizontal traversal. The library is object-oriented rather than templated, allowing for O(1) removal of any PCSNode.

The library contains iterator classes for forward and reverse linear iteration. These non-recursive iterators are friendly towards the stack. The iterators traverse the PCS tree in a forward/reverse depth-first fashion.

File Library

Library features:

  • Familiar API (similar to C's stdio)
  • Scoped enums for easier parameter filling
  • Native Windows under the hood for speed
  • Directory iterator
  • x86/x64 support

This library is a faster implementation of the C stdio library, due to the use of the native Win32 API. It also has a more user-friendly interface than Win32. By using Win32, our file operations will not have to switch back and forth between kernel and user modes, which is a major slowdown.

Using scoped enums, there is no need for guesswork in order to figure out what the correct literal syntax is to open a file in read-only mode... just use Mode::READ. This library contains other familiar functions like Seek() and Tell().

The library contains a directory iterator to support iteration over entire directories or given file types within a directory.

DLink Library

Library features:

  • Object-Oriented implimentation
  • Manager/Pooled Managers
  • Tracking stats
  • x86/x64 support

One of the simplest and most versitile data containers is the linked list. This library is an object-oriented doubly linked list. Once a class is derived from the base DLink class, it can then be added easily added to a linked list.

The library contains two base manager classes that can be derived from: DLinkManager and DLinkPooledManager. The Pooled Manager is to be used for any objects you would like to pool in order to reduce memory allocation/deallocations. Both manager classes contain stat tracking, such as nodes currently on list and max nodes on list. The Pooled Manager also contains information about the number of nodes creates, the numbers of nodes active, and the number of nodes on the reserve list.

Inside the DLink class are static functions, like AddToFront(DLink*&, DLink*) and Remove(DLink*&, DLink*). These can be used with a user's own DLink* head pointer if stat tracking is not required or needed This flexibility allows for lightweight linked lists or heavier stack-tracking managers.

By using the object-oriented approach, as opposed to templates, each object can be removed from the list in O(1), as long as you have a reference to the object.