I was doing a tool for another game engine, MOAI.
It used to be packaged into a single file all game data (image, audio, etc).
Then I thought, how do I do it in Orx?
Then I read this: Custom Zip archive resource
I could do it
Note:I am developing on Linux with gtk theme "Win7", is not Windows.
As I do not speak English, I put images :P
1 - Works as described.
2 - The application is written in Tcl/Tk, so it's multiplatform.
3 - Currently, I only tested on Linux
Do not use this application, very soon I will create an exclusive version Orx
Link to moai-self-container repository
I know orx only in 15%
I hope you will help me to continue:
1 - The file .ini inside de binary file
In the images I have shown, the dynamic libraries are not visible. This is because I have them installed on the system side. The engine dynamic libraries are needed.
To try orxpack-test-x86_64-Linux.tar.xz
md5 : 0fa27e73202f8f363eb54d0b1ba48266
A small patch
to 01_Object.c and orxArchive.c that I use for this example.
I think you're the first one looking into custom resource support, or at least no one else mentioned it previously.
Thanks for the patch also, which reminds me that the version posted on the newsgroup is slightly outdated, I did a couple of changes, including the typedef since I posted it.
I also wrote a quick "tutorial" a while ago, but never found the time to make a proper entry in the wiki: https://bitbucket.org/iarwain/resource
It was basically the based I used to write orxArchive.c, so you won't learn much from it now.
The external initial .ini can't be packed inside orx at the moment. The issue is that some systems need config information to initialize, but at no point the user was given the hand before this happens. I should probably provide a bootstrap for that case. It's been bugging me for quite a while as well, but I haven't found a "clean" way of doing it. If you have any suggestions, please lemme know!
Now regarding the packing of the other resources, you can also define your own storage scheme, like doing some memory mapped resources for small-to-medium sized projects.
My initial thought was to have something like this:
- Use bin2c, or equivalent, to binarize the files and get a code source data table.
- In your custom Locate function, when you find a matching resource,
you can return a string that contains simply the tab + table index (or pointer), something like: mem:<ID>
- In Open, allocate a small descriptor that looks a bit like the one used in orxArchive.c: a pointer to the data in memory + a read cursor
- In Close you'd deallocate the descriptor
That's about it. Any thoughts/comments?
Now I can store my game.ini that contains all the default config directly into game.pak. Of course, the bootstrap allows for more advanced schemes as well, such as adding networked resource support, etc... or even registering to events.
This is what I did:
Then, as before I want my file .ini:
Result (to better understand this thread) :
PS: Sorry for delay in replying, was on a trip.
Here is the link to a video showing how to use it
Todo: Do all that, but orx pure.