RichChk is a Python library that allows reading and editing StarCraft map files without any other external programs or tools (besides using the StormLib DLL to open the MPQ archive and update the CHK file within it). This means you do not have to copy+paste triggers anymore into a StarCraft map, or even open a map in ScmDraft/StarEdit to update it. This is a big deal to me, because I have problems with my hands, so I need to avoid using GUIs/mouse as much as possible and it's nice to just run a Python script to instantly update a map and then play it without having to open the editor to copy+paste the triggers.
You can find the GitHub repo here with instructions: https://github.com/sethmachine/richchk
There is a "Hello World" example here: https://github.com/sethmachine/richchk/blob/master/examples/hello_world.py
I implemented the CHK format based on the wiki here: http://www.staredit.net/wiki/index.php/Scenario.chk. Huge thanks to whoever wrote and maintains that doc, it's been perfect. I have only modeled a small subset of the CHK sections, but I recently finished modeling the TRIG section, and I've been able to use RichChk to write triggers for my custom maps!
RichChk comes with a suite of nearly 200 unit tests and uses GitHub Workflows to verify it works across multiple platforms: Windows, macOS silicon, and Linux. It's also statically typed and provide a complete model of all aspects of the CHK, so it should be crystal clear how to edit each CHK section. E.g. there's enums for most trigger argument types, like UnitId or PlayerId
RichChk isn't fully polished and I'm sure there's quite a few bugs or oddities not being handled correctly. How I handle String allocation could probably be improved, and I've only used the library on "clean" maps, so it's very likely there's still a few issues.
An aside, it could be my complete ignorance, but I've wondered why the community has re-invented CHK parsers over and over again. It would be nice if there was an open source CHK editor/parser in a friendly language like Python that is well documented. Much like everyone uses StormLib, I feel like there should be an equivalent for CHK. Let me know if such a library actually exists!
I know it's quite a crowded space for these kinds of tools and libraries, but at the time none of the existing tools or libraries met my needs. If there's is a tool that's comparable please share in this post I'd love to learn more.
I'm also looking for any feedback on my work too, constructive criticism is also appreciated. If this kind of library isn't useful to you, could you share why?
None.





