Vanilla Evade/Retreat Crash fix

General Modding Information/Questions; support/discussion/questions

Moderator: thunderchero

Forum rules
:idea: Please search before starting new topic. :idea:
There is a good chance it has already been asked.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7929
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Vanilla Evade/Retreat Crash fix

Post by thunderchero »

Hi Everyone,

during the update of ECM 4.0 I learned of a forgotten fix that was discussed on Jokers old site many years ago.

This fix only applies to original vanilla models

newer models do not use LOD, but may have same problem when using multi textures. This can not be fixed without reconverting model with single texture.

here is what happens
when a ship is moving quickly in combat the distance from camera will change, as this distance changes it will switch to lower quality textures ***_b.gif and ***_c.gif then it will switch to lower ploy models ***_b.hob and finally ***_c.hob. all these changes is called LOD levels (level of detail).

when ships are moving quickly the original mpr graphic engine has trouble switching between these levels and will cause CTD

the fix changes required takes some time and must be done to all vanilla ship hobs (majors, minors, monsters) that use LOD
t02 Calamarain does not use LOD

required changes (all 71 models need to be edited)
assign all ***_a.hob to only use proper ***_a.gif with UE
extract all edited ***_a.hob's
create 2 copies of each ***_a.hob and rename them to ***_b.hob and ***_c.hob
add all new ***_b.hob and ***_c.hob back with UE

mods that would benefit from this change
Building-mod 1.9.4 (by Joker) 100% vanilla models
Fluids Multiplayer Mod 2.0 100% vanilla models
Planet Mod English/German 100% vanilla models
No Building upgrade mod !00% vanilla models (new version already released)
Thunderchero's Multi-player mod 95% vanilla models
Balance of Power 95% vanilla models
Ultimate mod 5 60% vanilla models
All Ages mod 20 % vanilla models
Flagship mod 20% vanilla models

mods that would not benefit from this change
note: these files will corrupt mpr++ installs and require mpr++ to be uninstalled and re-installed.
Ultimate Dominion mod 0% vanilla models
UnCivil Wars 0% vanilla models
Galaxy mod 5% vanilla models

problem is universal files are not possible since each mod uses different palette and texture lists and might even change model prefix.

So if you create a replacement set of hobs for a mod you can post them here

I will start it off with one of the more popular mods UM5
UM5_a_hob_patch.rar
(1.51 MiB) Downloaded 151 times
here is Balance of power
BOP_a_hob.zip
(2.35 MiB) Downloaded 133 times
here is vanilla (note these files will also work on FMPM, Planet mod, jokers building mod)
note these files should also work on FMPM, Planet mod, jokers building mod, but not been tested
vanilla_a_hob.rar
(2.72 MiB) Downloaded 142 times
just extract and add all files from extracted folder with UE and sav
User avatar
EnPhreg
Lieutenant-Commander
Lieutenant-Commander
Posts: 130
Joined: Thu Jul 10, 2008 2:00 am

Re: Vanilla Evade/Retreat Crash fix

Post by EnPhreg »

are the files for BOP also needed for the MPR++ install of BOP??
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7929
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Vanilla Evade/Retreat Crash fix

Post by thunderchero »

EnPhreg wrote:are the files for BOP also needed for the MPR++ install of BOP??
no, this is only for vanilla models. MPR++ all models have been replaced.

note: these files will corrupt mpr++ install and require mpr++ to be uninstalled and re-installed.
User avatar
EnPhreg
Lieutenant-Commander
Lieutenant-Commander
Posts: 130
Joined: Thu Jul 10, 2008 2:00 am

Re: Vanilla Evade/Retreat Crash fix

Post by EnPhreg »

a little Bug with your Balance of Power hob files:
the texture of the heavy B-o-P (km1) is screwed up through the new hob file you provide for the model.
the texture layout of that model seems a little bit special.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7929
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Vanilla Evade/Retreat Crash fix

Post by thunderchero »

download file replaced, the km1 hob has been replaced in bop, so replacement hob was not needed.

