Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - {AR}MetalKiller

SWBF1 Modding / lua4dec - Lua 4.0 Decompiler
February 09, 2024, 12:33:57 PM

I have been working on a Lua 4.0 decompiler for some time and I think it's ready enough to be shown.
What was originally planned to be a weekend project turned out to take almost half a year of off/on development.
lua4dec was initiated by my interested in SleepKillers unmunge tool which extracts lua bytecode (among other formats).
This lua bytecode can be fed into lua4dec which converts it back to human-readable lua scripts.

The project is around 90% done.
Some uncommon instructions are not implemented, and 3 or 4 instructions are missing some more attention.
But overall I am pleased with the results.
The decompiler even spawned a little side project that shows the AST of a converted script.
In the long run, I could imagine it being used to modify the bytecode and recompiling it back into the SWBF files.

Here is the link to the project:

I will still continue to work on it and finish it someday.
Maybe you want to test it, leave some feedback, or improve it yourself.

Feel free to reach out.

I am only familiar with SWBF 1. The mode map (folder) must contain a mapinfo.txt file that has the default settings set for the server manager.


CW,CORUSCANT: JEDI TEMPLE CW,Cor1c,CIS,republic,200,200
GCW,CORUSCANT: JEDI TEMPLE GCW,Cor1a,alliance,imperial,200,200

Other things to check:
- Is the mod map in the correct folder (AddOn)?
- Is the mod map not in a nested folder? (something like tat3/tat3/Data/... instead of tat3/Data/...)
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.
Thanks for the link, very helpful!
SWBF1 Modding / Tutorial and Documentation Resources
January 02, 2024, 06:53:19 AM
Howdy and happy new year, everyone  :cheers:

I've been modding SWBF for well over 10 years now, admittedly less frequent and with less ambition than other modders on this forum.
In the beginning, I started having conversation with people who already knew how to mod.
There was no tutorial to follow along, and I had to figure out a lot of stuff on my own.
The classic learning by doing experience.
Although there are plenty of tutorials and documentation resources available, it always bugged me that they were spread across multiple different platforms and presented in forms that may not be appealing to beginners.
Some documents even skipped the most interesting parts because they were trivial in the eyes of the writer or just too cumbersome to explain.
Further problems were dead links, incompatible software, .... you name it.
I understand that the community is a bit smaller these days than back in the day, and the demand for a unified resource collection might be close to zero.

However, I am wondering if there has never been made an effort to collect all the information that is out there about SWBF1 and SWBF2 in one place?
I am thinking about something similar to the Blender-MSH-IO reference manual from Sleepkiller or a Wiki page in general.
Having Screenshots, cross-references, TL:DR;, ... really lowers the initial threshold for new people to get started.

I am not really trying to convince anybody of something, but just want to hear your opinions on it.
Public Square / Re: Any interest in Game Auto-Alerts?
August 31, 2023, 07:52:55 AM
Quote from: RepComm on August 29, 2023, 09:39:02 AM

This might be off topic but is this the actual master server used for swbfspy?
I am a bit surprised that it is running on VB  :o
Public Square / Re: Any interest in Game Auto-Alerts?
August 29, 2023, 08:41:17 AM
Quote from: RepComm on August 29, 2023, 06:40:09 AMIf it's scanning the battlefront process then I think what is handling is an individual dedicated server, correct?


Quote from: RepComm on August 29, 2023, 06:40:09 AMThere is also a luxury that the current master server implemented is open source, so events could be generated directly in theory

Could somebody pass me a link to the code?

Quote from: RepComm on August 29, 2023, 06:40:09 AMPerhaps something like:
Get events and server lists from master server
Check port XYZ on dedicated server IP
 if responds ask it to forward events as if it's a dedicated server bot
Sounds like a lot of work, but a lot of fun ;)
Public Square / Re: Any interest in Game Auto-Alerts?
August 28, 2023, 07:17:04 AM
In the AR-Clan Discord we have a dedicated channel where a discord bot notifies players about our steam server.
People get notified when the map changes (the map name is shown) or a new player joins.
Additionally, we introduced 2 roles that tag people when there are more than 3 or more than 5 people on the server (tags occur only after a certain timeout i.e. 30 minutes).
We have a separate channel for moderators where the names of the players on the server are displayed.
The bot also notifies us if the server crashes.

The bot is written in Python and is publicly available:

One drawback is that this bot is not universally reusable and will work only for one discord server.
Feel free to use/tweak the code, or contact us if you want to create a more generic bot.


I am not familiar with how the master server works, but our bot scans the memory of the battlefront executable (given by the PID) in a regular interval (every 3 seconds).
If certain values in the memory change, a new event is created and the bot executes an action (i.e. a channel message).
SWBF2 Modding / Re: remove overheat weapon
August 08, 2023, 08:29:57 AM
I try to explain it as easy as I can, maybe someone can help me out to make it even simpler.

