Galaxy Map Size

Galaxy Map Size; 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

Galaxy Map Size

Post by Gowron »

As mentioned in the Dynamic Key Variables topic, the galaxy size indicator is stored at position 5A36B8. It's also used within various subroutines to determine the map/grid dimensions. Increasing these dimensions means more sectors and probably more fun as well ;)

All values referring to the same edge (in sections 1-3) should always be changed to the same value, to avoid crashes. I've also included the shape control variables which seem to be edge-related, although I'm not sure if it's needed to change them accordingly (at least, changing them accordingly does not seem to hurt).


1. Map Dimensions: Small

Default values are 0x0D (horizontal edge) and 0x0A (vertical edge).
Code locations:

Code: Select all

Offset    hex code                asm code

:0043D8B7 B80A000000              mov eax, 0000000A

:0043D8E7 B80D000000              mov eax, 0000000D

:0043DAB9 BA0D000000              mov edx, 0000000D

:0044F5E2 B80A000000              mov eax, 0000000A
:0044F5F9 B80D000000              mov eax, 0000000D

:004AF124 BD32000000              mov ebp, 00000032   // 5 times 0x0A
:004AF129 BA41000000              mov edx, 00000041   // 5 times 0x0D

:004AF14E C70514B35C000D000000    mov dword[005CB314], 0000000D
:004AF17B C70514B35C000D000000    mov dword[005CB314], 0000000D
:004AF1B1 C70514B35C000D000000    mov dword[005CB314], 0000000D
:004AF1EA C70514B35C000D000000    mov dword[005CB314], 0000000D

:004B21C9 C7000D000000            mov dword[eax], 0000000D
:004B21CF C740040A000000          mov dword[eax+04], 0000000A

:004B6BE8 B80D000000              mov eax, 0000000D

:004B6CA0 B80D000000              mov eax, 0000000D

:004B6D5B BB0D000000              mov ebx, 0000000D
:004B6D60 B80A000000              mov eax, 0000000A

:004B6DC8 B80D000000              mov eax, 0000000D

:004B6DE0 BE0A000000              mov esi, 0000000A

:004B7170 BA0D000000              mov edx, 0000000D
:004B7175 B90A000000              mov ecx, 0000000A
2. Map Dimensions: Medium

Default values are 0x10 (horizontal edge) and 0x0C (vertical edge).
Code locations:

Code: Select all

Offset    hex code                asm code

:0043D8D3 B80C000000              mov eax, 0000000C

:0043D903 B810000000              mov eax, 00000010

:0043DAF4 BA10000000              mov edx, 00000010

:0044F70D B80C000000              mov eax, 0000000C
:0044F723 B810000000              mov eax, 00000010

:004AF07D BD3C000000              mov ebp, 0000003C   // 5 times 0x0C
:004AF082 BF50000000              mov edi, 00000050   // 5 times 0x10

:004AF0AB C70514B35C0010000000    mov dword[005CB314], 00000010

:004B220B C70010000000            mov dword[eax], 00000010
:004B2211 C740040C000000          mov dword[eax+04], 0000000C

:004B6BD3 B810000000              mov eax, 00000010

:004B6C8E B810000000              mov eax, 00000010

:004B6D67 BB10000000              mov ebx, 00000010
:004B6D6C B80C000000              mov eax, 0000000C

:004B6E9E B810000000              mov eax, 00000010

:004B6EB4 BE0C000000              mov esi, 0000000C

:004B7050 BD10000000              mov ebp, 00000010
:004B7055 B80C000000              mov eax, 0000000C
3. Map Dimensions: Large

Default values are 0x19 (horizontal edge) and 0x12 (vertical edge).
Code locations:

Code: Select all

Offset    hex code                asm code

:0043D8CC B812000000              mov eax, 00000012

:0043D8FC B819000000              mov eax, 00000019

:0043DAED BA19000000              mov edx, 00000019

