Add snapshots patching plugin API#450
Conversation
|
Hi, could you please elaborate what your goal is with these changes? |
|
Hi! I'm currently working on a couple of plugins for my server:
|
|
These are very specific features that most server owners will have no use for. What's stopping you from using these changes just in your own fork?
I don't think that's entirely accurate. What makes you say so? |
I understand your point, and that is exactly why I tried to keep the core codebase as untouched as possible. My main goal is to ensure my mod works out-of-the-box with the official CoD4x build. While the mod-specific features are highly customizable, I really want to avoid forcing my users to depend on a custom server build.
I might be mistaken, but here is what I’ve gathered from analyzing both the server and client source code, as well as testing:
I could be wrong about the exact internal client logic, but based on my research, I managed to fix this entirely via a plugin, and it works perfectly. To achieve this without modifying the native client binary, I had to spoof/modify certain fields inside the snapshots on the server side specifically during the final killcam. I am not insisting on these changes. I want to avoid maintaining a custom server build and, more importantly, ensure my mod doesn't depend on a specific server fork. That is why I kept modifications minimal, structuring them as additive API methods and callbacks in the snapshot pipeline. |
Summary
SV_BuildClientSnapshotso plugins can modify outgoing per-client snapshots without rewriting snapshot build logic.plugin_snapshot_patching.c(registration, chained multi-plugin callbacks, sorted append for injected entities/clientStates).SNAPSHOT_PATCH_MODIFY/SNAPSHOT_PATCH_APPENDmodes, plus archived client lookup helpers for killcam replay.Design
sv_snapshot.conly calls thin wrappers; all plugin-specific logic lives inplugin_snapshot_patching.c.function_declarations.handplugin_exports.cexport register/unregister andPlugin_SV_GetArchived*helpers.Test plan
Notes
Companion plugin (
FinalKillcamEntityCamera) lives on fork branchfinal-killcam-pluginand is intentionally not included in this PR.