Dynamic Key Variables

Dynamic Key Variables; support/discussion/questions

Moderator: thunderchero

User avatar
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Dynamic Key Variables

Post by Gowron »

Lots of values are accessed by BotF at runtime:
First, static values, which are stored in trek.exe or stbof.res, and loaded into the RAM from there. These values are relatively easy to ahndle, since they do not change, and they can be manipulated by us to see what they're good for.
Second, dynamic values, which are only visible while the game is running. These are harder to keep track of, but some of them are of paramount importance, so when stumbling across them in the assembler code, it would be good to know what they do.

A lot of the dynamic data is just table after table (star systems etc.), but there are some "key" variables relatively close to the beginning of the dynamic data. This topic is to collect as much of them as we can identify, in order to make future assembler analysis easier :)

All known dynamic key variables should be posted here, and I'll add them to the list :)


LIST OF DYNAMIC KEY VARIABLES


58AE7C: address of AIAgtIdCtr (see savegames)
58AE84: address of AITaskIdCtr (see savegames)
58AE88: address of AISysUnt (see savegames)
58AE8C: address of AIShpUnt (see savegames)
58C0B0: address of loaded aibldreq.bin
58FDE0: number of borg cubes in game (58FDD4 & 58FDD8=base for cube names)
58FDF0: address of loaded edifice.bst
58FDF8: address of loaded edifdesc.bst
58FE00: address of loaded edifbnft.bst
590210: address of loaded tecfield.tec
59021C: address of loaded techtree.tec
590220: address of loaded techdesc.tec
590228: address of loaded racetech.tec
590554: address of loaded shiplist.sst
590558: address of loaded shiprace.sst
59055C: address of loaded shipdesc.sst
590560: contains address of the loaded shiptech.sst file
5911B8: address of loaded lexicon.dic
592BF8: address of loaded race.rst
592C0C: address of loaded planet.pst
592C18: address of loaded environ.est
592C1C: address of loaded starname.bin
592C24: address of loaded racedesc.rst
592C28: address of loaded meplanet.bin
592C2C: address of loaded habit.bin
592C30: address of loaded planboni.bin
592C34: address of loaded planspac.bin
592C40: address of loaded ppgrowth.bin (seems unused)
5A2010: points to the start of the loaded alienInfo file found in saved games
5A28D8: points to the start of loaded gameInfo (see savegames)
5A2918: Turn Number
5A2B2A: player empire (0=Card., ..., 4=Roml.)
5A2B2B: predictor for starting EL of minor races
5A2B2C: starting levels for each empire (1 byte each; 0=Lv1, ..., 4=Lv5)
5A2B38: galaxy shape (0=irregular, 1=elliptic, 2=ring, 3=spiral)
5A2B3C: galaxy size (0=small, 1=medium, 2=large)
5A2B40: Minor Races setting (0=none, ..., 3=many)
5A2B44: difficulty level (1=simple, ..., 5=impossible)
5A2B46: random events (0=OFF, 1=ON)
5A36B0: points to the start of loaded galInfo (see savegames)
5A36B4: galaxy shape (0=irregular, 1=elliptic, 2=ring, 3=spiral)
5A36B8: galaxy size (0=small, 1=medium, 2=large)
5A36BC: galactic star system count (includes home systems; does not include anomalies)
5A36BE: galactic anomaly count
5A36C4: total number of squares on galaxy map
5A36C8: address of systInfo (see savegames)
5A36CC: address of stellInfo (see savegames)
5A36D8: address of sector.lst (see savegames)
5A36E0: address of treaty (see savegames)
5A3748: address of treaty (see savegames)
5A3814: points to the start of loaded intelInfo (see savegames)
5B17E8: points to the start of loaded techInfo (see savegames)
5B186B: BORG (0=OFF, 1=ON)
5B1A3D: random events (0=OFF, 1=ON)
5B1A50: galaxy shape (0=irregular, 1=elliptic, 2=ring, 3=spiral)
5B1A54: galaxy size (0=small, 1=medium, 2=large)
5B1A78: Minor Races setting (0=none, ..., 3=many)
5B1A7C: difficulty level (1=simple, ..., 5=impossible)
5B1A90: Mudd cheat (0=OFF, 1=ON)
---> 0x38B27 = F9 cheat [+1,000 Research Points]
---> 0x38B63 = F10 cheat [+10,000 credits]
5B1A98: points to the begining of the loaded empsInfo file found in saved games
5B2344: address of GShipList (aka GshipHead?) (see savegames)
5B2348: address of GTFStasis/GTFStasisHd (see savegames)
5B234C: points to the start of loaded ShipCntr (see savegames)
5B2350: points to the start of loaded TForceCntr (see savegames)
5B2354: address of GTForceList/GTForceHd (see savegames)
5B2358: address of GWTForceHd/GWTForce (see savegames)
5B235E: address of RToSInfo (see savegames)
5B4FE0: player ship population support
5B4FE4: player ship support cost
5B4FF0: address of loaded morale.bin
5B543C: Max ID for ships
5B5568: points to the start of loaded shipname.dat (see savegames)
5B556C: address of loaded shipname.bin
5B58A8: address of loaded combat.bin (seems unused)
5CB2F8: address of loaded race.rst
5CB310: minimum distance between home systems of empires
5CB460: starname count
5CB4E4: Minor Races setting (0=none, ..., 3=many)
5CB4EC: galaxy size (0=small, 1=medium, 2=large)
5CB4F0: galaxy shape (0=irregular, 1=elliptic, 2=ring, 3=spiral)
5CB4F8: starting levels for each empire (1 byte each; 0=Lv1, ..., 4=Lv5)
5CB4FE: difficulty level (1=simple, ..., 5=impossible)

