I’m looking into replacing our custom scripting system with FMod’s Designer and Event system, but I have an issue with the way our engine handles filenames in its data structure. Our engine packs all game resources into a single resource file that is accessed via a unique pre-generated file handle. All filenames and paths are stripped out during the build phase and replaced with these handles. Internally, we only use these handles from code, and so we have no path references at runtime. As such, I’m a bit concerned about how .fev files reference .fsb banks (which I understand are by file name).

One solution would be to somehow extract and modify any external file references within the .fev. Essentially, I’d need an API to retrieve any external file dependencies, and a way to alter these file paths via a command-line tool or some custom code, so it could be processed by our build scripts. Is the .fev file something I can parse and modify in this way, or is that not really feasible?

Alternatively, the only other solution I can think of would be to create a script that scanned the asset directories for .fsb files and created a reference list. Then, during the build processes this list could be used to create a lookup table for pre-generated file handles. I could then use FMOD’s file reading functions overrides to map between the referenced filenames and our internal file handles. We lose some of the benefits of the path-less file system in this case (efficiency and additional security), but I think this should work.

What I did was use the file callbacks to ‘read’ from memory. During the build phase, I read the FEV, grabbing anything that comes through the FMOD file system into a memory stream. Then I process the event structure, using getevent/loadeventdata, again anything that goes through read, I add to my memory stream.

I then reverse this process in the actual game, it works a treat, we even can unload projects and re-import all inside the editor.

I also spawn the fmoddesignercl version to convert the data for PS3/Xbox, and capture that too, so it speeds our build time up for those platforms up.

Using this method, you can fix up any things you need in the FDP, for example I force software on constantly, in case the sound designer forget to do so.