XMLGameEngine

An engine for describing games built around Xerces, exprtk, and SFML.

View the Project on GitHub beefviper/XMLGameEngine

17. Reference Pong in plain C++

Status: a working prototype used as the yardstick for the XML engine; several of its techniques are not in the engine yet

Purpose

While the XML engine was being rebuilt, a plain C++ Pong (SFML 3, single file) was developed as the reference: each piece of behavior is identifiable as something that could become a declarative verb. The author’s stated aim is for it to serve as the reference implementation for the XML engine.

Structure choices

Collision techniques

Review of this file by other tools raised: a dangling-reference risk in the drawables list (addresses of objects in vectors), tightening the top or bottom edge hit so only real face hits count, and a note that nothing was declared “reference quality” until it had run for a while. Untested claims at the time: the swept-math versions had not been compiled by the assistant.

Polish note

A hand-tuned nudge (for example shifting the left score four pixels when the score is exactly 1, because the thin glyph looks too close to the center line) is the sort of unprincipled detail that gives a real game extra polish. If this is ever wanted declaratively, it would be a per-glyph or per-value offset in the text vocabulary.

SFML 3 migration notes

Sources