5CB304 through 5CB344:
Galaxy Shape Variables
Last edited by Gowron on Sat Dec 05, 2009 8:13 am, edited 13 times in total.
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
DCER
Code Master
Code Master
Posts: 683
Joined: Sat Apr 26, 2008 2:00 am

Post by DCER »

5A2B2A: player empire
User avatar
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Post by Gowron »

DCER wrote:5A2B2A: player empire
Done :)
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
DCER
Code Master
Code Master
Posts: 683
Joined: Sat Apr 26, 2008 2:00 am

Post by DCER »

5B1A98: points to the begining of the loaded empsInfo file found in saved games

5B4FE0: player ship population support

5B4FE4: player ship support cost
User avatar
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Post by Gowron »

DCER wrote:5B1A98: points to the begining of the loaded empsInfo file found in saved games

5B4FE0: player ship population support

5B4FE4: player ship support cost
Done, sorry for the delay.
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1947
Joined: Sun Apr 27, 2008 2:00 am

Post by Spocks-cuddly-tribble »

5A2B44: difficulty level (1=simple, …, 5=impossible)
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7953
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Post by thunderchero »

I don't understand too much about dynamic key variables, But would think it would be (0=simple, …, 4=impossible) But it would not surprise me if I was wrong.

Also Spocks-cuddly-tribble congrates yours was 10,000 post :lol: I would like to see 2,000,000 pages viewed and 8000 members in first year :D pages we should make but 500 members in little over 1 month will be tough.

still great find, I might have to promote you to a code master yet :wink:

thunderchero
stardust
Rear-Admiral
Rear-Admiral
Posts: 1381
Joined: Sat Apr 26, 2008 2:00 am
Location: good ole Blighty

Post by stardust »

thunderchero wrote:I don't understand too much about dynamic key variables, But would think it would be (0=simple, …, 4=impossible) But it would not surprise me if I was wrong.

thunderchero
I seem to remember from various crash logs i've seen in the past the empires being set from 0-4 so i can see where you're coming from with the difficulty settings being 0-4 Thunderchero.
Computers! [Expletive deleted]

My 4shared folder
User avatar
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Post by Gowron »

Spocks-cuddly-tribble wrote:5A2B44: difficulty level (1=simple, …, 5=impossible)
Done :)

I also added a few other variables :)
thunderchero wrote:I don't understand too much about dynamic key variables, But would think it would be (0=simple, …, 4=impossible) But it would not surprise me if I was wrong.
The difficulty level is stored as 1-5 in this case.
It may seem a bit inconsistent, but that's the way it's been implemented.
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1947
Joined: Sun Apr 27, 2008 2:00 am

Post by Spocks-cuddly-tribble »

5A2918: Turn Number
5A2B46: random events (0=OFF, 1=ON)
5B186B: BORG (0=OFF, 1=ON)
5B1A3D: random events (0=OFF, 1=ON)


Have a look at beginning of sub_4BF6C0.
If I understand correctly, we have now up too four times of some variables: :?

5B1A50: galaxy shape (0=irregular, 1=elliptic, 2=ring, 3=spiral)
5B1A54: galaxy size (0=small, 1=medium, 2=large)
5B1A78: Minor Races setting (0=none, ..., 3=many)
5B1A7C: difficulty level (1=simple, ..., 5=impossible)
5CB4E4: Minor Races setting (0=none, ..., 3=many)
5CB4EC: galaxy size (0=small, 1=medium, 2=large)
5CB4F0: galaxy shape (0=irregular, 1=elliptic, 2=ring, 3=spiral)
5CB4FE: difficulty level (1=simple, ..., 5=impossible)


At loc_402945 & loc_493628(et seq) many dynamic variables are explicitly labeled.
But some of them aren't very interesting and they still have to be confirmed & tested.
I post names only (yet).