to fix you may meed to uninstall BOP mod and reinstall. or replace original km1 hob files.
User avatar
EnPhreg
Lieutenant-Commander
Lieutenant-Commander
Posts: 130
Joined: Thu Jul 10, 2008 2:00 am

Re: Vanilla Evade/Retreat Crash fix

Post by EnPhreg »

ok.
the 'a hobs' from the spacestation models are also no vanillas in BoP. cause of combat distance i think.
cs_a.hob, hs_a.hob, fs_a.hob, ks_a.hob, rs_a.hob

by the way, are there any thread in the forum who describes the shield generator mechanics? (function during bombing or invasion, how it's effect is determined) found nothing specific
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7929
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Vanilla Evade/Retreat Crash fix

Post by thunderchero »

EnPhreg wrote:the 'a hobs' from the spacestation models are also no vanillas in BoP. cause of combat distance i think.
cs_a.hob, hs_a.hob, fs_a.hob, ks_a.hob, rs_a.hob
they were vanilla but edited, replaced file again with proper combat distance for spacestations.
EnPhreg wrote:by the way, are there any thread in the forum who describes the shield generator mechanics? (function during bombing or invasion, how it's effect is determined) found nothing specific
only one I know of would be this, Ground Combat Calculation (success chance of invasion)
viewtopic.php?f=156&t=1632
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2403
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: Vanilla Evade/Retreat Crash fix

Post by Tethys »

I am doing some research on the OP. Looking at sub 531BB0 A_B_C_HOBs

loc_531C34 looks like a switch point, where values are loaded and/or replaced. My question is: how is the current setup for modded ships? Let me ask a different way. Do modded ships use the _b and _c identifiers at all, in any way, for extra textures or anything at all?

It looks like you can divert the code around the switch so only one LOD is used the entire time, or maybe just the _a and the _b? Not sure if this is even the right subroutine but it appears that it might be (traceback to palette, tactical, and .hob)

The whole ABC thing can be skipped via changing:

Code: Select all

531C27                   jnz     short loc_531C34
                      >
531C27                   jmp     loc_531D60
But this might also cancel A as well. One might be for hob, the other for gif, so I'd need a bit more info before I continue with this. But it kinda looks pretty simple, just disconnecting the conditional jumps that set the flags? to change to the next LOD? Side project, but I think we do have issues with non-vanilla models and evade. I would have to re-enable it to be sure though.
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7929
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Vanilla Evade/Retreat Crash fix

Post by thunderchero »

Hi Everyone,

in the test version of UE, it now has some editable hob info

this made me wonder if additional editing of vanilla hob might help even more?

what I am looking at is this the t02 hob, while it is a billboard look at "lod levels" settings
level.jpg
level.jpg (224.79 KiB) Viewed 152 times
I think this controls texture switch points, so vanilla hobs are still switching textures just uses same texture?
t02 does use 2 total textures but only 1 "total texture set"

here is what I was thinking Vanilla models could benifit from these changes?
"total textures" = 3 (a,b,c textures) change to -> 1 (hob would only use "a" texture)
"total texture set" = 3 (3 lod textures a,b,c) change to -> 1 (hob would only use "a" texture)
"lod levels" change to same as billboards -> 0.0, -1.0, -1.0
here is hh4 with changes
hh4.jpg
hh4.jpg (218.49 KiB) Viewed 152 times
with these changes model works in game :up:
Tethys wrote: Wed Jan 10, 2024 3:18 am The whole ABC thing can be skipped via changing:

Code: Select all

531C27                   jnz     short loc_531C34
                      >
531C27                   jmp     loc_531D60
I also took a look at sub-section Tethys was looking at, but all my attempts game would crash if b,c hob was not present in res file.

A bonus to this is if we got rid of the b,c hob it might decrease install and installer size lol

Note; "tech screen" ship preview a hob, b gif
screensaver uses a hob, a gif
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7929
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Vanilla Evade/Retreat Crash fix

Post by thunderchero »

I did a couple tests
test1
I did a test with vanilla a,b,c hob unedited
A hob, A gif
AA.jpg
AA.jpg (200.05 KiB) Viewed 136 times
A hob, b gif
AB.jpg
AB.jpg (169.18 KiB) Viewed 136 times
a hob, c gif
AC.jpg
AC.jpg (147.23 KiB) Viewed 136 times
b hob (no texture used)
b.jpg
b.jpg (135.55 KiB) Viewed 136 times
c hob (no texture used) yes that dot in the circle is c hob (stars move it did not)
c.jpg
c.jpg (134.92 KiB) Viewed 136 times
test 2

hobs as in current installer version;
a.hob with a.gif, a.gif, a.gif
b.hob with a.gif, a.gif, a.gif
c.hob with a.gif, a.gif, a.gif

for this video I changed all gifs and guess what it is switching gif's 9 times, you can see 5 switches before it gets too small :wink:
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1925
Joined: Sun Apr 27, 2008 2:00 am

Re: Vanilla Evade/Retreat Crash fix

Post by Spocks-cuddly-tribble »

thunderchero wrote: Fri Apr 12, 2024 12:57 pmso vanilla hobs are still switching textures just uses same texture?
This was starting point of the ancient LOD texture fix based on Jokers' remark the zoomed-out ships look better/sharper that way (always A texture).
As a side effect I (and others) found this decreases crashes due to fast moving ships. We thought BotF checks a list of active/loaded textures and just uses the same existing data again, which might skip any further code/calculations related to the crashes. IIRC the next step (forcing always usage of A hob) was reinvented by you. :wink:

thunderchero wrote: Fri Apr 12, 2024 12:57 pmall my attempts game would crash if b,c hob was not present in res file.

A bonus to this is if we got rid of the b,c hob it might decrease install and installer size lol

Note; "tech screen" ship preview a hob, b gif
Just to be clear. Your above 'Vanilla Evade/Retreat Crash fix' disables ANY usage of B/C HOB files in BotF (trek.exe, Falcon and MPR+), so you just want to disable the redundant load check and crash for them? Try to change all to A resp. a (in case capitalization matters):
00585C33 a_a     db '_A',0
00585C36 a_b     db '_B',0
00585C39 a_c     db '_C',0
00585C3C a_a_0   db '_a',0
00585C3F a_b_0   db '_b',0
00585C42 a_c_0   db '_c',0
As a side effect tech screen should show the 'a' gif. :wink:


EDIT: Tech screen has shadow effects, but screen saver not. The enable shadow feature might hide in this code:
004D44C6         lea     eax, [esp+840h]
004D44CD         call    Ship_Station_sfx__scrnsave_techsrceen ; tech screen
004D44D2         push    3FE66666h
004D44D7         push    66666666h
004D44DC         push    3FD33333h
004D44E1         push    33333333h
004D44E6         push    0BFF00000h
004D44EB         xor     edi, edi
004D44ED         push    edi
004D44EE         push    3FF00000h
004D44F3         push    edi
004D44F4         mov     esi, 1
004D44F9         push    0BFF00000h
004D44FE         mov     ds:tech_screen_set_1_?, esi       ; 1
004D4504         push    edi
004D4505         mov     ds:tech_screen_set_0_?, edi       ; 0
004D450B         mov     ds:tech_screen_set_1_b_?, esi     ; 1
004D4511         call    pre_exit_sub_TC_3D?
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: 7929
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Vanilla Evade/Retreat Crash fix

Post by thunderchero »

Spocks-cuddly-tribble wrote: Fri Apr 12, 2024 4:29 pm Just to be clear. Your above 'Vanilla Evade/Retreat Crash fix' disables ANY usage of B/C HOB files in BotF (trek.exe, Falcon and MPR+),
No, b, c hob is still being used in combat.
as my video shows it still switches 9 time right now (even with current ECM models), 3 times for each hob. Just uses same texture each time. So it also switches hobs twice. :dwn:

if we made these changes to hobs it would switch 2 time (even newly created models switch 2 times a, b, c.hob)
here is what I was thinking Vanilla models could benefit from these changes?
"total textures" = 3 (a,b,c textures) change to -> 1 (hob would only use "a" texture)
"total texture set" = 3 (3 lod textures a,b,c) change to -> 1 (hob would only use "a" texture)
"lod levels" change to same as billboards -> 0.0, -1.0, -1.0
EDIT; above changes also force a.hob/a.gif in tech screen.
If we completely stopped code for b, c .hob, It would not switch at all

or change b, c switch point negative distance?

file size is bonus, but switching less is my true goal.

EDIT
Spocks-cuddly-tribble wrote: Fri Apr 12, 2024 4:29 pm
00585C33 a_a     db '_A',0
00585C36 a_b     db '_B',0
00585C39 a_c     db '_C',0
00585C3C a_a_0   db '_a',0
00585C3F a_b_0   db '_b',0
00585C42 a_c_0   db '_c',0
test change above b, c still used in combat
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1925
Joined: Sun Apr 27, 2008 2:00 am

Re: Vanilla Evade/Retreat Crash fix

Post by Spocks-cuddly-tribble »

thunderchero wrote: Fri Apr 12, 2024 5:42 pmNo, b, c hob is still being used in combat.
as my video shows it still switches 9 time right now (even with current ECM models), 3 times for each hob. Just uses same texture each time. So it also switches hobs twice. :dwn:
Yes, but it's always the same file just with different names. My above exploit trick should allow removing all B/C HOB and gif files (if b/c removed in A HOB), since they use the same name for all switch cases. Worst case is that BotF re-loads the same A HOB again. Textures are recognized when loaded, so there is hope the same goes for HOB files?
above changes also force a.hob/a.gif in tech screen.
Due to "lod levels" in HOB file or my suggestions?
If we completely stopped code for b, c .hob, It would not switch at all ... switching less is my true goal.
Indeed, but the real switches depend on trek.exe code and might not even read some of the HOB file settings.
As told, 3D code is not in my wheelhouse (similar issue as camera min/max distance switche).
But if negative switch levels in the HOB work, great, why not. :up:

thunderchero wrote: Fri Apr 12, 2024 5:42 pmtest change above b, c still used in combat
From where does it get the file names? Are the B/C HOB files somehow referenced in the A HOB?
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: 7929
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Vanilla Evade/Retreat Crash fix

Post by thunderchero »

Spocks-cuddly-tribble wrote: Fri Apr 12, 2024 7:10 pm
above changes also force a.hob/a.gif in tech screen.
Due to "lod levels" in HOB file or my suggestions?
Due to changing hob file
"total texture set" = 3 (3 lod textures a,b,c) change to -> 1 (hob would only use "a" texture)
after this testing, It looks as if primary issue was when hob "a" switched to hob "b"

the reason looks to be "a" hob has 200 poly and "b" hob had 20 poly. when it switched the difference in model/poly is what was causing crash.

I confirmed this by changing "b" hob ("a" hob renamed) to a completely different model and crash every time when "b" loaded.

just a reminder vanilla lod levels vs evade/retreat crash

vanilla hobs
level 1
a.hob/a.gif
level 2
a.hob/b.gif
level 3
a.hob/c.gif
level 4
b.hob (no gif)
level 5
c.hob (no gif)


with evade/retreat crash (with no lod benefit at all) (crash benefit yes)
level 1
a.hob/a.gif
level 2
a.hob/a.gif
level 3
a.hob/a.gif
level 4
b.hob/a.gif
level 5
b.hob/a.gif
level 6
b.hob/a.gif
level 7
c.hob/a.gif
level 8
c.hob/a.gif
level 9
c.hob/a.gif
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1925
Joined: Sun Apr 27, 2008 2:00 am

Re: Vanilla Evade/Retreat Crash fix

Post by Spocks-cuddly-tribble »

Spocks-cuddly-tribble wrote: Fri Apr 12, 2024 7:10 pm
thunderchero wrote: Fri Apr 12, 2024 5:42 pmtest change above b, c still used in combat
From where does it get the file names? Are the B/C HOB files somehow referenced in the A HOB?
I think I see it:
00531CA4      add     bl, 61h  -> 'a' + 1/2 for b/c

try ->  mov     bl, 61h
EDIT: That a,b,c crap is hard coded in multiple loop counters. :mad: But I hope there is only two:
005314F5         add     al, 61h -> mov
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
Post Reply

Return to “General Modding Information/Questions”