Custom Resource Loader

I've been reverse engineering the old DarkSun games (from SSI) with hopes to eventually get the MMO up and running again. I'm thinking of using ORX to drive the UI.

One issue I have is that the resources are stored in .GFF files, which I'm able to extract the majority of. Now I would prefer to extract this data during runtime. So, I see some options:

1) Add a custom loader (like in orxAndroid_RegisterAPKResource()), and load from there. My concern is that some things may not translate correctly. For example the image data is stored as two different entries in the gff. A palette entry and then then a data entry. Naturally I have a routine that translates that combination into 24-bit RGB or 32-bit RGBA.
2) Load the data in C and not in .ini. In other words use orxObject_Create(), etc... to create the objects.
3) Explode all the data into .bmp/png files on disk and then load.

I prefer 1) as I have the backend for that and it would allow people to overlay any extensions/mods in the .ini/config files--which would be slick.

I'm not opposed to 2), but that seems to defeat the purpose of ORX since that would be ignoring the whole data-driven .ini/config.

I don't like 3) at all because that is just seems super lame to me. Also, I'd have copyrighted data exploded on disk as opposed to its original format. Additionally there are certain parts of the original engine that use alternating palettes to create effects, which I haven't thought of how I would implement that yet.

Naturally I'd love to hear opinions.

Specifically any direction on 1) to get me started? I can keep reading the code, but any direction/examples would be helpful. Preemptive apology if I missed where this was documented already.

Comments

  • Hey @PauloftheWest, welcome back, it's been a while!

    As you might have noticed, most our support now happens in our Discord server, so you might find answers for future questions there as well too.

    I see no issues with going with 1). You might want to check some recent live sessions we've done with the community (the recordings are available on YouTube: ).
    More specifically:

    • The session dedicated to the resource system:
    • The session dedicated to the Bundle extension (as it's related to handling a new type of resources):

    If you join our Discord community, you'll find dedicated discussion threads for those live sessions, in addition to the more generic #Support channel.

    Here's a quick, high level, list of steps you'd need to go through.

    • As you can already read the .GFF files, you'd need to register a new resource type (like the Android APK one or the native File one). The Bundle extension's code would probably also be another good place to start to see how it's done.
    • You'd want to reference the actual resources inside the GFF as textures & palettes, and provide the correct storages for them in the Resource config section (the .GFF fileS).
    • Your resource type will then handle the extraction. I'd recommend creating temporary textures & palettes upon the opening of the .GFF resource (this happens after an internal resource has been located inside a .GFF) and free them upon closing the .GFF resource. Again, the Bundle extension is a good example to check.
    • Your read function would then simply fetch the data from the in-memory textures/palettes you've created during the open step.

    And that's about it. Of course, there are additional things you can do for improving performances, for example, like delaying the creation of the in-memory textures & palettes during the first read call, as open is blocking but read can be asynchronous. Again, the Bundle extension is a good example of this behavior.

    Lemme know if you need any additional details and best of luck with this project, it sounds really cool! (I'm a big fan of some SSI games, though I've never played Darksun.)

Sign In or Register to comment.