:0044F717 B812000000              mov eax, 00000012
:0044F72D B819000000              mov eax, 00000019

:004AF2B2 BD5A000000              mov ebp, 0000005A   // 5 times 0x12
:004AF2B7 BA7D000000              mov edx, 0000007D   // 5 times 0x19

:004AF2E0 C70514B35C0019000000    mov dword[005CB314], 00000019
:004AF327 C70514B35C0019000000    mov dword[005CB314], 00000019
:004AF35D C70514B35C0019000000    mov dword[005CB314], 00000019

:004B223D C70019000000            mov dword[eax], 00000019
:004B2243 C7400412000000          mov dword[eax+04], 00000012

:004B6BEF B819000000              mov eax, 00000019

:004B6CA7 B819000000              mov eax, 00000019

:004B6D17 BB19000000              mov ebx, 00000019
:004B6D1C B812000000              mov eax, 00000012

:004B6EA8 B819000000              mov eax, 00000019

:004B6EBE BE12000000              mov esi, 00000012

:004B7190 BE19000000              mov esi, 00000019
:004B7195 BF12000000              mov edi, 00000012
4. Grid Multipliers

A lot of the map grid setup seems to take place in subroutine 4DC280.
It's called from subroutines 4DCF00 and 4DC180, with [edx] set to 2 (small), 3 (medium) or 4 (large), depending on the galaxy size.

Within subroutine 4DC280, a special value is set depending on the galaxy size. It's a multiplier for the grid size. Default values are 0x26 (small), 0x1F (medium), and 0x14 (large).

The grid multiplier has to be adjusted to every change of the map dimensions. If it's set too high, the map will not show at all (although the game still runs).

As a rule of thumb, set this value so that the product of the grid multiplier and the horizontal map dimension is about 500 and the product of the grid multiplier and the vertical map dimension is about 380. If the map does not show up, decrease the grid multiplier until the map is drawn.

Code segments for grid multipliers:

Code: Select all

Offset    hex code                asm code

:004DC4A7 BF26000000              mov edi, 00000026   // small

:004DC4B1 BF1F000000              mov edi, 0000001F   // medium

:004DC4BB BF14000000              mov edi, 00000014   // large
5. Limitations

An exact limit for vertical size has yet to be found. I've successfully tested a 26x50 map, with a grid multiplier of 6. However, the game was unable to create a 26x99 map with a grid multiplier of 3 (infinite loop).



UPDATE:

More instances of the grid multipliers (the offsets from the above code segments are also included):

Code: Select all

(0x26) small  0x4DC4A8, 0x4DB02D, 0x4DBB66, 0x4DA860, 0x4DB283, 0x4DB540, 0x4DBBD5, 0x4DBC8D, 0x4DC8B5

(0x1F) medium 0x4DC4B2, 0x4DB037, 0x4DBB6C, 0x4DA86A, 0x4DB28D, 0x4DB54A, 0x4DBBDC, 0x4DBC94, 0x4DC8BF

(0x14) large  0x4DC4BC, 0x4DB041, 0x4DBB72, 0x4DA874, 0x4DB297, 0x4DB554, 0x4DBBE3, 0x4DBC9B, 0x4DC8C9 

UPDATE #2:

To bring star icons and system names into their correct positions, alignment multipliers must be set according to the formula
[alignment multiplier] = 0.2 * [grid multiplier]
at the following positions (stored at floats, 4 bytes each):

Code: Select all

small map:
4DA83C, 4DB57A, 4DBD85, 4DC130

medium map:
4DA849, 4DB58A, 4DBD8F, 4DC13D

large map:
4DA856, 4DB59A, 4DBD9C, 4DC14A
:idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea:
maximum possible x and y dimensions for given grid multiplier
:idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea:


thunderchero wrote:you should use UE to edit larger galaxies.

check this tutorial out

https://www.armadafleetcommand.com/botf ... ial-for-ue
Last edited by Gowron on Sat May 16, 2009 9:17 am, edited 6 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
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3194
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Post by Flocke »

