minor races placed on left bug question

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.
Post Reply
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 6635
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

minor races placed on left bug question

Post by thunderchero »

Hi Everyone,

calculation, have always been my main weakness. So I thought I would ask for some suggestions.

On larger maps there has always been an issue of minors generating mainly on the left of map. we know this is due to the shared "minor density" value

position: 0x17D668
length: 8 bytes
default value: 0.2

this value looks to be calculated, but I don't understand how or what the results would be. could some one explain please?

Code: Select all

AUTO:004B1C4A DC 1D 68 F8 57 00                               fcomp   ds:minor_density_0_2
AUTO:004B1C50 DF E0                                           fnstsw  ax
AUTO:004B1C52 9E                                              sahf
while looking at code in de-bugger I noticed this code loops on every minor placement?

I also noticed every time it loops though this code we have a registry esp+52 for long edge of map and or esp+56 for short edge of map.

Could we use this to get a better placement of minors?

If so could someone give me a code suggestion? I would be happy to test and fine tune.

thunderchero
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 2641
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: minor races placed on left bug question

Post by Flocke »

I'm not into asm analysis atm, but my guess would be that it loops through all the systems to place minors and in there it loops through all the systems already processed to check whether it is too close by the minor density modifier to locate another minor at the current system.
When like you posted the minor density default is a relative value, for distance comparison it needs to calculate absolute distance allowed somehow. This is likely done by taking the edge length into account.

All by guess from what you posted. ;)
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 911
Joined: Sun Apr 27, 2008 2:00 am

Re: minor races placed on left bug question

Post by Spocks-cuddly-tribble »

thunderchero wrote: Fri Apr 16, 2021 8:52 pmCould we use this to get a better placement of minors?
The placement of the minor races is not fully analysed yet.

It's a multifactorial issue, which at some point even caused a small dispute between Dcer and Gowron; cf. minor race frequency (the unknown values are used and even more variables, we just don't understand how).

ASM analysis and logic -wise it's a interesting riddle. And IIRC at your request, I tried for about 90 minutes to analyse the code before I gave up, due to my insuficient knownedge of the BotF map data handling and the very intricate esp storage of the involved variables.

IIRC I suggested a dynamic adjustment workaround, using the number of starsystems on the map, which I presume didn't work.

Since I'm not even able to finish my own projects (like AI TC command probabilities), it's unrealistic that I can assist you here.
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: 6635
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Re: minor races placed on left bug question

Post by thunderchero »

Spocks-cuddly-tribble wrote: Sat Apr 17, 2021 3:36 pm IIRC I suggested a dynamic adjustment workaround, using the number of starsystems on the map, which I presume didn't work.
one option I was considering would be to "cmp" for long edge of large map to a different minor race frequency value, but this would not be a universal patch and only work if galaxy has same large long edge or would require edit.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 6635
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Re: minor races placed on left bug question

Post by thunderchero »

Hi Everyone,

Here is a patch that will address the issue of minor mainly on left of map on larger maps.

Prerequisites
relocation patch.
The patch needs to be adjusted for large and medium map long (horizontal) edge.
The patch also will need adjustment of the large/medium minor density values.

note; small maps use the vanilla minor density value and location.

here is the code changes (note; changes are the same but patch location have changed)

Code: Select all

4B1C4A 90                                            nop
4B1C4B E8 50 8F 1D 00                                call    sub_68ABA0

68ABA0 83 7C 24 38 19                                cmp     [esp+arg_34], 19h
68ABA5 73 0E                                         jnb     short loc_68ABB5
68ABA7 83 7C 24 38 10                                cmp     [esp+arg_34], 10h
68ABAC 73 0E                                         jnb     short loc_68ABBC
68ABAE DC 1D 68 F8 57 00                             fcomp   ds:dbl_57F868
68ABB4 C3                                            retn
68ABB5 DC 1D D8 AB 68 00                             fcomp   ds:dbl_68ABD8
68ABBB C3                                            retn
68ABBC DC 1D D0 AB 68 00                             fcomp   ds:dbl_68ABD0
68ABC2 C3                                            retn

68ABD0 33 33 33 33 33 33 D3 3F       dbl_68ABD0      dq 3.0e-1
68ABD8 9A 99 99 99 99 99 D9 3F       dbl_68ABD8      dq 4.0e-1
since changes are required here is text version of patch

Code: Select all

NAME: Minors on left (fix) 
AUTHOR: thunderchero
DESC: This patch allows 3 seperate minor density values (large, Med, small)
DESC: Note this patch requires relocation.patch
DESC: Note this patch also requires editing to match map value and adjustment.
DESC: patch file name: minor_left.patch
URL: https://www.armadafleetcommand.com/onscreen/botf/viewtopic.php?p=53964#p53964
TAG: 

# >>  = current value

# <<  = new value

>> 0x000b104a dc 1d 68 f8 57
>> 0x0019f7e0 00 00 00 00 00 00 00 00 
>> 0x0019f7e8 00 00 00 00 00 00 00 00
>> 0x001a17d0 00 00 00 00 
>> 0x001a17d4 00 
>> 0x001a17d5 00 00 00 00 00 00 
>> 0x001a17db 00 
>> 0x001a17dc 00 00 00 00 00 00 00
>> 0x001a17e4 00 00 00 00 00 00
>> 0x001a17eb 00 00 00 00 00 00
>> 0x001a17f2 00

<< 0x000b104a 90 e8 80 a7 1d
#new medium minor density values
<< 0x0019f7e0 33 33 33 33 33 33 d3 3f 
#new large minor density values
<< 0x0019f7e8 9a 99 99 99 99 99 d9 3f
<< 0x001a17d0 83 7c 24 38 
#large map long (horizontal) edge
<< 0x001a17d4 19 
<< 0x001a17d5 73 0e 83 7c 24 38 
#medium map long (horizontal) edge
<< 0x001a17db 10 
<< 0x001a17dc 73 0e dc 1d 68 f8 57
<< 0x001a17e4 c3 dc 1d e8 a3 68
<< 0x001a17eb c3 dc 1d e0 a3 68
<< 0x001a17f2 c3
hope this helps
thunderchero
Post Reply

Return to “General Modding Information/Questions”