I have wondered if it would be possible to use demo playback to accomplish something like this. You know... send 'fake' demo data to the client in playback mode, as if the demo commands are coming from a realtime source, instead of a file? It'd be a little bit like a dummy server feeding packets to it, but since we already know so much about demofiles, would take a lot less time to develop (if it's possible at all).
While looking at the .cohdemo format and commands available while writing some simple code to inject a Sentinel+ character definition into a .cohdemo, I figured some stuff out in passing.
The client has a central scene engine that handles all the rendering and GPU interaction. It has a scene driver API in code (and likely a script system wrapping that for their own ease of use) that you can tell it to do things like: load file resources, instantiate model instances, position and move objects, control the camera view, perform special effects and manuever sequences, etc.
Many of the scene-defining commands are serialized as the demorecord feature and .cohdemo format, limited in some important ways:
- .cohdemo commands are only read once and used to then drive the scene engine without further input (timing-related delays are inbred in the command arguments where they felt they needed it, which affects how/when they internally drive the scene, but you can't further touch it)
- only the subset of what they wanted to expose to the public is part of the format
- nothing outside general scene setup (UI windows, character inventory/enhancements, collision detection, targeting, los, determining hits/dmg, etc)
So while the commands supported by .cohdemo files are translated by them into the same scene driving vocabulary, (a) you cannot issue those commands at-will because you can't talk directly to the scene engine (via code or script), and (b) you have no access to all the other upstream gameplay logic that they employ to determine those resolved effects they then drive the scene with - so you couldn't really "play the game" just via those files even if they let you get past (a).
SUMMARYThe .cohdemo is the serialized subset of the final scene update pipeline commands just for the purpose of faithfully rendering the same scene again later (well most things but not all). All the gameplay logic employed by client or server to arrive at those updates is far upstream from what you have access to.
It's like the difference between 3d vector source and the final raster image. We only get to see the final raster image pixels, not all the smart inputs that led to them.