Crew Experience
Moderator: thunderchero
Crew Experience
That's why a Worf will always beat a Wesley
The first 2 sections contain information about how Crew Experience works, and the 3rd section addresses modding this stuff by editing values in trek.exe.
1. Amount of Exp. Points gained during battle
To get Exp. Points from a battle, you must enter the tactical combat screen. "Auto" and "Hail" (before the battle) will result in zero points.
There are three "sources" of Exp. Points during battle:
a) The sum of points of damage that your ships do to enemies with beam and/or torpedo weapons (damage from ramming doesn't count).
b) A bonus for every enemy ship that retreats. The bonus is
0.05 * [combined nominal shield+hull hit points of retreated ship]
c) Invisible overflow damage (only if your ships still have weapon capacity left when all enemies are destroyed). This extra damage is hard to predict, but has to be equal to or lower than the unused weapon capacity.
The values from a, b and c are added and equally divided (rounded up if not integer) between your surviving ships.
2. Effect of the Crew Experience Level
For every Exp. Level above "Green", a ship gains +5 Defense, +5 Beam Accuracy and most probably also +5 Torpedo Accuracy (the TA is not displayed anywhere).
Sometimes these effects don't "kick in" immediately and you have to get the ship into 1 or 2 more tactical combats so that the effect is updated.
3. Relevant values in trek.exe
All values are stored as 4-byte integers. It seems that they're all signed (though I wouldn't recommend negative values).
a) Bonuses
Bonus for Klingon ships
position: 0x4577F
default value: 350
NOTE: This value is skipped if the system has a running Combat Training Facility (such as Starfleet Academy).
Bonus for systems with a Combat Training Facility
position: 0x45872
default value: 700
b) Thresholds
There are 5 different Exp. Levels in BotF, hence 4 threshold values. Each value is stored 3 times in trek.exe. The 3 numbers don't necessarily have to be the same, but normally it doesn't make sense to use different values for the same threshold.
threshold value for 2nd star ("normal" crew)
position1: 0x48F36
position2: 0x48FBB
position3: 0x7011F
default value: 700
threshold for 3rd star ("veteran" crew)
position1: 0x48F2F
position2: 0x48FA8
position3: 0x70117
default value: 1500
threshold for 4th star ("elite" crew)
position1: 0x48F28
position2: 0x48F95
position3: 0x7010F
default value: 5000
threshold for 5th star ("legendary" crew)
position1: 0x48F21
position2: 0x48F78
position3: 0x70107
default value: 8000
[position1] is used every turn to determine the new experience levels of all ships that currently have the "crew training" order.
[position2] is used to determine the experiance level description ("legendary" etc.) of the ships when assinging formations on the F1 screen.
[position3] is used after every battle to determine the new experience levels of a ships that survived that battle.
Like I wrote above, it's possible to use different values at the 3 resp. positions, but that can result in "downgrading" after battle resp. during training, since the new experience level is determined using only [position1] resp. only [position3], without looking at the old experience level.
New ships will always start with 1 star except if they're built at a system with a Combat Training Facility (in that case it's 2 stars). The number of stars will only be updated during training and after every tactical combat.
The first 2 sections contain information about how Crew Experience works, and the 3rd section addresses modding this stuff by editing values in trek.exe.
1. Amount of Exp. Points gained during battle
To get Exp. Points from a battle, you must enter the tactical combat screen. "Auto" and "Hail" (before the battle) will result in zero points.
There are three "sources" of Exp. Points during battle:
a) The sum of points of damage that your ships do to enemies with beam and/or torpedo weapons (damage from ramming doesn't count).
b) A bonus for every enemy ship that retreats. The bonus is
0.05 * [combined nominal shield+hull hit points of retreated ship]
c) Invisible overflow damage (only if your ships still have weapon capacity left when all enemies are destroyed). This extra damage is hard to predict, but has to be equal to or lower than the unused weapon capacity.
The values from a, b and c are added and equally divided (rounded up if not integer) between your surviving ships.
2. Effect of the Crew Experience Level
For every Exp. Level above "Green", a ship gains +5 Defense, +5 Beam Accuracy and most probably also +5 Torpedo Accuracy (the TA is not displayed anywhere).
Sometimes these effects don't "kick in" immediately and you have to get the ship into 1 or 2 more tactical combats so that the effect is updated.
3. Relevant values in trek.exe
All values are stored as 4-byte integers. It seems that they're all signed (though I wouldn't recommend negative values).
a) Bonuses
Bonus for Klingon ships
position: 0x4577F
default value: 350
NOTE: This value is skipped if the system has a running Combat Training Facility (such as Starfleet Academy).
Bonus for systems with a Combat Training Facility
position: 0x45872
default value: 700
b) Thresholds
There are 5 different Exp. Levels in BotF, hence 4 threshold values. Each value is stored 3 times in trek.exe. The 3 numbers don't necessarily have to be the same, but normally it doesn't make sense to use different values for the same threshold.
threshold value for 2nd star ("normal" crew)
position1: 0x48F36
position2: 0x48FBB
position3: 0x7011F
default value: 700
threshold for 3rd star ("veteran" crew)
position1: 0x48F2F
position2: 0x48FA8
position3: 0x70117
default value: 1500
threshold for 4th star ("elite" crew)
position1: 0x48F28
position2: 0x48F95
position3: 0x7010F
default value: 5000
threshold for 5th star ("legendary" crew)
position1: 0x48F21
position2: 0x48F78
position3: 0x70107
default value: 8000
[position1] is used every turn to determine the new experience levels of all ships that currently have the "crew training" order.
[position2] is used to determine the experiance level description ("legendary" etc.) of the ships when assinging formations on the F1 screen.
[position3] is used after every battle to determine the new experience levels of a ships that survived that battle.
Like I wrote above, it's possible to use different values at the 3 resp. positions, but that can result in "downgrading" after battle resp. during training, since the new experience level is determined using only [position1] resp. only [position3], without looking at the old experience level.
New ships will always start with 1 star except if they're built at a system with a Combat Training Facility (in that case it's 2 stars). The number of stars will only be updated during training and after every tactical combat.
Last edited by Gowron on Sat Aug 09, 2008 5:23 pm, edited 1 time in total.
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
No, the terraforming rate of colony ships and the ground combat strengths of troop transports are both determined by the "production" value in shiplist.sst and do not change with the crew experience level.Spocks-cuddly-tribble wrote:Is it really true that crew experience has an influence of the functionality of colony ships and/or troop transports beside of tactical combat ?
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
No, outposts/starbases do not have experience levels, so any training effort would be "wasted".Badbru wrote:However on this matter of TroopTransports and their experience level, if it has no effect on ground combat does the crew experience carry over to outposts and/or starbases built with Veteran or Elite TroopTransports?
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
- Spocks-cuddly-tribble
- Code Master
- Posts: 1961
- Joined: Sun Apr 27, 2008 2:00 am
This is really strange - any idea of the cause ?Gowron wrote:Sometimes these effects don't "kick in" immediately and you have to get the ship into 1 or 2 more tactical combats so that the effect is updated.
Seemingly no downgrading issue.
Unfortunately this occurs for ships at threshold if engaged without getting experince points (almost always Retreat/Hail or F1 Auto/Hail).Gowron wrote:that can result in "downgrading" after battle resp. during training, since the new experience level is determined using only [position1] resp. only [position2], without looking at the old experience level.
It stays then downgraded untill added new experince points.
Badbru wrote:TroopTransports and their experience level
Indeed TT experience could be even a disadvantage.Gowron wrote:any training effort would be "wasted"
In my(not scientifical) experience, sometimes orbital batteries prefers to attack more experienced ships/task forces.
As a side note: Winning a battle only with stations or ships which can't get experience points in battle (colony & TT) seeming gives no moral table bonus.
Though the victory is stored in the event list.
[EDIT: ship function decides (05/Colony, 06/Outpost, 07/Starbase & 09/Troop Transport) not armament]
Last edited by Spocks-cuddly-tribble on Sun Jun 14, 2009 11:12 am, edited 2 times in total.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
- The_Nighthawk
- Lieutenant-Commander
- Posts: 149
- Joined: Tue May 06, 2008 2:00 am
- Location: Vancouver, BC Canada (GMT-8)
- Contact:
I think it places the oldest ships first (meaning the ones you built first, that would have the lowest internal ID #), and chances are good those will be your most experienced ships.Martok wrote:Spocks-cuddly-tribble wrote:In my(not scientifical) experience, sometimes orbital batteries prefers to attack more experienced ships/task forces.
That's been my experience as well.
Actually, that's not quite the problem. The problem is that OB's go after whichever task force is at the top of the list (assuming there's multiple task forces in the same sector), and the game always places the most experienced task force at the top for some retarded reason.
I think he means if those ships do not have guns. You need a warship with the starbase to get exp and the morale bonus.Martok wrote:How do you mean? I know that a lone outpost/starbase defeating an enemy by itself doesn't bestow a morale bonus, but you *will* get a morale bonus if ships are also defending the starbase.Spocks-cuddly-tribble wrote:As a side note: Winning a battle only with stations or ships which can't get experience points in battle (colony & TT) seeming gives no moral table bonus.
Playing BoP whenever the wife allows!
- Spocks-cuddly-tribble
- Code Master
- Posts: 1961
- Joined: Sun Apr 27, 2008 2:00 am
Re: Crew Experience
I penetrated the bug-ridden mystery.Gowron wrote:Sometimes these effects don't "kick in" immediately and you have to get the ship into 1 or 2 more tactical combats so that the effect is updated.
This made us really look ridiculous. It was for years before our very eyes and we were unable to discover it.
There are seemingly two bugs in the concept of crew experience.
Sorry, all wrong. That almost has axed my findingsGowron wrote:[position1] is used after every battle to determine the new experience levels of a ships that survived that battle.
[position2] is used every turn to determine the new experience levels of all ships that currently have the "crew training" order.
[position3] is used to determine the experiance level description ("legendary" etc.) of the ships when assinging formations on the F1 screen.
P1 is the training check.
NOTE: Probably a bug in the check routine disabled the update of the Defense/Accuracy level.
>-Even ships built in a running Combat Training Facility starts by +0 Defense/Accuracy level !
>-So Defense/Accuracy level is always "frozen" at +0 or the last P3 check.
>>> That's important to know in order to prevent confusion ! <<<
P2 is the F1 experiance level description check - the only one without a bug.
NOTE: It doesn't affect the parallel description in tactical combat !
P3 is the after battle check.
NOTE: An error in the check routine causes the downgrad (or not upgrade) bug at threshold:
Spocks-cuddly-tribble wrote:Unfortunately this occurs for ships at threshold if engaged without getting experince points (almost always Retreat/Hail or F1 Auto/Hail).
It stays then downgraded untill added new experince points.
NOTE: The battle check P3 works also after every F1-"Auto/Hail" (no tactical combat necessary).Gowron wrote:The number of stars will only be updated during training and after every tactical combat.
> That's important too !
A shocking Example of the P1 bug :
A player sends his well trained fleet after long peacetime (excluded of some scouts never engaged) into the most decisive battle of the whole game. All displays shows the actual training level. Even the Raid/Intercept bonus (especially interresting for ships of function 01/destroyer) works fine.
During this (first) tactical combat, the experience label, the damage control level and the ship stars are displayed belong the current trainig level.
But all those displays are useless. Because only Defense/Accuracy level (excepting Damage Control) works in tactical combat. And this will updated only by P3 check (after battle).
So indeed this player is commanding a green fleet during the battle effectively !
A wise counsel !ruthlessferengi wrote:i prefer to train my merchants in battle...
Example 2 (check madness) :
A destroyer/01 is trained to the exact threshold of legendary and never engaged yet.
All displays shows legendary level, including Raid/Intercept bonus (+40/+100).
Now it heals the Edo guardian in tactical combat.
Only Defense/Accuracy shows +0 (green level) during this event, all other displays shows legendary level.
After that, the ship is downgraded (to elite level; Raid/Intercept bonus +30/+80) and upgraded (Defense/Accuracy gained from +0/green to +15/elite) at the same time!!!
Only F1 experience level description shows still "legendary" (P2 check).
No need to cry for a consoler. - This can be solved:
Fixing the downgrade bug
Gowron wrote:normally it doesn't make sense to use different values for the same threshold...that can result in "downgrading" after battle...
......exactly this is necessary in order to solve the downgrade bug.Q wrote:Au contraire, mon Capitain !
Like I wrote, there is clearly an error in the P3 check routine. It checks 'greater' instead of 'greater or equal' like P1/P2.
So lowering all P3 thresholds by a point finally fixes the P3 downgrad bug.
In the case of vanilla: 699 / 1499 / 4999 / 7999.
Example 3 (after fixed the downgrade bug) :
The destroyer from Example 2 is now properly upgraded to Defense/Accuracy +20 (legendary level) without any downgrading.
This is solved too. Never needed a second P3 check.Gowron wrote:Sometimes these effects don't "kick in" immediately and you have to get the ship into 1 or 2 more tactical combats so that the effect is updated.
But of course this is a "dirty" solution.
So a question for computer guys:
If we know the location of the check mechanics of P1 & P3 and compare the codes, then there should be only two differences :
The 'greater' P3 and 'greater or equal' P1 sequence & the P1 bug or omission that disabled the update of the Defense/Accuracy level.
Is it possible to fix this by simple "mirror-part" overwriting
PS: Is there any known usage for experience points above threshold of the 5th star, or is every further trainig/experience wasted
Last edited by Spocks-cuddly-tribble on Sun Jun 14, 2009 11:57 am, edited 2 times in total.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
The code is where Gowron found it and can be changed.
P1 and P3 are very similar. The difference is just like you named it.
To make P3 to work the same as P1 you need to change 7F to 7D at these locations:
0x7010B, 0x70113, 0x7011B
The last one isn't really needed, but to be consistent change 7E to 7C at 0x70123
Good work, Tribble
EDIT:
P1 and P3 are very similar. The difference is just like you named it.
To make P3 to work the same as P1 you need to change 7F to 7D at these locations:
0x7010B, 0x70113, 0x7011B
The last one isn't really needed, but to be consistent change 7E to 7C at 0x70123
Good work, Tribble
EDIT:
Looking at the code, it's wasted.PS: Is there any known usage for experience points above threshold of the 5th star, or is every further trainig/experience wasted Question
Updated the article (corrected the swapped position descriptions). Somehow it felt like I had corrected this before. Maybe it was an update that was lost when the forums crashed.
Thanks to Tribble and DCER for doublechecking and analyzing this stuff
Thanks to Tribble and DCER for doublechecking and analyzing this stuff
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
- Spocks-cuddly-tribble
- Code Master
- Posts: 1961
- Joined: Sun Apr 27, 2008 2:00 am
Thank you, it is needed. Four thresholds = four changes.DCER wrote:The last one isn't really needed, but to be consistent change 7E to 7C at 0x70123
This one fixes the "regular" downgrade.
=> But is there a way to enable the P1 Defence/Accuracy update
===================================================
In addition I investigated the Raid/Intercept mechanics. For easier search it might be better in it's own thread, but for the sake of completeness I post it as supplement to Effect of the Crew Experience Level.
As you probably expect, it's a little bit confusingly. That's mainly caused by strong differences of the Raid/ Intercept calculations.
Task force RAID value
The Raid base value (BV) depends on current task-force owner (defaults):
Code: Select all
Cardassian: 10
Federation: 5
Ferengi: 30
Klingon: 20
Romulan: 15
BV + 5 per task-force ship + per 01/destroyer (experience stars - 1) * 10
(i.e. for every destroyer Exp. Level above "Green" +10)
Maybe it's a bug/omission, except of 01/destroyer, crew experience dosen't affect Raiding.
Colony ships and troop transports do support Raiding task-forces, but cannot Raid alone.
EDIT: Gowron has found the code location of the Raiding Percentages
Task force INTERCEPT value
Intercept base value is always 20. Thus, I'm not sure how it is determined.
The bonus per experience level(beginning with Green!) depends on ship function:
Code: Select all
00/scout +5
01/destroyer +20
02/cruiser +3
03/strike +2
04/command +1
05/colony +0
09/troop tr. +0
03/strike and 04/command do support Intercepting task-forces, but cannot Intercept alone -> button disabled.
Note: As suspected, AI controlled ships do it even so.
Colony ships and troop transports don't support Intercept.
EDIT: code has been found ->Intercept percentage
EDIT:
Also all myths regarding command ships can share experience points/level with other ships are clearly disproved:
ship function 04 /for "command and control"
Last edited by Spocks-cuddly-tribble on Sun Jun 14, 2009 11:58 am, edited 2 times in total.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
Hi, there. I have a few questions for you:
1) You've given the bonus for Klingon ships as being at position: 0x4577F (default value: 350). What about the other four major races? Where is the info located in trek.exe for them?
2) Is the given bonus for systems with a Combat Training Facility at position: 0x45872 (default value: 700) for all such facilities and all races or just the Klingons?
3) It's great to have the threshold values storage locations as I've recently been considering 'moving the goal posts' (so to speak) for the various experience levels to make them a bit more meaningful and to reduce the 'waste' of any experience gained above 'legendary' status. But I wonder just how high I can set the last threshold value? You said that the values are stored as 4-byte integers. Is that in hex or decimal? (if hex the highest I can set it to is FFFF (=65535), if decimal then it's only 9999 (=270F).)
4) Have I got the 'downgrade bug fix' right? Both the lowering of all the P3 thresholds by a point (ie vanilla: 699 / 1499 / 4999 / 7999) and making P3 work the same as P1 by changing 7F to 7D at 0x7010B, 0x70113, 0x7011B and 7E to 7C at 0x70123 are required to correct the problem?
1) You've given the bonus for Klingon ships as being at position: 0x4577F (default value: 350). What about the other four major races? Where is the info located in trek.exe for them?
2) Is the given bonus for systems with a Combat Training Facility at position: 0x45872 (default value: 700) for all such facilities and all races or just the Klingons?
3) It's great to have the threshold values storage locations as I've recently been considering 'moving the goal posts' (so to speak) for the various experience levels to make them a bit more meaningful and to reduce the 'waste' of any experience gained above 'legendary' status. But I wonder just how high I can set the last threshold value? You said that the values are stored as 4-byte integers. Is that in hex or decimal? (if hex the highest I can set it to is FFFF (=65535), if decimal then it's only 9999 (=270F).)
4) Have I got the 'downgrade bug fix' right? Both the lowering of all the P3 thresholds by a point (ie vanilla: 699 / 1499 / 4999 / 7999) and making P3 work the same as P1 by changing 7F to 7D at 0x7010B, 0x70113, 0x7011B and 7E to 7C at 0x70123 are required to correct the problem?
Spocks-cuddly-tribble wrote:1.) This is a klingons only feature. Other races start with zero EPs.
2.) Its a shared value for all major & minor buildings.
3.) Code is always in hex (just 0-9 looks the same way as dec) and 65535/FF FF is two bytes (unsigned).
Read this hex-guide: http://www.members.aon.at/zelli/shiplist.htm
4.) NO, just one of them. DCER's code change is more elegant.
Re: Crew Experience
Code for selecting the Klingon race for boni is located at:Gowron wrote: a) Bonuses
Bonus for Klingon ships
position: 0x4577F
default value: 350
NOTE: This value is skipped if the system has a running Combat Training Facility (such as Starfleet Academy).
Bonus for systems with a Combat Training Facility
position: 0x45872
default value: 700
Code: Select all
00446368 cmp byte ptr [ebp+4Ch], 3
0044636C jnz short loc_446383
in hex this means changing:
Code: Select all
0x045768 80 7D 4C 03
0x04576C 75 15
Code: Select all
0x045768 80 7D 4C 02
0x04576C 74 15
life long and prosper
- Spocks-cuddly-tribble
- Code Master
- Posts: 1961
- Joined: Sun Apr 27, 2008 2:00 am
Quite the contrary, ID 5-22h(+jz) excludes a minor-race. Monsters appear to be unaffected by Exp.effects (EPs in GShipList seem meaningless).DOT wrote:if race id is set to value higher than 4 (e.g. race id of Alien monsters). Than not only all major ships would have 350 (or modified value) experience points, but also the minor ships.
Also note the feature is pointless if applied to all majors and/or minors (just the same effect as lowering thresholds). The point here is an advantage/disadvantage for spezific race(s) i.e. diversity and unique gameplay.
So all this would share same effect & purposelessness:
-> race ID > 0x22
-> disabling the jump
-> changing asm 44A8B9 mov dword ptr [ecx+40h], 0 (start EPs for all ships /skipped by Klingon feature & Training Facilities)
Anyhow, it's time for a complete overhaul of the concept of Crew Experience, including fixes of all remaining bugs, functioning code for broken features and adding of some new functionalities to BotF.
First off a recap and some remarks for the sake of clarity:
[position1] => sub_449B20 -> (Defense/Accuracy bug)Gowron wrote:[position1] is used every turn to determine the new experience levels of all ships that currently have the "crew training" order.
[position2] is used to determine the experience level description ("legendary" etc.) of the ships when assinging formations on the F1 screen.
[position3] is used after every battle to determine the new experience levels of all ships that survived that battle.
[position2] => sub_449B74
[position3] => sub_470D00 -> (downgrade bug)
NOTE: All following modifications presuppose the downgrade bug fix:
At 0x7010B, 0x70113 & 0x7011B change 7F to 7D and at 0x70123 change 7E to 7C
From now on I will assume that this is already done.
-> sub_449B20 (64bytes+14unused above) is not longer in use after the training bug fix (chapter 2 resp.3) i.e. the [position1] thresholds can be ignored now.
-> This sends also [position2] thresholds into disuse:
Code: Select all
In trek.exe at 0x48F76 replace:
40 3D 40 1F 00 00 7C 16
with:
44 FF 24 85 60 9B 44 00
449B74 mov eax, [eax+44h]
449B77 jmp off_449B60[eax*4]
1. Newly Built Ships (bug-fix) (sub_446240)
Spocks-cuddly-tribble wrote:ships built in a running Combat Training Facility start by +0 Defense/Accuracy
Here's a replacement code in order to redress the both issues, i.e. Crew Experience Level as well as Defense/Accuracy Bonus of newly built ships is now always accurate.Gowron wrote:New ships will always start with 1 star except if they're built at a system with a Combat Training Facility (in that case it's 2 stars).
Code: Select all
In trek.exe at 0x4576D
replace:
15 83 BC 24 C4 02 00 00 01 7D 0B C7 84 24 C0 02 00 00 5E 01 00 00 8D 84 24 80 02 00
with:
10 90 90 90 90 90 C7 84 24 C0 02 00 00 5E 01 00 00 8D 84 24 80 02 00 00 E8 76 A9 02
At 0x45877 change 01 to 00
AND at 0x4588A change DA to F0
New code at asm 44636C:
jnz short loc_44637E
nop ( 5x )
mov dword ptr [esp+2C0h], 15Eh
loc_44637E:
lea eax, [esp+280h]
call sub_470D00 =>[position3]
(…)
446476 mov edi, 0 (better remove 446476 & 446482)
(…)
446489 jmp loc_44637E
Race ID (03/Klingons) is still at 0x4576B
1b. Possible Bonus Feature (additional Facility Bonus)
As an example, this makes ships built by a Zakdorn Training Facility start with 1500 EPs instead of 700:
Code: Select all
In trek.exe at 0x45876
replace:
BF 01 00 00 00 89 B4 24 C0 02 00 00 89 BC 24 C4
with:
80 7D 44 22 75 06 BE DC 05 00 00 90 89 B4 24 C0
New code at asm 446476:
cmp byte ptr [ebp+44h], 22h / ebp+44h=Inhabitant-ID 0x22=Zakdorn
jnz short loc_446482 / ( skip next )
mov esi, 5DCh / new(additional) Facility Bonus
nop
mov [esp+2C0h], esi
0x4587D (DC 05 00 00) = start EPs for new special bonus
0x45879 (22) = Race ID
0x45878 (44) = compare to Inhabitant-ID (4C=compare to controlling race ID)
0x4587A (75) = jump condition
2. Fixing the training bug (sub_4690C0)
NOTE: The replacement code in chapter 3 already includes this fix.Spocks-cuddly-tribble wrote:training...a bug in the check routine disabled the update of the Defense/Accuracy level
I'll also provide the code for a self-contained bug-fix:
Code: Select all
In trek.exe at 0x68556
replace:
8B 42 40 E8 C2 09 FE FF 39 C6 7D 3E 89 F0 89 47 44
with:
89 D0 E8 A3 7B 00 00 90 90 90 90 90 90 90 90 90 90
New code at asm 469156:
mov eax, edx
call sub_470D00 =>[position3]
nop (10x until 469167 inc ebx)
3. Enabling the Training Limits (broken feature fix)
The game manual tells that only Klingons can reach the 'Legandary' level by training. (I read somewhere minor facilities also, iirc). Now it turned out that the unfinished code for this is there and it can be activated.
Code: Select all
In trek.exe at 0x6854B
replace:
89 C2 89 C7 8B 44 24 08 01 42 40 8B 42 40 E8 C2 09 FE FF 39 C6 7D 3E 89 F0 89 47 44
with:
3B 70 40 76 17 8B 54 24 08 01 50 40 3B 70 40 7D 03 89 70 40 E8 9C 7B 00 00 90 90 90
New code at asm 46914B:
cmp esi, [eax+40h]
jbe short loc_469167
mov edx, [esp+8]
add [eax+40h], edx
cmp esi, [eax+40h]
jge short_( skip next )
mov [eax+40h], esi
call sub_470D00 =>[position3]
nop (3x)
loc_4691A0 -> unused = space for an additional limit or building slots
By default there are three slots for IDs of Training Facilities and two Training Limits involved, which I call limit A and limit B.
Formally, the function can be written as:
IF Training Facility on the list THEN [limit A] ELSE [limit B]
Slots and IDs for Training Facilities:
Code: Select all
46912A cmp dx, 39h // 0x6852D
46918D cmp dx, 55h // 0x68590
469193 cmp dx, 2Bh // 0x68596
Thus the defaults stand for:
0x6852D (0x39) -> Andorian War College
0x68590 (0x55) -> Zakdorn Military Academy
0x68596 (0x2B) -> Klingon Tactical College
vanilla edifice.bst defaults for:
(0x19) -> Cardassian Central Command
(0x25) -> Starfleet Academy
(0x32) -> Romulan Naval Academy
For minor buildings it seems = RaceID + 0x33 (matching the table in sub_4C22F8)
But best is doublechecking of modded edifice.bst files. (Adapting edifice at +0x54 is NOT a good idea, btw )
Training Limits: (4-byte integer)
Code: Select all
[limit A]:
469130 mov esi, 5 / 0x68531
[limit B]:
469199 mov esi, 4 / 0x6859A
In the case of vanilla this will make it work as intended:
At 0x68531 (05 00 00 00) [limit A] = 0x1F40 / 'Legendary' threshold -> 8000(dec)
At 0x6859A (04 00 00 00) [limit B] = 0x1388 / 'Elite' threshold -> 5000(dec)
NOTE: The limits A and B are interchangeable at will.
How to make use of it without code altering (example):
Say we want to adapt BoP in order to set general training limit to Elite and to Veteran for the new "Training Facility".
We set 0x6852D, 0x68590 & 0x68596 each to 0x14 (found in BoP edifice.bst at "Training Facility"+0x54). We could also use two invalid IDs of course. Then 0x68531 [limit A] = 2500(dec) and 0x6859A [limit B] = 4000(dec).
Thresholds aren't a must. Here I use them for clearness and (in case of Legendary) in order to prevent BotF from unneeded calculations.
In theory a limit above the legendary threshold is meaningless (at least unmodded ).
4. Altering the effect (concept) of the crew experience level
The Experience Level determines upon all known effects of Crew Experience:
-> RAID (sub_469760)
-> INTERCEPT (sub_46A3E8)
-> Damage Control (loc_52154D:)
-> Accuracy/Defense bonus (sub_470D00)
-> Displayed Pips (loc_4ECDDA:)
-> Experience Level Description-F1 Formations (sub_449B74)
-> Experience Level Description-Tactical Combat (loc_unknown)
A bit too much power for such a little, unsophisticated value while direct accessing EPs provides an interesting opportunity for more diversity and smoother progress.
Let's have a closer look at the Accuracy/Defense bonus:
GShipList:
0x2C = Experience Bonus for Beam Accuracy
0x30 = Experience Bonus for Torpedo Accuracy
0x34 = Experience Bonus for Defense
0x40 = Experience Points
0x44 = Experience Level (0=green / 4=legendary)
Code: Select all
sub_470D00 =>[position3]
470D2C mov ecx, [eax+44h] / ecx = Experience Level
470D2F lea edx, ds:0[ecx*4] / edx = 4 * EL
470D36 add edx, ecx / edx = 5 * EL
470D38 mov ecx, [eax+44h] / R
470D3B mov [eax+2Ch], edx / store Beam Accuracy bonus
470D3E lea edx, ds:0[ecx*4] / R
470D45 add edx, ecx / R
470D47 mov ecx, [eax+44h] / R
470D4A mov [eax+30h], edx / store Torpedo Accuracy bonus
470D4D lea edx, ds:0[ecx*4] / R
470D54 add edx, ecx / R
470D56 mov [eax+34h], edx / store Defense bonus
R = redundant (unmodded)
Aim is that Experience Points above the threshold of Legendary still have a meaning and that the bonus for klingon ships has at least a small impact right from beginning.
As a first approach, the following code gives Green ships each +1 Accuracy/Defense bonus per reached 256 EPs and Legendary ships, beginning with 10000 EPs, each +1 per reached 2048 EPs e.g. 8000+ ->20, 10000+ ->21, 12048+ ->22, 14096+ ->23 (the relative low effect to prevent balance issues):
Code: Select all
In trek.exe at 0x70138
replace:
8B 48 44 89 50 2C 8D 14 8D 00 00 00 00 01 CA 8B 48 44 89 50 30 8D 14 8D 00 00 00 00 01 CA
with:
EB 16 81 C2 F0 00 00 00 C1 EA 0B 83 C2 10 90 90 90 90 90 90 90 90 90 90 89 50 2C 89 50 30
At 0x70164 change C7 to D5
And at 0x70177
replace:
C7 40 44 00 00 00 00 EB AC
with:
C1 EA 08 85 D2 74 DB EB D0
New code at asm 470D38:
jmp short loc_470D50
loc_470D3A:
add edx, F0h => A (=240)
shr edx, 0Bh => B (=11)
add edx, 10h => C (=16)
nop (10x)
loc_470D50:
mov [eax+2Ch], edx
mov [eax+30h], edx
470D63 jmp short loc_470D3A
loc_470D77:
shr edx, 8 => X (=8)
test edx, edx
jz short loc_470D59
jmp short loc_470D50
(Accuracy/Defense bonus)
-> Green = EPs / 2^X
-> Regular, Veteran & Elite = 5 * Experience Level
-> Legendary = [ (EPs + A) / 2^B ] + C
Trek.exe locations of moldable variables:
A => 0x7013C
B => 0x70142
C => 0x70145
X => 0x70179
The formula looks a bit nasty, but the implementation of of a Cube Root calculation, approximately matching the given vanilla defaults, is beyond my programming skills...
EDIT:
Some possible bonus features for 1. Newly Built Ships bug-fix (see above).
(thanks to DOT for correcting a code error)
A.) Klingon bonus only for ships built in native systems
Code: Select all
trek.exe at 0x45768
replace:
80 7D 4C 03 75 10 90 90 90 90 90
with:
8B 45 4C 23 45 44 83 F8 03 75 0B
asm 446368:
mov eax, [ebp+4Ch]
and eax, [ebp+44h]
cmp eax, 3
jnz short loc_44637E
B.) Race specific starting EPs for empires (replaces klingon bonus)
Code: Select all
trek.exe at 0x45768
replace:
80 7D 4C 03 75 10 90 90 90 90 90 C7 84 24 C0 02 00 00 5E 01
with:
0F B6 45 4C 3C 04 7F 0E 8B 34 85 XX XX XX XX 89 B4 24 C0 02
(XX = asm!-address of your new emps_starting_EPs data field)
replacement at asm 446368:
movzx eax, byte ptr [ebp+4Ch]
cmp al, 4
jg short loc_44637E
mov esi, ds:emps_starting_EPs[eax*4]
mov [esp+2C0h], esi
3D 88 13 00 00 7C 0C B8 03 00 00 00 FF 24 85 60 9B 44 00 3D with Emps starting EPs (5-Empires x 4-Bytes = 20).
You can create a similar code for race specific facility bonuses.
C.) Race specific starting EPs for empires - added to facility bonuses
Same code as B.) but last statement changed to:
add [esp+2C0h], esi -> 01 B4 24 C0 02 00 00
AND at
446489 jmp loc_446368 -> reset at 0x4588A -> F0 to DA
EDIT:
=> some bugs when using more than one training facility per system
Last edited by Spocks-cuddly-tribble on Thu Oct 29, 2009 3:26 pm, edited 1 time in total.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
- Spocks-cuddly-tribble
- Code Master
- Posts: 1961
- Joined: Sun Apr 27, 2008 2:00 am
Strengthening AI Ships in Tactical Combat
Coming back to one of my first projects at AFC,
since the above 4. Altering the effect of the crew experience level, due to its abstract nature and adjustment requirements, never reached great popularity, here is an alternative which could be more desirable.
The prerequisites are still the same:
- 'Downgrade bug fix' by DCER
- '1. Newly Built Ships bug-fix'
- '2. Training bug fix' (resp. '3')
Strengthening the AI Ships in Tactical Combat
Renownedly the AI tactics in tactical combat are just the opposite of smart, so that players can waste most AI fleets with far fewer and more inferior ships. As a small compensation for poor AI tactics (see viewtopic.php?p=52751#p52751) we can add Accuracy/Defense bonuses to the AI ships.
This would also compensate for the AI vs. AI auto battle issue (no crew experience for AI, aside from training and battles with players involved, aka tactical combat, see first post).
Code example for an AI Accuracy/Defense Bonus of +5 per difficulty level above 'simple':
Note that the default multiplier for [experience level] resp. [difficulty level -1] is shared for both, since this, code- and gamebalance- wise, appeared reasonable.
Location: 0x7014F (default: 5)
Via removing asm-470D49 the base range of AI bonus increases to *[difficulty level].
Removing asm-470D32 & 470D35 extends the AI bonus to independent minor ships, though not recommended to prevent inconsistencies (pseudo downgradings when acquiring minors with ships).
Pseudo downgradings w.r.t. Accuracy/Defense:
The AI bonuses are stored in the GShipList. Thus, for the present ships of older savegames, this modification won't work instantly, nor the AI bonuses will be removed instantly from existing ships when switching player race via savegame editing (see changing AI controling race of a savegame).
Though in this case, it's only a small issue, since it auto-corrects after the next encounter resp. training (hence downgrading).
Due to a bug (fix, see below), this pseudo downgrading also happens with stolen ships from AI's:
Stolen Ships - Crew Experience & Bonuses Bug-fix
since the above 4. Altering the effect of the crew experience level, due to its abstract nature and adjustment requirements, never reached great popularity, here is an alternative which could be more desirable.
The prerequisites are still the same:
- 'Downgrade bug fix' by DCER
- '1. Newly Built Ships bug-fix'
- '2. Training bug fix' (resp. '3')
Strengthening the AI Ships in Tactical Combat
Renownedly the AI tactics in tactical combat are just the opposite of smart, so that players can waste most AI fleets with far fewer and more inferior ships. As a small compensation for poor AI tactics (see viewtopic.php?p=52751#p52751) we can add Accuracy/Defense bonuses to the AI ships.
This would also compensate for the AI vs. AI auto battle issue (no crew experience for AI, aside from training and battles with players involved, aka tactical combat, see first post).
Code example for an AI Accuracy/Defense Bonus of +5 per difficulty level above 'simple':
Code: Select all
Trek.exe at 0x7012D
replace: (41 bytes)
48 44 8D 14 8D 00 00 00 00 01 CA 8B 48 44 89 50 2C 8D 14 8D 00 00 00 00 01 CA 8B 48 44 89 50 30 8D 14 8D 00 00 00 00 01 CA
with:
50 44 8A 48 28 80 F9 04 7F 16 B5 01 D2 E5 84 2D 28 2B 5A 00 75 0A 02 15 44 2B 5A 00 80 EA 01 90 6B D2 05 89 50 2C 89 50 30
470D2C 8B50 44 MOV EDX, [EAX+44] // experience level
470D2F 8A48 28 MOV CL, [EAX+28] // owner race ID
470D32 80F9 04 CMP CL, 4 // if free minor...
470D35 7F 16 JG SHORT 470D4D // ...skip AI bonus
470D37 B5 01 MOV CH, 1
470D39 D2E5 SHL CH, CL
470D3B 842D 282B5A00 TEST [5A2B28], CH // if player...
470D41 75 0A JNZ SHORT 470D4D // ...skip AI bonus
470D43 0215 442B5A00 ADD DL, BYTE [5A2B44] // experience + difficulty level
470D49 80EA 01 SUB DL, 1 // experience + difficulty level -1
470D4C 90 NOP
470D4D 6BD2 05 IMUL EDX, EDX, 5 // default multiplier 5
470D50 8950 2C MOV [EAX+2C], EDX // store Beam Accuracy bonus
470D53 8950 30 MOV [EAX+30], EDX // store Torpedo Accuracy bonus
Location: 0x7014F (default: 5)
Via removing asm-470D49 the base range of AI bonus increases to *[difficulty level].
Removing asm-470D32 & 470D35 extends the AI bonus to independent minor ships, though not recommended to prevent inconsistencies (pseudo downgradings when acquiring minors with ships).
Pseudo downgradings w.r.t. Accuracy/Defense:
The AI bonuses are stored in the GShipList. Thus, for the present ships of older savegames, this modification won't work instantly, nor the AI bonuses will be removed instantly from existing ships when switching player race via savegame editing (see changing AI controling race of a savegame).
Though in this case, it's only a small issue, since it auto-corrects after the next encounter resp. training (hence downgrading).
Due to a bug (fix, see below), this pseudo downgrading also happens with stolen ships from AI's:
This clear bug/omission can be rectified in the GShipList.eber3 wrote:The thing I always thought was funny about crew experience is how it stays with the ship even if it is stolen by another empire. It implies that the ship wasn't hijacked but that the crew defected and took the vessel with them.
Stolen Ships - Crew Experience & Bonuses Bug-fix
Code: Select all
Trek.exe at 0x4930F
replace: (48 bytes)
84 24 1C 04 00 00 8B 52 28 8B 40 4E C1 FA 10 C1 F8 10 E8 CA F2 FF FF 8B 94 24 1C 04 00 00 8B 84 24 2C 04 00 00 8B BC 24 20 04 00 00 66 89 42 28
with
DA 8B 53 28 8B 43 4E C1 FA 10 C1 F8 10 E8 CF F2 FF FF 8B C3 33 DB 89 58 40 8B 9C 24 2C 04 00 00 66 89 58 28 E8 C8 6D 02 00 8B BC 24 20 04 00 00
449F0E 8BDA MOV EBX,EDX // GShipList entry
449F10 8B53 28 MOV EDX, [EBX+28]
449F13 8B43 4E MOV EAX, [EBX+4E]
449F16 C1FA 10 SAR EDX, 10 // ship Id
449F19 C1F8 10 SAR EAX, 10 // fleet Id
449F1C E8 CFF2FFFF CALL 4491F0 // remove ship from old TaskForce
449F21 8BC3 MOV EAX, EBX // GShipList entry
449F23 33DB XOR EBX, EBX
449F25 8958 40 MOV [EAX+40], EBX // clear EPs
449F28 8B9C24 2C040000 MOV EBX, [ESP+42C] // new owner race ID
449F2F 66:8958 28 MOV [EAX+28], BX // store in GShipList
449F33 E8 C86D0200 CALL 470D00 // update all bonuses
449F38 8BBC24 20040000 MOV EDI, [ESP+420]
Last edited by Spocks-cuddly-tribble on Sun Sep 04, 2022 4:44 pm, edited 1 time in total.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
- AlexMcpherson79
- Commander
- Posts: 332
- Joined: Thu Sep 04, 2008 2:00 am
Re: Crew Experience
Hey guys, just encountered this bug today: ships are not training... the option is there, the status is training, but level remains at 700 (all ships produced in system with powered training facility)