how can we get 30 minors every time "many" is selected?

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: 7851
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

how can we get 30 minors every time "many" is selected?

Post by thunderchero »

Hi everyone,

I have been doing some testing and not came up with a solution yet. :mad:

but thought I would post my findings.

long time ago Dcer talked about a similar sub-section to the amount of minors and it was thought to be minimum minors.

UE edits only sub-section Universe_PlacRace_4B22A0,
here is the similar sub-section Universe_PlacRace_4B2350

they are close to the same, but have exact same type of flow but 4B2350 has lower values.

So I copied and pasted the my edited 4B22A0 section to 4B2350 for testing. I did get higher and more contestant minors. But never max as I hoped.

with mirror universe mod I have many levels of system density so I tested the lowest and got 15 - 20 most of the time on "many" on 10 tests

my next test was right on edge of giving max 30 minors on "many"

here is my 20 tests
first column systems, second column anomalies, third column minors, fourth column % minors to systems, fifth column % minor to total space objects (systems + anomalies)

Code: Select all

 61  7 15 ‭0.2459016393442623‬ ‭0.2205882352941176‬
 54 13 15 ‭0.2777777777777778‬ ‭0.2238805970149254‬
 58  8 18 ‭0.3333333333333333‬ ‭0.2727272727272727‬
 66 10 18 ‭0.3103448275862069‬ ‭0.2368421052631579‬
 61  4 18 ‭0.2727272727272727‬ ‭0.2769230769230769‬
 60  9 20 ‭0.3333333333333333‬ ‭0.2898550724637681‬
 66  8 19 ‭0.2878787878787879‬ ‭0.2567567567567568‬
 60 13 17 ‭0.2833333333333333‬ ‭0.2328767123287671‬
 71 12 19 ‭0.2676056338028169‬ ‭0.2289156626506024‬
 69 11 17 ‭0.2463768115942029‬ ‭0.2125‬


128 20 29 ‭0.2265625‬          ‭0.1959459459459459‬‬
105 15 26 ‭0.2476190476190476‬ ‭0.2‬
124 25 27 ‭0.217741935483871‬  ‭0.1812080536912752‬
123 19 30 ‭0.2439024390243902‬ ‭0.2112676056338028‬
129 22 30 ‭0.2325581395348837‬ ‭0.1986754966887417‬
124 24 28 ‭0.2258064516129032‬ ‭0.1891891891891892‬
129 15 28 ‭0.2170542635658915‬ ‭0.1944444444444444‬
122 32 28 ‭0.2295081967213115‬ ‭0.1818181818181818‬ 
123 22 26 ‭0.2113821138211382‬ ‭0.1793103448275862‬
110 23 26 ‭0.2363636363636364‬ ‭0.1954887218045113
to me it looks like the cut off, if too few of system is between 20 - 25 percent.

In my tests if above 140 system I will get 30 minors every time. (with sub-section 4B2350 edited)

But I have no idea where or how this is calculated.

Edit; I forgot about minor density 0.2, if I raise this value I can get 30 minor on small map but on large map they are all on left :mad:

I will look at other values in that section to see if I can correct issue, But I at least know where to test more now.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1884
Joined: Sun Apr 27, 2008 2:00 am

Re: how can we get 30 minors every time "many" is selected?

Post by Spocks-cuddly-tribble »

Sorry mate, lately I hardly read the forums due to running out of time before summer break. So I have to focus on posting & finishing some breakthroughs with AI commands. I will come back to MUM after this.


Your problem here is a tough one due to the strange, and still partly unkown, mechanics of minor race placement.

As a workaround you need a dynamic adjustment of the minor race frequency.

I'd use the star system count 5A36BC as multiplier for the random value and increase minor density value.


In theory at 4B1C4A you need to free up 8 bytes & insert:

fild word [5A36BC] // star systems count to fpu
fmulp st(1), st // random float 0.0 - 1.0 * star systems on map

And set 57F868 (minor density) = your current value working best for 30 minors with large/many * average number of star systems on large/many maps.

This should work for all maps sizes (multiplier always average of large/many star systems).


EDIT: If I'm not mistaken this code should work:

Code: Select all

004B1C3B   B2 FB             MOV DL,0FB
004B1C3D   E8 0E620500       CALL 00507E50
004B1C42   DF05 BC365A00     FILD WORD PTR DS:[5A36BC]
004B1C48   DEC9              FMULP ST(1),ST
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: 7851
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: how can we get 30 minors every time "many" is selected?

Post by thunderchero »

Hi Spocks-cuddly-tribble,
Spocks-cuddly-tribble wrote: Tue Jun 02, 2020 4:23 pm In theory at 4B1C4A you need to free up 8 bytes & insert:

fild word [5A36BC] // star systems count to fpu
fmulp st(1), st // random float 0.0 - 1.0 * star systems on map

And set 57F868 (minor density) = your current value working best for 30 minors with large/many * average number of star systems on large/many maps.

This should work for all maps sizes (multiplier always average of large/many star systems).
This looks to work better, your "edit" code placed most minors on left when placing all 30 minors. (wide screen this was worse)
both code changes required minor density to be set to 30.0 for 30 minors on all maps when set to "many"
all other minor options (none, few, some) add correct/defined amount also.

Note; these code changes will not work on vanilla due to small and medium maps have too few of systems, also ring and spiral has even fewer systems.

Note; code below does not have all the offset changes for freeing up 8 bytes (i will post a patch file later after more testing)

Code: Select all