I knew you would do it! 8O
Keep up on it, this is pretty cool stuff! :D

Think we need additional galaxy size types, so we can choose between small, med, big, huge, giant, unapproachable or something. :lol:

Well done :!:
Gh0st
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 67
Joined: Fri Jan 16, 2009 3:00 am

Post by Gh0st »

Holly cow, Gowron did it; I can not believe! For so many years we be waiting for such a breakthrough & today is the day. You did a great job & I think the whole comunity will be thankful. I can't wait no longer to see all this new routines in a 'little' update for UDM & BoP - modification. Please don't let us wait...
stardust
Rear-Admiral
Rear-Admiral
Posts: 1381
Joined: Sat Apr 26, 2008 2:00 am
Location: good ole Blighty

Post by stardust »

Wow 8O

4 weeks into the new year and Gowron may well have already made the modding breakthrough of the year.

Just a thought about the issue of physically being able to display a larger galaxy in game.

I remember in another recent thread Thunderchero was attempting to modify the GUI for the energy screen so it'd be possible to scrool down through the various structures that requried enery to get around the problem of not being able to power buildings if ther were to many to display.

Would it be possible to do something similar with the Galaxy screen to get around the display issue?
Computers! [Expletive deleted]

My 4shared folder
User avatar
JeanNYGUARD
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 52
Joined: Fri Dec 12, 2008 3:00 am

Post by JeanNYGUARD »

Amazing work Gowron....

This is a incredible discovery. Ive been waiting for this modification since 99....

Thanks Gowron.

I think we should all get Gowron a plague or something. ;)
User avatar
Martok
Rear-Admiral
Rear-Admiral
Posts: 1208
Joined: Thu May 01, 2008 2:00 am

Post by Martok »

This is indeed simply amazing. I look forward to the results. 8)

JeanNYGUARD wrote:I think we should all get Gowron a plague or something. ;)

Um, I'm not sure he'd appreciate that. Perhaps a *plaque* instead? :P
"Evil is easy, and has infinite forms." -- Pascal
User avatar
Deimos
Lieutenant-Commander
Lieutenant-Commander
Posts: 168
Joined: Sat Apr 26, 2008 2:00 am

Post by Deimos »

Only problem I see with a larger map size, is the inherent slow down issues/memory leaks that occur later in the game.
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 »

Martok wrote:is there a way to increase the number of possible map sizes as well?
I suppose that could become VERY difficult, since inserting additional code is always a problem due to the limited amount of space.
thunderchero wrote:Gowron,

would it be possible to have all 3 option as large system with few system more sytems and too many systems? just an idea.

thunderchero
Yep, set all maps to 25x18 squares, and set [edx] to 4 at the respective start of subroutines 4DCF00 and 4DC180.
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 »

Here's how you can change the sector string into numeric only (so A1 becomes 1.1):

I found two of these, not sure if this will fix your "guifile.c" problem.

1.

at 0xB58CA: replace 83 C3 41 with 90 90 90
at 0xB58D6: replace 68 58 with 68 57
at 0x17D757: replace 00 25 ... with 25 73 20 25 64 2E

2.

at 0xB5EFB: replace 83 C0 61 with 90 90 90
at 0x17D8FC: replace bytes with 25 64 2E 25 64

Hope it helps.

Btw. Gowron, could not those multipliers actually be height/width of a sector? Then you'd need the resulting values to always be below or equal to 500 and 380 if those are the width and height of the map space. Botf probably detects that the sectors are going past the designated space and refuses to draw them.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1883
Joined: Sun Apr 27, 2008 2:00 am

Fairer Starting Positions Spread for Default Maps

Post by Spocks-cuddly-tribble »

Code: Select all

NAME: Fairer Starting Positions Spread for Default Maps
DESC: Adds GalaxySize (0-2) to the default MinHomeSystemDistance values for a more equal spread.
AUTHOR: Spocks-cuddly-tribble
URL: https://www.armadafleetcommand.com/onscreen/botf/viewtopic.php?p=8910#p8910

