Staredit Network > Forums > SC1 Mapping Tools > Topic: RichChk - Edit StarCraft maps directly in Python
RichChk - Edit StarCraft maps directly in Python
Oct 22 2024, 10:58 pm
By: sethmachine  

Oct 22 2024, 10:58 pm sethmachine Post #1



Hi everyone! I wanted to share a Python library I have been working on for about 1 year called RichChk.

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.

Nov 9 2024, 5:42 pm elijah_hi Post #2



Hi Seth, thank you very much for your monumental creation. On the behalf of those of us who are not tech savvy I can say that bridging the gap between the GUI routine and your Python library will be really helpful. Something like an hour-long screencast on YT which follows an exemplary case from start to finish every step of the way. If you don't stream yourself you could ask someone else who might be interested. Anyway, thanks again for that remarkable contribution!



None.

Dec 18 2024, 9:44 am kotlowska Post #3



i am interested



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[05:23 pm]
Roy -- Moose
Moose shouted: Just made? I thought we had that years ago
"We have Super Mario at home."
[2026-8-11. : 4:44 am]
Zycorax -- :wob:
[2026-8-11. : 2:30 am]
Symmetry -- :wob:
[2026-8-10. : 1:36 am]
Moose -- Thinking on it more, I vaguely remember it being annoying because it kept repeating some short loop of the Super Mario World theme LMAO
[2026-8-10. : 12:57 am]
Oh_Man -- I thought i remembered an old mario map but i searched super mario starcraft on utube and i couldnt see anything cept UMS
[2026-8-09. : 11:40 pm]
lil-Inferno -- Blizzard forgot about SC so it's okay
[2026-8-09. : 7:04 pm]
Symmetry -- malware maps for everyone
[2026-8-09. : 7:03 pm]
Moose -- probs lmao
[2026-8-09. : 6:57 pm]
Symmetry -- (and will be patched)
[2026-8-09. : 6:56 pm]
Symmetry -- The old stuff would've gotten patched no? this is current
Please log in to shout.


Members Online: Roy