• Welcome to AtomicTorch Studio Forums.
 

CPK/MPK Magic - a possible way to read data

Started by MenschMaschine, April 24, 2015, 04:08:46 AM

MenschMaschine

Because i thought, the originating thread was a bit misplaced in the MODS section,
i start this thread here...

This is a detailed design for a method where VoidExpanse can load
data from unpacked CPK and/or MPK-files.

Of course the game would be slower running from an actual
filesystem compared to the virtual one that the archives provide,
but the purpose is modding and testing only anyways.

VoidExpanse is, regarding the number and size of the files we have access to,
not so big (yet), but still... to make it easier for the game (later),
i think the best way would be like this:

All CPK files are moved to the main game directory and are read from there.
If later it is decided to add moddable content, like a hypothetical gui.cpk,
this also would make the filestructure more easy to understand.

If then one starts modding, one can unpack any or all of the CPK-files to their own
directory (like it is now with core.cpk, only then there are unpacked files)
and each one that -is- unpacked, -has- to be unpacked completely.

Filehandling, i guess, is easier when the game does not have to gather data
about which file is to be read from the packed CPK and wich one is to be
read from the unpacked CPK. This system also would have no need for a
global registryfile where the user has to declare which files are unpacked.

Additionally, there is a MODS folder in the [username]documents\my games\voidexpanse
structure (this has to be adapted to mac and linux of course), into which one can
copy single files, which have to be in the same folders as they were within the archive.

The loading hierarchy then would be like this:
1. packed CPK
2. unpacked CPK
3. MODs folder with MPK-files
4. MODs folder with unpacked, single files
   (hm, maybe it might be useful if in the modsfolder the CPK -can- be unpacked
   partially, so released mods won't include all the stuff that isn't modded,
   just as it is now)

In other words, the Game first looks, if there is a directory with the same name as one
of the CPK files, reads data from there and overrides the data from the CPK with the same
name, then it looks at the userfolder for any packed MPK-files and overrides the data read
previously and finally it looks for unpacked MPK-files in the MODs-folder and
replaces already read data with the MODs folder data.

I think, this system would provide mod-developers with the biggest amount of flexibility,
while still being not so much work for AT. It also would make modding easier, faster and less
prone to error.

Regarding reloading of CPK and MPK data...
One way to do that would be to go to the options menu and find a button in the game section,
which reads [Reload Gamedata], this would make modding even more easy and comfy,
especially because sometimes the client and server setup at the start of the gameprogram
still seems to be a bit wonky, so reloading the data by restarting the game can get
a bit frustrating.
No Berries!

ai_enabled

Hello!
We have already a prototype for these ideas, and it works in a way you've described. However, there are a lot of work before we can release it (for example, the game requires checksum for all the files, which is automatically provided by the ZIP archive).
About the mod reloading - I think the shortcut for reloading all the data will be much more useful than a key in the options: Ctrl+F5 for reloading client only, Ctrl+F6 for reloading client and server together (so the client will re-connect).
Regards!