Have you made a RAGS Game?
You should check out Regalia. It’s an enhancement to the (unfinished) HTML export in RAGS Designer 2.4. You run the export, run Regalia on the export, and then nobody has to install the godawful RAGS Player to play your game.
It’s open source so there’s a pretty good prospect for it eventually supporting every feature in RAGS.
Wait, what’s RAGS?
RAGS is a graphical adventure game creation system that’s popular in several different adult video game scenes. Unfortunately it’s Windows only, tricky to install correctly, largely unmaintained, and has a couple of mutually incompatible versions.
The biggest source of the trouble is that the .RAG format is a renamed SQL Server Compact Edition database. This is an undocumented binary file format called SDF (no relation to signed distance fields). RAGS player relies on SQL Server Compact being installed in order to open the databases. That’s why you have to run two separate installers to install the player. Microsoft is dropping support for SQLSCE in 2021. The old installers will probably work for a while after that point, but there’s no telling when OS or .Net changes will break them.
.RAG files are a terrible way to distribute games and we should stop doing that.
Why was I looking into this in the first place? Well, a little while ago I had an idea that I could make a Patreon-funded RAGS player replacement to alleviate all these troubles. Working title: Rag Splayer.
I concluded it was a bad idea. Here’s what I found, in the unlikely event it helps somebody else out:
- While RAGS Designer lets you set a password on your project, this is an application level check. It’s unrelated to the encryption in the .SDF file format. Every .RAG file has the same database password, which I recovered without too much effort.
- CompactView is a database viewer for .SDF. Once again it relies on a SQLSCE installation to do it, so there’s no loader code I can borrow. But it let me get a look at the contents of the database in a .RAG after I got the password.
- The verdict on the schema? Nothing too unreasonable in general. The tricky bits:
- Actions (the RAGS answer to graphical scripting) are serialized as gzipped, base64-encoded XML, which is fun. There’s a 4 byte length prefix at the start of the gzip stream.
- Audio and video formats are up to whoever made the game. Sometimes it’s a plain old MP3. Sometimes it’s a real pain in the ass format like WMV. It’d be a problem getting everything working cross platform. Luckily RAGS games don’t tend to treat audio and video as crucial elements.
What about .SDF though? That’s the big sticking point.
- I found a Visual Studio 2015 plug-in that lets you create and edit SDF databases (once again, via the SQLSCE engine), so I started making a bunch that vary in known ways so I could binary diff the results.
- Early impressions are the format doesn’t look simple. Column values live in a different spot to rows. I haven’t figured out how the references work. Old values are retained in addition to new ones – MVCC?. I hope it’s not a memory dump of the whole DB engine with pointer fixups applied.
- Encryption looks tricky even with a known password. It’s not a case of the whole file being an encrypted stream. The password protected files have big swathes of zeroes, so it’s getting applied inside some of fields. Didn’t manage to figure out which algorithm they’re using.