When you open the fake console you see a list of functions.
Each of those functions connect to a piece within the game code.
This game code is fixed and can not be altered (trivially).
The fake console is only there to call this function dynamically (you wouldn't want to make every unit jump like a jedi on every mission).
If you want to add a new entry to the fake console, you would need to know the game code and see if the functionality exists there.
This only works by disassembling the game code and taking a stroll through the game files.
At least, that is my understanding.
I might be wrong.

The following comparison might lack a bit but here we go ...
Imagine a soft drink dispenser.
Every type of soft drink represents a functionality of the game code.
The number input thingy of the dispenser is the fake console (the script connection to the game code) where the user selects a number to get a certain soft drink.
You can not add more soft drinks to the dispenser because it is already filled.
Not all soft drinks might be accessible via a the number input, but you could connect the soft drink to the number input.
However, you would need to know the number of the soft drink.

You would either have to study how the number input is connected to the soft drink, or even harder, open the dispenser and add a new type of soft drink.
SWBF2 Modding / Re: remove overheat weapon
August 07, 2023, 05:51:33 AM
Behind every script function there is usually a function within the game code.
If your intention is to add a "RemoveWeaponOverheating" function, you would need to connect this script function with a function in the game code that implement this functionality (I doubt that there exists one).
For it to work you would need to have access to the game code or find a way to inject code into the executable.
This is not trivial.

I have only modded for SWBF1 so far, but I assume that it is not that different to SWBF2.
If you want to remove the weapon overheating only for a specific weapon you could modify the respective side (have a look at the modding tutorials).
Let's say you want to remove the overheating of the rebel pistol:
- Find the file "all_weap_inf_pistol.odf" in your custom side directory
- Open it with a text editor of your choice
- Look for the line that contains "HeatPerShot"
- Set its value to 0
- Munge your custom all.lvl side
- Make a backup of your original all.lvl
- Replace your custom all.lvl side with the original
Quote from: Sereja on June 16, 2023, 07:08:51 AMI am fine, thanks! :tu:

Well, I actually dont have SWBF installed right now, so may missing something. Also SWBF1 and SWBF2 may using different named files for same purpose. If you modding SWBF2, your file with objects coordinates may have some different name, and could be in a different directories, but it surely stored in some project folders.
msh. files doesnt realy increase much map size, but textures does.
Here the trick I used long time ago: first freeze each wall in your 3D software (I guess this function has most of them), then import your walls and save them in ZE. In your project find odf file with coordinates, open it, find coordinate at least one of the wall, copy it, and paste to all other walls. Close and save. Each wall should be in place like in your 3D software scene.

Now I got it. You mean the *.wld file where the coordinates for each individual object is stored. Thanks again for clarifying.

Note: Copying odf files won't increase the map size, but copying meshes certainly does.
Quote from: Sereja on June 09, 2023, 07:39:36 AMRotating something in ZE only makes sense if precision is not important. If you need a specific rotation angle and precise coordinates - i guess you need to edit World.odf text file (if i rememember it's name correct).

Thanks for the hint! But what's the name of the property that has to be applied here? I could not find any mentions of "rotation", "degrees", or similar keywords in other odf files or in the documentation.

Last resort would be to copy the msh file and change the orientation there. But this would increase the size of the shipped map.

Take care  ;)

I am trying to create a wall that surrounds a town with several kinks and edges with angles between 15 and 45 degrees (something like Picture 1).
Preferably with the grid alignment in ZE enabled.
For arguments sake, let's say a wall segment is a cube with dimensions of (1, 1, 1).
Aligning wall objects without rotation is straight forward, as they are aligned along the x or z axes (Picture 2).
However, rotating the object breaks the alignment as the model coordinates are not a multiple of 1 anymore but rather something like (0.85, 1, 0.35).
As shown in Picture 3 there will always be a gap or the objects have to overlap, which causes Z-fighting (flickering) issues.

Side note: I created connector objects that solve the transition from no-rotated objects to rotated objects.

I know that most SWBF maps get around this problem by having just 90 degree edges or using a model that has the kinks already in them.
I really would like to keep the assets generic and reusable and not create one big model.
Any ideas how to get around this problem?
Or do I have to manually align the objects with the grid alignment disabled?

Picture 1:
You cannot view this attachment.

Picture 2:
You cannot view this attachment.

Picture 3:
You cannot view this attachment.

Note: I am using blender and SK exporter to create the models.

Thanks for any help  ;)
QuoteYeah, I just created an account to post this lmao :D.

Worth it ;)

QuoteWhich version of Wine are you guys using on that Linux machine?

We are still on Ubuntu 14.4 as the owner is afraid of a dist upgrade :D . Hence we use wine 3.6.


I used the latest release (wine-5.12-15725-g5158be50b9b) which also crashes with /norender, but works without it.

Thank you very much for your response!
I'll try my best to convince the owner to upgrade.

The /norender option works on a local Windows machine.
To me, it makes no sense that it crashes with this option, since in theory it requires less resources and uses fewer features than the render mode.

Thanks anyway!
We update the thread if we find out more.