Editing Savegames

From BOTF-Wiki
Revision as of 17:48, 23 September 2009 by Flocke (talk | contribs) (→‎The Shipnames)

Introduction

For editing savegames of BotF, UltimateEditor of DCER is a helpful tool. It already haves some internal capabilities to edit savegames, but alot of functionality is only available by hexediting. Therefore the UltimateEditor has a compfortable menu to extract (and import) files of (or into) a savegame. If you want to extract them manually, you will have to decompress them using the BotF LZSS Algorithm.

To get an Overview about the content of all those files within a savegame, have a look at the Savegame File-Listing!


Moving Ships

Moving existing ships on map is easy! You just have to edit GTForceList and GWTForce and adjust the sector row and sector column.

Adding/Removing Ships and Fleets

Adding or removing ships is alot more complicated.
Each ship belongs to a specific fleet/taskforce and each fleet belongs to a race. So you see that with adding or removing ships, you also need to work on the fleets!

Adjusting the Ship Number

First, the files GShipHead, GTForceHd and GWTForceHd have to contain the new ship count. Their value should be the same.

Adding/Removing the Ships

To add or remove ships, you have to add or remove entries in GShipList. Cause they are stored in blocks of fixed size, you can simply adjust the view width of your hexeditor to have one ship each row. All important values are described in Savegame File-Listing#GShipList.
When adding new ships, you have to care about that you don't choose shipIDs that are already in use. In later turns you might wonder about double entries. But you simply can discard all ship entries above the number stored within GShipHead.
Important is the fleetID, cause each ship needs to be assigned to an existing fleet.

Adjusting the Taskforces

In GTForceList and GWTForce each ship gets assigned to a taskforce. GTForce seems to be reffering to current turn and GWTForce to the next turn. You can simply keep them equal. Again they are stored in blocks of fixed size. The only really important thing is that you keep care of the fleetIDs and shipIDs. Each fleet can contain nine ships and their IDs have to match GShipList.

Race Assignement

For each race there is an alienTFInfo file with the decimal raceID as postfix. These files first contain the number of taskforces of the corresponding race, followed by the corresponding fleetIDs.
For the alienTFInfo files this is an easy adjustment.
The races are in same order as shown in UltimateEditor.

Adjusting the ID counters

Whenever a ship is build or a fleet created, BotF generates an ID for it. For not using the same one twice, it has a counter that gets increased everytime. For the fleetIDs it's stored within TForceCntr and for the shipIDs in ShipCntr. For preventing bugs and crashes, it has to be above the highest ID currently in use. However, cause the used data type is limited, it's best to keep it as low as possible to prevent buffer overflows.

The Shipnames

The shipnames are given iteratively with an increasing counter for the postfix. Reusing same name seems to cause bugs, so you need to care of that it doesn't conflict with already existent ships! Therefore you have to edit shipname.dat when adding ships with names included in BotF shipname list within stbof.res.
shipname.dat consists of several blocks of fixed size, each representing one shipname category.
Within each block, there is a position pointer that get's computed randomly when starting a new game. It just points to the first name used within the category.
Additionally there is a second pointer to the next name to be used of that category. This pointer just gets increased whenever a new name is used of it's category and loops when the end of shipnames within that category is reached. Whenever this pointer reaches the pointer to first choosen name, a counter for the postfix gets increased.

Unfortunately, beside the category and count of ships within that category, it isn't known yet how those name pointers exactly map the name list within stbof.res. If you are unsure how to set the pointers, test it or just increase their postfix counter.

AI/Agents

Adding/Removing ships controlled by AI isn't explored yet. Relevant files are:

Best way is to use maps without of AI.

Adding/Removing Systems