>> 0x000ae4c3 8b 15 44 b3 5c
>> 0x000ae4ce 89 d0 c1 fa 1f f7 ff

<< 0x000ae4c3 03 0d b8 36 5a
<< 0x000ae4ce a1 14 b3 5c 00 90 90

#004AF0C3     030D B8365A00    ADD ECX,[5A36B8] // MinHomeSystemDistance + GalaxySize (0-2)

#004AF0CE     A1 14B35C00      MOV EAX,[5CB314]  // LongEdge1
#004AF0D3     9090             NOP
Last edited by Spocks-cuddly-tribble on Tue Jun 21, 2022 4:30 pm, 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.
User avatar
DCER
Code Master
Code Master
Posts: 683
Joined: Sat Apr 26, 2008 2:00 am

Post by DCER »

Eh, sorry about that. :)

I have two versions of trek.exe installed, those that come with multi-installer (based on Jokers patch) and the original from the CD. My values above are for the CD version. Thanks for correcting them.
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: Btw. Gowron, could not those multipliers actually be height/width of a sector? Then you'd need the resulting values to always be below or equal to 500 and 380 if those are the width and height of the map space. Botf probably detects that the sectors are going past the designated space and refuses to draw them.
Yep, the multipliers are probably used as sector heigth/width, but it seems they're used in another way as well.
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
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:Here's how you can change the sector string into numeric only (so A1 becomes 1.1):

I found two of these, not sure if this will fix your "guifile.c" problem.
Thank you very much, this works absolutely fine so far :)


I have found additional instances of the grid multipliers. The F1 map looks quite good already, but some things (stars and system names) are still misaligned in the zoomed-out view.

I will upload a test version for BoP v1.1c with increased map dimensions.
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7848
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Post by thunderchero »

DCER wrote:Here's how you can change the sector string into numeric only (so A1 becomes 1.1)
I was looking at Gowrons test version for BoP v1.1c

And A1 is 0.1 not 1.1 could this be the problem throwing off system names?

Also could large map be set like small map to only show 25 x 18 This way it would be like 4 sectors? and then use arrows to move large map like the small map does?

EDIT;

I thought I would give this a try, I could make map same size as Gowron did. But when tring to make map with a few less sector 40x30 map would not display right (large borders around map) (opps I was not thinking hex had it set to 12 (did not display so used 09 not 0C) now fills up map space) :lol:

so I got some info on vanilla maps that might be useful.

small map:

total area used in pixel is 508x391
each sector 38x38 (0x26)

medium map:

total area used in pixel is 513x385
each sector 31x31 (0x1F)

large map:

total area used in pixel is 526x379
each sector 20x20 (0x14)

each sector regardless of size (even gowrons beta) has a 1 pixel between each sector and this is also all around outside of map for map range.

from what I can see what Gowron has as Grid Multipliers is the size of each sector in pixels. On Gowrons map each sector is 9X9 his setting for all Grid Multipliers is 0x09.

so from vanilla total map sizes the largest map could use up to 526x391 pixels. (maybe 1 or 2 more pixels)

thunderchero
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 »

thunderchero wrote:I was looking at Gowrons test version for BoP v1.1c

And A1 is 0.1 not 1.1 could this be the problem throwing off system names?
The "0.1" is just a "cosmetic" issue, as the game starts counting at zero. For Y-coordinates, a one is added. For X-coordinates, this is not the case as they would normally be converted to literals anyway.

This does not affect system names. In fact, system names and star icons ARE where they should be - on a 25x18 map. Everything else (more or less) has been moved now, but you need to understand that there's no need for a reason for system names behaving the way they do now. It's the way they were supposed to behave, since their position is not determined by the map dimensions, but only by the setting "large".
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
Post Reply

Return to “Galaxy Map Size”