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.
[02:00 am]
l)ark_ssj9kevin -- hi jamal
[12:18 am]
Heinermann -- memes
[10:08 pm]
NudeRaider -- skeet-skeet, motherfucker
[04:24 pm]
Vrael -- NudeRaider
NudeRaider shouted: Vrael boy, if you're not careful I'll moderate your sorry ass too!
gotta catch me first! skeet skeet skeet
[2026-4-26. : 1:58 pm]
lil-Inferno -- ya
[2026-4-25. : 11:50 pm]
JamaL -- Glad to see SEN will never die. Kudos to whoever is paying the hosting fees these days!
[2026-4-25. : 3:37 pm]
NudeRaider -- (-.-,)
[2026-4-25. : 3:35 pm]
Zoan -- ;o I thought that was a monkey emote
[2026-4-25. : 3:34 pm]
Zoan -- :mods:
[2026-4-25. : 3:34 pm]
Zoan -- :mods"
Please log in to shout.


Members Online: Ojan, JohnnyTheWolf