Skip to content

feat(scriptcompiler): add standalone SCB JSON converter#1856

Closed
bobtista wants to merge 11 commits intoTheSuperHackers:mainfrom
bobtista:bobtista/scb-compiler
Closed

feat(scriptcompiler): add standalone SCB JSON converter#1856
bobtista wants to merge 11 commits intoTheSuperHackers:mainfrom
bobtista:bobtista/scb-compiler

Conversation

@bobtista
Copy link

@bobtista bobtista commented Nov 14, 2025

Summary

  • add ScriptCompiler tool to Core/Tools with bidirectional SCB JSON support
  • use nlohmann-json via vcpkg and CMake
  • support full roundtrip for scripts, groups, conditions, actions, params, preserving unknown chunks

Changes

DataChunk Library

  • Extract chunk I/O functionality into platform-neutral Core/Libraries/Source/DataChunk/
  • Provides clean API for reading/writing chunk-based binary files
  • Decouples tool from Windows-specific engine code
  • Enables cross-platform builds

Notes

  • VC6 skips building this for now, as nlohmann/json requires some C++11 features

Testing (done)

  • cmake --build build/unix --target core_scriptcompiler
  • ./Core/Debug/scriptcompiler -in ~/Downloads/Scripts/SkirmishScripts.scb -out SkirmishScripts.json
  • ./Core/Debug/scriptcompiler -in SkirmishScripts.json -out SkirmishScripts_roundtrip.scb
  • Verified script/action/condition counts match between original and roundtrip outputs

@xezon
Copy link

xezon commented Nov 14, 2025

The first observation is that the tool is decoupled from engine. Changing format in Engine will break the tool, unless changes are replicated to tool.

@bobtista
Copy link
Author

The first observation is that the tool is decoupled from engine. Changing format in Engine will break the tool, unless changes are replicated to tool.

That's true. The point of that is so it's cross platform now. Some ideas:

  • Extract the chunk structs + read/write helpers from the engine into a new library that’s platform-neutral
  • Just have a process for updating the standalone tool whenever needed - how often will we need to do this really?
  • Dual build: Add a Windows-only target and a macOS/Linux one, where only Mac users need to manually sync changes
  • Scrap cross platform for now

@bobtista bobtista force-pushed the bobtista/scb-compiler branch 2 times, most recently from 1542dfd to 6c3dc9f Compare December 3, 2025 18:07
@bobtista bobtista force-pushed the bobtista/scb-compiler branch from 6c3dc9f to 907e606 Compare December 3, 2025 18:11
@bobtista
Copy link
Author

bobtista commented Dec 5, 2025

Ok I watched your stream, we can close this for now - but some day I hope to re-open it when we go cross platform :)

@bobtista bobtista closed this Dec 5, 2025
@xezon
Copy link

xezon commented Dec 5, 2025

I think I was not too happy talking about this :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement SCB to plain text to SCB compiler

2 participants