58ADEC: Initialize State
58AE74: Game Version (Version Under Test)
5A2B34: Starting Seed
5A2B68: TACTICAL
5B1858: HDPATH
5B185C: INSTALL MIN/MAX
5B1864: CURRENTGAME
5B1869: LANGUAGE
5B186A: MOVIEON
5B186C: SOUNDON
5B1870: 3D setting
5B1874: MUSICVOLUME
5B1875: FXVOLUME
5B1876: VIDEOVOLUME
5B1877: VOICEVOLUME
5B1878: SCREENVOLATILE
5B1A38: DIRECT-X installed by BOF
5B1A3C: AUTOSAVE
5B1A40: TACTICAL
5B1A44: TURNSTATUS
5B1A48: TIMELIMIT
5B1A4C: TACTIMELIMIT
5B1A58: CIVLEVEL1
5B1A5C: CIVLEVEL2
5B1A60: CIVLEVEL3
5B1A64: CIVLEVEL4
5B1A68: CIVLEVEL5
5B1A6C: ECONFILTER
5B1A70: EVENTFILTER
5B1A74: MILITARYFILTER
5B1A80: VICTORY
5B1A84: TOOLTIPS
5B1A8C: Starting Seed
5B1A91: Game Version (e.g. 1.0.2)
5B4E70: Turn State
5CB4E8: TACTICAL

thunderchero wrote:I might have to promote you to a code master yet :wink:
lol, don't think so, more than half an hour per week and I start seeing tribbles rolling through the code lines…:x
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Post by Gowron »

Spocks-cuddly-tribble wrote:5A2918: Turn Number
5A2B46: random events (0=OFF, 1=ON)
5B186B: BORG (0=OFF, 1=ON)
5B1A3D: random events (0=OFF, 1=ON)


Have a look at beginning of sub_4BF6C0.
If I understand correctly, we have now up too four times of some variables: :?

5B1A50: galaxy shape (0=irregular, 1=elliptic, 2=ring, 3=spiral)
5B1A54: galaxy size (0=small, 1=medium, 2=large)
5B1A78: Minor Races setting (0=none, ..., 3=many)
5B1A7C: difficulty level (1=simple, ..., 5=impossible)
5CB4E4: Minor Races setting (0=none, ..., 3=many)
5CB4EC: galaxy size (0=small, 1=medium, 2=large)
5CB4F0: galaxy shape (0=irregular, 1=elliptic, 2=ring, 3=spiral)
5CB4FE: difficulty level (1=simple, ..., 5=impossible)
All included now :)
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
DCER
Code Master
Code Master
Posts: 683
Joined: Sat Apr 26, 2008 2:00 am

Post by DCER »

5A2010: points to the start of the loaded alienInfo file found in saved games

590560: contains address of the loaded shiptech.sst file
User avatar
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Post by Gowron »

DCER wrote:5A2010: points to the start of the loaded alienInfo file found in saved games

590560: contains address of the loaded shiptech.sst file
Done :)
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1947
Joined: Sun Apr 27, 2008 2:00 am

Post by Spocks-cuddly-tribble »

58C0B0: address of loaded aibldreq.bin
58FDE0: number of borg cubes in game (58FDD4 & 58FDD8=base for cube names)
58FDF0: address of loaded edifice.bst
58FDF8: address of loaded edifdesc.bst
58FE00: address of loaded edifbnft.bst
590210: address of loaded tecfield.tec
59021C: address of loaded techtree.tec
590220: address of loaded techdesc.tec
590228: address of loaded racetech.tec
590554: address of loaded shiplist.sst
590558: address of loaded shiprace.sst
59055C: address of loaded shipdesc.sst
5911B8: address of loaded lexicon.dic
592C0C: address of loaded planet.pst
592C18: address of loaded environ.est
592C1C: address of loaded starname.bin
592C24: address of loaded racedesc.rst
592C2C: address of loaded habit.bin
592C30: address of loaded planboni.bin
592C34: address of loaded planspac.bin
592C40: address of loaded ppgrowth.bin (seems unused)
5A28D8: points to the start of loaded gameInfo (see savegames)
5A2B2B: predictor for starting EL of minor races
5A36B0: points to the start of loaded galInfo (see savegames)
5A3814: points to the start of loaded intelInfo (see savegames)
5B17E8: points to the start of loaded techInfo (see savegames)
5B1A90: Mudd cheat (0=OFF, 1=ON) (0x38B27=F9-FPs /0x38B63=F10-credits)
5B2344: address of GShipList (aka GshipHead?) (see savegames)
5B2348: address of GTFStasis/GTFStasisHd (see savegames)
5B234C: points to the start of loaded ShipCntr (see savegames)
5B2350: points to the start of loaded TForceCntr (see savegames)
5B2354: address of GTForceList/GTForceHd (see savegames)
5B2358: address of GWTForceHd/GWTForce (see savegames)
5B235E: address of RToSInfo (see savegames)
5B4FF0: address of loaded morale.bin
5B543C: Max ID for ships
5B5568: points to the start of loaded shipname.dat (see savegames)
5B556C: address of loaded shipname.bin
5B58A8: address of loaded combat.bin (seems unused)
5CB460: starname count
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Post by Gowron »

All included now :)
..............................
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
Post Reply

Return to “Dynamic Key Variables”