Split the simulation from presentation into an SDL-free library
Sim holds one whole game (tick, snapshots, checksum) and talks to the screen only through Cues, which the client's Scene plays and the server ignores. All drawing moved to scene.cpp. Match takes this screen's wishes as request flags instead of reading the menu, input and settings. The sim library builds without SDL and the server links it, ready to run games itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2007fb7edc
commit
465f75f6d7
38 files changed
+2225
-1965
No files matched your search
+3
-3
@@ -2,12 +2,12 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
struct Game;
|
||||
struct Sim;
|
||||
|
||||
// The whole simulation as bytes, to hand a player joining a game already running. The game state is plain data that
|
||||
// lays out the same on every platform (no pointers or heap inside the structs; see Attack and FixedList), so most of it
|
||||
// goes as it sits in memory, and the few lists as a count and their items. It starts with a layout signature (the sizes
|
||||
// of everything), so a build that lays things out differently refuses it rather than loading garbage. The menu and
|
||||
// everything else this screen alone sees isn't part of it, nor is the bots' map of the world, rebuilt on loading.
|
||||
std::string state_save(Game& game);
|
||||
bool state_load(Game& game, const std::string& bytes);
|
||||
std::string state_save(Sim& sim);
|
||||
bool state_load(Sim& sim, const std::string& bytes);
|
||||
Reference in new issue
Block a user