Saturday 29 December 2018

Cool! I made a modding tool for a video game with node :)

IF anyone has played X4 Foundations, (its a space sim with lots of modding support) - I got carried away with creating a "ware generator" - and dealing with X4's XML stuff. So I got to learn a LOT about xfering JSON to XML and back, used xml2js quite a bit for that, and to wire everything up to their xml system it took me about 10 days. Most of it was me creating classes with Typescript, as it honestly just helped me learn their xml schemas better (since they dont release a full schema of their objects anyway)​Some things I learned along the way:​You can use a library to convert a JSON object to a Typescript type, so if you convert an XML object to a JSON object you can get some of that IDE auto completion goodness when working with deeply nested and hard to remember objects.the PKG library lets you convert your CLI to a windows .exe file (and mac/linux binary FWIW) - which is great for making a CLI tool that is focused on a windows platform game.omg facebooks metro-memory-fs is THE absolute best at mocking filesystems, I couldn't even get other mocking fs libs to work with windows!Node has come a very long way with windows support (I generally code on a mac) - even without using the windows subsystem for linuxTypescript's module alias mapping will create outputs of files that still map to aliases, so if youre not using something like webpack (which I'm not because this is a CLI tool) - then dont bother!aside: I did find a library that let you run some require overload but it didnt work with PKGnode's ZLIB implementation is painlessly easy to use (a few lines of code to ungz files)Event Streams are still not what I thought, and I still don't understand themI've been using promises for years, and I still get surprised by their behavior. Seems like they're very eager to evaluate, even before calling them. I guess that's on purpose.XML is evil.. (not really, but...)Well, that's stuff I learned which I feel like I've learned the promise thing before but forgot it again haha.​Feel free to browse my most recent labor of love (ok that sounds cheesy but lets keep it) here: http://bit.ly/2SmUHul

Submitted December 29, 2018 at 08:01PM by tonechild

No comments:

Post a Comment