XMLGameEngine is a VGDL (video game description language) and an engine for running games completely contained within an XML file.
Status: Built: 4 XML, 4 window and 3 sound libraries plus silence; a library and two programs. Reference: the engine.
The prototype was hard-wired to Xerces and SFML. Each library sits behind an interface so the core never names one, licensing or weight can be dodged per library, and one can be swapped without touching game logic. A compiling two-library example proved it before adoption.
XmlDocument and XmlNode| Decision | Alternative | Why |
|---|---|---|
| A node is an interface | one struct everything converts into | libraries store data very differently; a struct copies on every access |
Children come as fresh unique_ptrs |
raw pointers into a cache | several nodes alive while a subtree is walked; allocation is irrelevant at load |
| Unfiltered traversal, callers filter by name | positional | element order is not guaranteed |
Read-only, UTF-8 std::string |
mutable; wstring |
RapidXML cannot mutate; library-agnostic |
load/xsd, which reads the same .xsd and checks the subset the schema uses (“weak”), deliberately permissive. test_xml_format.cpp pins what both must reject.Window speaks only in engine terms (Object, KeyCode, Color): init, pollEvents, controls, clear, prepare, draw, display, setTitle. The one thing only a backend can measure is a text’s or image’s size. Every library opens a window of its own and throws if it cannot start.Audio: load, play, loop, stop, stopAll, update (sound).<scale>: a game at an arcade’s 256 by 224 looked empty in a modern window. The game keeps its size and every library draws it N times bigger (an SFML view, SDL_RenderSetScale, raylib’s DrawTexturePro, the OpenGL viewport); the mouse maps back. Rejected: scaling every number in the file, a free resizable window (a whole scale keeps square pixels). Text is drawn unsmoothed, so a pixel font at multiples of 8 stays sharp.xgegui and xgecli’s SFML window fit the game to the window by any factor with its proportions, centred on whole pixels. Whole-number scales only were tried first: a window a little too small for 2x showed 1x with wide bars. Not yet in the SDL2, raylib and OpenGL windows, which stretch.xgelib; xgecli and xgegui are programs; xgetest links the library. A new front end is a main() and a few lines in executables.cmake.-DXGE_BUILD_SHARED=ON for shared. Static xgecli is one file that runs beside its games; with two small programs always built together, sharing gains nothing.--gui switch; third-party libraries PRIVATE (the engine’s headers include them; hiding them is a separate change).