SWBFGamers

Gaming for the Original SWBF1 and SWBF2/other games => Star Wars Battlefront 2 (2005 Original) => Topic started by: mcneb10 on January 15, 2024, 08:30:05 PM

Title: libzeroengine
Post by: mcneb10 on January 15, 2024, 08:30:05 PM
Hello!

I would like to announce a new rust library libzeroengine (https://github.com/mcneb10/libzeroengine) that I am developing to extract data from the assets of Star Wars Battlefront II and hopefully any other game that uses Pandemic's ZeroEngine and convert it to a format that's actually usable.

This library can currently parse ucfb containers (the format the game uses to store everything) and extract scripts, cutscenes and levels. I plan to support all asset/chunk types contained within the games files.

The library includes a program called ucfbextract which is an extremely barebones wrapper around the library that will try to extract any file you put into it. It currently "works" with .mvs and .script files.

So far this tool has allowed me to extract all of the cutscenes from the game files, and I'm not sure if this has been done before.

Due to some major tomfoolery on Pandemic's part :wall:, the script extraction does not fully work yet, but the plan is to convert the extracted lua bytecode to lua 5.1 bytecode so it can be fully decompiled.

I plan to use this library one day create a site like Unreal Archive (https://unrealarchive.org/) but for ZeroEngine based games.

I would also like to thank the developers of swbf-unmunge, which helped me tremendously in figuring out how to parse these ancient file formats :cheers:.

Also, if anyone has a detailed description of the chunk formats used by this game, please let me know, as it would be tremendously helpful in helping me develop this library.
Title: Re: libzeroengine
Post by: {AR}MetalKiller on January 16, 2024, 07:35:28 AM
Cool, sounds really exciting!

May I ask why you are not bothering to extend/fork swbf-unmunge? From what I have seen, it already supports a lot of formats that are used in the Zero Engine.
Have you already compiled a list of Zero Engine games? I would be interested to see that.  ;)

QuoteDue to some major tomfoolery on Pandemic's part :wall:, the script extraction does not fully work yet, but the plan is to convert the extracted lua bytecode to lua 5.1 bytecode so it can be fully decompiled.
Do you want to support Lua 5.1 exclusively, or do you plan to support older versions too?
SWBF 1 uses Lua 4.0 which implements a stack-based VM. I think in Lua 5.0 the switch to a register-based VM was made.
Title: Re: libzeroengine
Post by: mcneb10 on January 16, 2024, 11:59:17 AM
QuoteMay I ask why you are not bothering to extend/fork swbf-unmunge? From what I have seen, it already supports a lot of formats that are used in the Zero Engine.

I'm writing it from scratch because of a few reasons but the main one is that swbf-unmunge only works on windows due to relying on some DirectX stuff (am Linux user). The coding style also bothers me a bit and libzeroengine is specifically designed to be used as a library, so other programs can build on top of it to make something cool.

QuoteDo you want to support Lua 5.1 exclusively, or do you plan to support older versions too?
SWBF 1 uses Lua 4.0 which implements a stack-based VM. I think in Lua 5.0 the switch to a register-based VM was made.

I'm using this extremely niche library called lunify whose sole purpose is to convert lua 5.0 to 5.1. It has a nice framework in place to implement other versions of lua so once libzeroengine becomes more mature maybe I'll make a pull request for lunify to support lua 4.

QuoteHave you already compiled a list of Zero Engine games? I would be interested to see that.   ;)

On Wikipedia there is a list of every pandemic game. It also mentions the game engines they use. Heres a link: Pandemic Wikipedia page (https://en.m.wikipedia.org/wiki/Pandemic_Studios)
Title: Re: libzeroengine
Post by: Dark_Phantom on January 18, 2024, 05:41:35 AM
I'm going to recommend you look at other projects first before digging too far into your quest.  LibSWBF2 is a good way to start.  For sounds and cutscenes, I have a project called SoundFMVExtractor that can rip out all sounds and cutscenes from both games.  Both are hosted on Github.

The reason there's dependencies on DirectX is the fact that the images are compiled in a DX compatible format.  It shouldn't dissuade you since there's plenty of resources but just making sure you know why.

And just to be pedantic, SWBF1 and 2 are NOT the same engine as previous Pandemic games, despite popular belief.  The same style is there but a lot of it was written anew for the BF games, and mungers were used to convert from the old MSH (TCW and others) format to the new SWBF compatible formats.  Also some of the same people working on it and some reused libraries mean there are similarities but they aren't the same.

Good luck!
EhPortal 1.34 © 2024, WebDev