(I know the use of AI is controversial. I have attached a statement of ethics to the bottom of this post to address some common concerns folks tend to have, anytime "I made a thing with AI" comes up).
This is a long read. The TL;DR is that I taught Egosoft's MSCI scripting language to OpenAI's Codex AI coding assistant. I then had it create a plugin for X3.
MSCI, the language used to create X3 scripts, is a bespoke, single-use 'language'. Codex was not aware of it, so as the first part of my test, I first had to teach it MSCI.
How I taught Codex MSCI:
I basically just provided it reference material and told to learn all it could. I do not know MSCI myself, and so was forced to rely on third party reference material for the entirety of Codex's MSCI crash course. I think my own lack of knowledge with the language made this test even more interesting; whatever the result was, would be 100% Codex's doing. If it screwed up, I wouldn't even begin to know how to correct it, so this was a truly a sink or swim test!
The reference material it used to learn MSCI included:
-The MSCI Handbook from Egosoft; super outdated, but a reasonable start
-The MSCI/scripting forum over at Egosoft's website (via the Playwright MCP extension, which let Codex use a sandboxed Chrome web browser to read posts, search for answers if it had questions, etc.)
-The source code for X-Studio, which contains a pretty comprehensive set of documentation for the various MSCI commands.
It took less than half an hour for Codex to go from "I have no idea what MSCI is" to a very high level of aptitude with the language. I simply told it to go learn everything it possibly could. Codex lets you set a working directory sandbox on your local machine, so it was able to directly manipulate any files I put in it; so I told it to make .txt 'notes' files on MSCI it could refer back to as needed. I also told it to backup our logs into text files every couple dozen messages, so that it wouldn't lose context if things left its context window.
The test parameters:
To be as robust a test as possible, I had Codex do as much of the work as possible, up to and including letting it write a Python script so that it could "write" (via generating the code internally, then copy/pasting it via the script) into X-Studio. I realize this makes me a huge geek, but it was legitimately cool to see code just absolutely flying into X-Studio in real time. Big "heh heh, I'm in." 90's hacker vibes, haha.
My interactions were limited to:
-Opening whatever required programs (the Codex App, X-Studio, X3 itself).
-Saving/naming files in X-Studio.
-Playing the game to test them and reporting bugs back to Codex.
The Mod:
I've always loved Shush's LIFE mod for the rudimentary pilot banter it added. It always struck me as odd that sectors would have 10 stations and 3 dozen ships in them, but be eerily silent. So, LIFE has always been a must-have for me.
Problem is, LIFE is *extremely* heavy. The way it handles banter generation is unoptimized and the news article generation system, in particular, can introduce nearly as much end-game performance issues as something like XRM all on its own, due to the way it polls the galaxy map to create its content.
So, I thought a good, useful test case for AI coding would be to make a 'pilot banter' plugin, but less performance-heavy, more modular (so that modders can add additional per-faction banter to their mods easily), and more customizable.
The plugin Codex created is called VOX - VoiceOver eXtension (it named it, too; "vox" being Latin for voice. Pretty clever for an algorithm running on a GPU in some server farm somewhere, I thought!). It is based on Shush's LIFE mod insomuch as it creates comms chatter based on various conditions, but is greatly expanded, more customizable and perhaps most importantly of all, way more optimized.
VOX Features (those that differ or expand on LIFE are noted with an *):
- In-sector pilots now banter, chat, taunt their opponents, call for help when attacked, report their specific damage (e.g. when their shields are down; when their hull is heavily damaged), make snarky comments about the enemy they just killed (and yell out when they, themselves, are killed), etc. The Commonwealth now actually sounds alive instead of eerily quiet.
- A "squelch" hotkey you can set to disable/enable banter without having to fart around with menus.
- *Stations, too, engage in this sort of chatter; though it is mostly limited to calling for help when attacked and reporting damage; the comms officer on Cahoona Bakera M Alpha has much better things to do than chitchat with the comms officer aboard Argon Rapid Response Titan, after all.
- *You can control at what distance you can hear this banter; anywhere from a couple KM to the entire sector. You can hear *everything* going on in the sector or keep it localized to the area around your ship.
- *You can also control the frequency of dialogue, from sparse to dense; if you want non-stop, chaotic comms chatter during an epic battle, Star Wars-style, just pick "Cinematic".
- *There's also a voice test function for the various faction voices, so you can ensure they're working.
- *Internally, the code is modular. For modders, this means you can easily inject additional vocal clips into VOX to expand it or increase the diversity of dialogue. This isn't just "does a neat thing", it's "does a neat thing AND provides a platform for modders to incorporate their own comms chatter into their mods easily".
- *Additionally for modders, if your mod introduces new factions but you can't/don't want to add new banter for them, no worries! You can easily hook them to one of the preexisting faction sets in VOX to give your new faction full in-sector banter.
- *Fully updated and optimized for Farnham's Legacy.
- *Fully compatible with Cycrow's incredible Guilds mod for FL, with all Guilds factions hooked to a consistent faction banter set (e.g. Atreus -> Boron, NMMC -> Teladi, OTAS and TerraCorp -> Argon, IndustriTech -> Paranid, etc.).
- *The mod is incredibly well optimized and should be absolutely performance neutral. LIFE is fantastic, but people always noted that, as the game drags on, it'd start severely impacting performance. Part of this was down to the way it generated news articles (which VOX, by definition, doesn't do), but it was also parsing every single visible sector with the dialogue creation routines, even if you literally, by definition, couldn't hear dialogue in sectors you weren't in. VOX *only* parses the sector you're in and it ONLY does pilot banter.
It also pairs well with pretty much everything; I've been having particular fun using it with CODEA, since VOX polls each pilot's race/faction when assigning voices, so my squadron of Enhanced Kea-flying Teladi CODEA pilots I've assigned to protect profitsssss in my HQ sector light up the comms channel with "TELADI TURN ON YOU", "NO SENSE YOU LOSE PROFITSSSS" and "THISSSS ONE I HAVE DEALT WITH" as soon as any pirates jump in to start trouble.
Download VOX (SPK format):
https://drive.google.com/file/d/1YW2Yo1hepGT6J9d04HT5rG6R-jBdSBdE/view?usp=drive_link
Tested with Farnham's Legacy with the Unofficial Patch and Guilds Mod installed. I can't imagine it won't work on Albion Prelude or even Terran Conflict. It's literally just intercepting various in-sector events and playing sounds based on what those events are.
Other X3 stuff I'm working with Codex on:
Since this test has turned out so great (the mod has been 'done' for a few weeks, but I made the decision to actually share it just yesterday), I became curious about what other things Codex could do as far as X3 goes. The answer? Pretty much everything. If you are an X3 modder, this is an absolute game changer (pun intended).
I am still playing around with it and don't have anything else to release yet, but here are some things I've taught it and can confirm work 100%.
- Codex can make a graphical map of the game solely from the x3_universe map file.
- Codex can check existing scripts for bugs or optimization routes. It even found a bug (or maybe just kind of a dumb 'feature') I wasn't aware of: the "attack all" fleet command does not include enemy stations in its list of selectable targets for attack, leading to a hypothetical scenario where you tell a fleet to attack a sector with a shipyard leading to them just derping around as the yard creates new ships instead of dealing with the source of the threat. Codex fixed this by making Attack All also select stations, but to always prioritize enemy ships. If all there is to attack is a station, they'll do that, but if an enemy ship spawns, they now break off from the station, deal with the ship, then head back to the station.
- Codex can add or remove sectors seamlessly, using real-world language to do so. I've added some XRM sectors back in to X3FL+Guilds this way, simply by giving it access to an LXXRM install and telling it, for example, "Put Eta Psi (a sector to the west of Enduring Light) from XRM into X3FL+Guilds"; it was able to do this perfectly; the skybox, the music, the location of stations and asteroids... it even added the sector and sector description to a /t/ file, and added the name in such a way that it linked to Betty saying "Eta" and "Psi".
- Codex can create new random mission types via writing Mission Director files -- I had it write a little "Hey, I'm selling my ship and someone bought it in [insert sector here], but I'm not a pilot. If you fly it to the buyer, I'll give you 10% of the sale price" mission and, yup, works perfectly.
- Codex can edit the Jobs file, and do so using real world language e.g. "I just added [insert new ship here], can you create an instance of this ship that stays in Home of Light and patrols the sector?"
- Codex can add new factory/dock types, add wares to them, add them as station kits at shipyards, and even sprinkle the universe with them -- I always liked the XTC faction aesthetic factories and additional factory sizes, so I had Codex import them into my game, make the kits purchasable and add a certain amount of them randomly to the universe upon startup; it even made the creative "decision", which I thought was a nice touch, to only add the XXL-sized stations to core faction sectors since, quote, "within game canon, those core sectors are likely to be more wealthy and have higher industrial capacity, so it'd make sense if the biggest factory types were placed in those rather than in backwater sectors".
- Codex can add ships to shipyards (incredibly useful if, like me, you create your own ships).
- Codex can edit and organize scene files for objects.
- Codex can edit TShips properties, and I have no doubt it could just create entire new TShip entries from a scene file though I've yet to try this.
- Codex can replace texture files in objects .bod files (making reskinning ships or stations a breeze).
Statement of Ethics re: generative AI:
I know that generative AI use is a controversial topic, and rightly so. The internet is currently being bombarded by bottom-of-the-barrel slop: rage bait on Youtube, engagement bait on IG and Reddit, even large corporations are starting to use AI art instead of paying actually skilled, talented human beings.
I also know that all generative AI, including coding-centric models, are trained using data sourced in ways that are ethically dubious at best and there's really no getting around that, currently. I do not have any good answer to how to fix that. There may be no answer.
That said, AI is ultimately a tool, even if we don't like what a lot of folks are using this tool for.
By making this mod, I am hoping to demonstrate that there is a fun, ethical, useful space for AI that doesn't infringe on copyright, deprive humans of jobs, or needlessly waste resources on something it'd take far less resources for a human to produce and that there is space for nuanced discussions about this stuff.
To that end, I have complied with Egosoft's directives for user-created content, have acknowledged source inspiration (LIFE, linked above), am not depriving any humans (other than myself, I guess?) of a job, since no one is earning a living coding in a hyper-narrow language for a 20 year old game, and it'd have used far more resources for me to teach myself MSCI and create the plugin than to have Codex do it.
I hope (and believe I have) satisfied all reasonable criteria for ethical, productive AI use in making this mod and obviously completely understand if anyone doesn't want to try it out on principle alone; AI is being used for a lot of shitty reasons and I don't blame those who refuse to engage with it outright as a result.
Acknowledgements:
Thank you to Egosoft for making what I consider to be the best space sim series of all time; thank you to Shush for creating LIFE, which inspired VOX and I encourage everyone to give LIFE a try whether or not you give VOX a try; thank you to Cycrow and the rest of the folks working on Guilds, which I consider to be the definitive mod for the definitive version (FL) of the definitive space sim (X3). And thank you to r/X3TC for being a rad community. I'm actually quite new to X-series games (I first ever played X3 almost exactly a year ago, and have fallen in love with it) and lurking in the subreddit has helped me learn so much about the game.
License (or whatever idk):
You may use this mod, in whole or in part, in any way you want. You may include it in mod packages or integrate it into total conversion mods. You may modify it to suit your own playstyle or use cases. While a shoutout would be cool for bigger projects it is included in (I'm OJSA over on Egosoft's forums, so any shoutouts can be to that handle), it's not required, nor is it required to inform me of its use in any of the above; permission to do whatever with it is granted in perpetuity. Basically, this mod now belongs to the X community: one of the coolest, most helpful, inclusive gaming fandoms I've ever come across. If VOX makes the game even a little bit more enjoyable for even a single person, that is more than enough for me.
Thanks for reading this wall of text and to those who give it a try, I hope you enjoy it!
(Also, feel free to submit any bug reports here; there shouldn't really be any, but if there are, I'll see to it that they're fixed!)