informa
/
2 MIN READ
News

Feature: 'A Templated C++ Attribute Library for Object Persistence and Export'

In this in-depth technical piece, coding veteran McNickle explains how experience on the Deer Hunter series led him to create a library for managing and
In this in-depth technical piece, coding veteran McNickle explains how experience on the Deer Hunter series led him to create a library for managing and exporting important variables. During Deer Hunter 2003's development, McNickle found himself having to explain a reoccurring bug and the process needed to correct it whenever a new programmer would come across it: "Essentially, any time a new variable was added to the base actor class or one of its derived classes, the programmer had to manually add support in the archiving routines to persist this data. The problem was further complicated because it was not desirable to serialize all variables during a saved game, and the logic determining which variables should be serialized when was poorly understood. Questions such as 'Should the variable be saved during a saved game?', 'Should it be serialized to the network stream?' and 'Is the variable state managed by the server, or is it client authoritative?' had to be answered. They were typically understood at the time the variable was added, but when being reviewed by another programmer, the answers to these questions had to be re-discovered." Frustrated with having to repeatedly fix the problem and seeking to develop an elegant, automated, and less error-prone solution, McNickle envisioned a system fulfilling a list of specific requirements:
  1. It must have minimal impact on the existing code.
  2. It must be simple to expand without changing the code of the management system. In other words, it has to be generic, and it has to support complex types.
  3. It must have a small memory footprint. (Thankfully, we were only developing for the PC, so there was some wiggle room.)
  4. It must provide a simple, easily discernable means for the programmer who implemented the variable to state how the system and the user should interact with it, if at all. Ideally, this means could be adjusted dynamically.
  5. It must provide a way to query an object for all of its attributes that are to be exposed or serialized and, if possible, how and when it should be serialized.
  6. It must provide a way to automate the serialization.
  7. It must support altering the values of these known variables.
  8. And finally, it must not require that the value of the variable be changed through any particular mechanism, or be notified of any such change, while always being aware of the exact value of a known attribute at any time.

You can now read the full feature including source code on McNickle's solution for " A Templated C++ Attribute Library for Object Persistence and Export." (no registration required, please feel free to link to this feature from other websites).

Latest Jobs

IO Interactive

Hybrid (Malmö, Sweden)
3.02.23
Gameplay Director (Project Fantasy)

Arizona State University

Los Angeles, CA, USA
2.27.23
Assistant Professor of XR Technologies

IO Interactive

Hybrid (Copenhagen, Denmark)
3.02.23
Animation Tech Programmer

Purdue University

West Lafayette, IN, USA
3.02.23
Assistant Professor in Game Design and Development
More Jobs   

CONNECT WITH US

Explore the
Advertise with
Follow us

Game Developer Job Board

Game Developer

@gamedevdotcom

Explore the

Game Developer Job Board

Browse open positions across the game industry or recruit new talent for your studio

Browse
Advertise with

Game Developer

Engage game professionals and drive sales using an array of Game Developer media solutions to meet your objectives.

Learn More
Follow us

@gamedevdotcom

Follow us @gamedevdotcom to stay up-to-date with the latest news & insider information about events & more