004B1C3B BA 76 05 00 00          mov     edx, 576h
004B1C40 B8 CC F7 57 00          mov     eax, offset a____SourceUn_4 ; "..\\..\\source\\universe\\placrace.c"
004B1C45 E8 06 62 05 00          call    sub_507E50
004B1C4A DF 05 BC 36 5A 00       fild    ds:word_5A36BC
004B1C50 DE C9                   fmulp   st(1), st
004B1C52 DC 1D 68 F8 57 00       fcomp   ds:dbl_57F868
004B1C58 DF E0                   fnstsw  ax
004B1C5A 9E                      sahf
004B1C5B 73 19                   jnb     short loc_4B1C76
update; after loading 50+ small, 15% density (my smallest map) I got 2 or 3 that only had 29 minors due to too few of systems (5 majors, 29 minors, 32 free systems of 66 total systems). but I can live with that or I could just slightly increase density.

here is the patch info

Code: Select all

NAME: Minor placement of 30 minors on many
AUTHOR: Spocks-cuddly-tribble/thunderchero
DESC: This patch Minor placement of 30 minors on many
DESC: Note: for this patch to work galaxy generation must have enough systems
DESC: patch file name: Minor_placement_of_30_minors_on_many.patch
URL: https://www.armadafleetcommand.com/onscreen/botf/viewtopic.php?f=4&p=52712#p52712
TAG: fix

# >>  = vanilla/original value

# <<  = new value

#set minor races to 15(few),25 (some),30 (many)
>> 0x000b16de 03
>> 0x000b16e5 05
>> 0x000b16ec 08
>> 0x000b16f3 08
>> 0x000b16fa 0f
>> 0x000b1701 15
>> 0x000b1708 0c
>> 0x000b170f 18
>> 0x000b1716 1e

<< 0x000b16de 10
<< 0x000b16e5 1a
<< 0x000b16ec 1f
<< 0x000b16f3 10
<< 0x000b16fa 1a
<< 0x000b1701 1f
<< 0x000b1708 10
<< 0x000b170f 1a
<< 0x000b1716 1f

>> 0x000b103a 33
>> 0x000b104a dc 1d 68 f8 57 00
>> 0x000b1050 df e0 9e 73 19 8b 03 89 fa 8b 5c 24 3e
>> 0x000b105e 34 01 c1 fb 10 89 f0 e8 36 23 00 00 85 c0 75 0d 8b 54 24 04 83 c1 04 39 d1 7c 82 eb 92 89 f8 e8 3e 02 00 00 89 74 24 14 89 c2 69 c6 28 03 00 00 8b 1d c8 36 5a 00 66 8b 75 00 01 d8 31 db 46 66 89 d3 66 89 75 00 8b 74 24 14
>> 0x000b10aa 50 44 66 89 34 5d 60 23 5b 00
>> 0x000b10b5 83 fa 05 73 1b c6 40 30 00 88 50 4c 8b 54 24 04 83 c1 04 39 d1 0f 8c 2b ff ff ff e9 38 ff ff ff c6 40 30 05 c6 40 4c 23 8b 54 24 04 83 c1 04 39 d1 0f 8c 0f ff ff ff e9 1c ff ff ff 00 00 00 00 00 00 00 00
>> 0x0017d668 9a 99 99 99 99 99 c9 3f

<< 0x000b103a 3b
<< 0x000b104a df 05 bc 36 5a 00
<< 0x000b1050 de c9 dc 1d 68 f8 57 00 df e0 9e 73 19
<< 0x000b105e 03 89 fa 8b 5c 24 3e 8b 34 01 c1 fb 10 89 f0 e8 2e 23 00 00 85 c0 75 0d 8b 54 24 04 83 c1 04 39 d1 7c 8a eb 8a 89 f8 e8 36 02 00 00 89 74 24 14 89 c2 69 c6 28 03 00 00 8b 1d c8 36 5a 00 66 8b 75 00 01 d8 31 db 46 66 89 d3
<< 0x000b10aa 75 00 8b 74 24 14 66 89 50 44
<< 0x000b10b5 89 34 5d 60 23 5b 00 66 83 fa 05 73 1b c6 40 30 00 88 50 4c 8b 54 24 04 83 c1 04 39 d1 0f 8c 23 ff ff ff e9 30 ff ff ff c6 40 30 05 c6 40 4c 23 8b 54 24 04 83 c1 04 39 d1 0f 8c 07 ff ff ff e9 14 ff ff ff
#minor race density
<< 0x0017d668 00 00 00 00 00 00 3e 40

#move code from Universe_PlacRace_4B22A0 (Max) to Universe_PlacRace_4B2350 (min)
#set to 15(few),25 (some),30 (many)
>> 0x000b1768 20 23
>> 0x000b1779 30 23
>> 0x000b1789 40 23
>> 0x000b178e 01
>> 0x000b1795 03
>> 0x000b179c 05
>> 0x000b17a3 09
>> 0x000b17aa 0f
>> 0x000b17b1 06
>> 0x000b17b8 0c
>> 0x000b17bf 18
>> 0x000b17c5 00 00
>> 0x000b17ca 00 00

<< 0x000b1768 70 22
<< 0x000b1779 80 22
<< 0x000b1789 90 22
<< 0x000b178e 10
<< 0x000b1795 1a
<< 0x000b179c 1f
<< 0x000b17a3 10
<< 0x000b17aa 1a
<< 0x000b17b1 1f
<< 0x000b17b8 10
<< 0x000b17bf 1a
<< 0x000b17c5 b8 1f
<< 0x000b17ca 59 c3
Post Reply

Return to “General Modding Information/Questions”