Territorial Claims

Territorial Claims; support/discussion/questions

Moderator: thunderchero

User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1884
Joined: Sun Apr 27, 2008 2:00 am

Territorial Claims

Post by Spocks-cuddly-tribble »

Each own star system and station has a certain 'border influence', adding to an invisible grid map of claim predictor values:


:arrow: The overlapping, cumulative claim predictor value of the sector must be greater than 10 to see the claim on the map :!:

Threshold value for claim of uninhabited sectors without stations: (contested if more than one empire exceeds this)

Code: Select all

0044742E         fcomp   ds:[578AA4]  // 10.0 -> at 0x1768A4 (00 00 00 00 00 00 24 40)
  
64-bit = 8 byte = double precision (in little-endian format!) 00 00 00 00 00 00 24 40 = 0x4024000000000000 = 10.0

When changing the threshold also change this mirror code to be on the safe side:

ds:578AE4 // 0x1768E4 (00 00 00 00 00 00 24 40) 10.0


Territorial claim predictor base values & effect radius of surrounding sectors for: (radius works just like the scan values :idea: )

Code: Select all

-> Outposts:
004477BC                 push    3FF00000h  // claim predictor base value / sector = +1.0 // at 0x46BBD
004477C7                 mov     ecx, 1     // effect radius in sectors // at 0x46BC8

-> Starbases:
00447761                 push    40240000h  // claim predictor base value / sector = +10.0 // at 0x46B62
0044776C                 mov     ecx, 1     // effect radius in sectors // at 0x46B6D

-> Inhabited Major Empire Star Systems:
004475EC                 push    40240000h  // claim predictor base  value / sector = +10.0 // at 0x469ED
004475F7                 mov     ecx, 1     // effect radius in sectors // at 0x469F8
That's why you see claimed sectors between a starbase and outpost but not between two outposts (10+1 > 10 but 1+1 < 10). :idea:


Star systems have a special feature that adds for map row & column +2/-2 (i.e. for four sectors) each the value +1.0 (via fld1):

Code: Select all

row/column distance in sectors:
00447526                 sub     ecx, 2
0044755D                 add     ecx, 2
00447598                 sub     ecx, 2
004475D5                 add     ecx, 2

To disable: (recommended when extending radius of claim predictor values for star systems)

0x46918 change E8 93 63 FF FF -> E9 BF 00 00 00

00447518     E9 BF000000    JMP 4475DC // skip star system extra feature

The claim predictor values (for AI empires) can be displayed via map ai data type A 'Border Influence': viewtopic.php?f=221&t=2401#p34204



:arrow: Modding Example: (no matter if star system, outpost or starbase)

threshold (set claim if predictor greater than) = 11.0
claim predictor base value / sector = 6.0
effect radius in sectors = 2
-> claim radius of 1 surrounding sector, since 6*2 = 12 is greater than 11 (even without other own nearby objects)


Note; the claim predictor base values are 4 bytes parts of 8 bytes floats (in little-endian format) and they are additive!

Examples for parts of hex code to change the claim predictor base values:

2E 40 -> 15.0

24 40 -> 10.0
22 40 -> 9.0
20 40 -> 8.0
1C 40 -> 7.0
18 40 -> 6.0
14 40 -> 5.0
10 40 -> 4.0
08 40 -> 3.0
00 40 -> 2.0
F0 3F -> 1.0

Extending the sphere of territorial claims has been requested, mainly due to the intercept option being almost useless on larger maps. :wink:
Using this information, even a Pakled now should be able to predict and achieve any desired effect. :)
Last edited by Spocks-cuddly-tribble on Tue Dec 26, 2023 8:37 am, edited 14 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
Tethys
Past Administrator
Past Administrator
Posts: 2392
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: Modifying Territorial Claims

Post by Tethys »

Oh my word this is just wonderful, looks like I have something to test today after all :mrgreen:
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Re: Modifying Territorial Claims

Post by Peter1981 »

He gives us things; things to make us strong -- we like strong :)

works great for me -- I've just increased the starbase claim radius to 2 :) really happy thanks SCT and thanks tethys for the chat and help :)

EDIT: removed incorrect info. sorry for the confusion SCT thanks for putting me straight on this.
Last edited by Peter1981 on Mon Aug 22, 2011 9:25 am, edited 3 times in total.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1884
Joined: Sun Apr 27, 2008 2:00 am

Re: Territorial Claims

Post by Spocks-cuddly-tribble »

yoshimitsu31 wrote:Hi, I have a question about one of your posts.

Subject: Territorial Claims
Spocks-cuddly-tribble wrote: Major star systems have a special feature that adds for map row & column +2/-2 (i.e. for four sectors) each the value +1.0 (via fld1).

Code: Select all

row/column distance in sectors:
00447526                 sub     ecx, 2
0044755D                 add     ecx, 2
00447598                 sub     ecx, 2
004475D5                 add     ecx, 2
To disable: (recommended when extending perimeter of star systems)
00447518     E9 BF000000    JMP 4475DC // skip star system extra feature
How is it possible to edit the line to disable the effect? I'm new to modding and don't know much about assembly. I have IDA 5 Pro Free, but I don't seem to be able to type in what is needed. Do I need a different program?
(normally I delete my PMs unread, unless project related teamwork was arranged)

Quite taut asm-instructions are a result of pressure of time no more, no less. However, for topics like this one, I'd suggest that in future modders might add converted hex addresses and /or more understandable hints for noobs when implementing the findings into their mods.

Code: Select all

00447518     E9 BF000000    JMP 4475DC
-> 00447518 = ASM address
-> E9 BF000000 = new hex code to enter at converted address (asm to hex)
See: viewtopic.php?f=4&t=598&p=8288&hilit=As ... e119#p8288

Alternatively
-> JMP 4475DC = instruction to enter in OllyDbg at asm address
See: viewtopic.php?p=27485&sid=d37987e27ad62 ... bcb#p27485
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
jonesie85two
Lieutenant-Commander
Lieutenant-Commander
Posts: 201
Joined: Sat Apr 26, 2008 2:00 am

Re: Territorial Claims

Post by jonesie85two »

Its seems tehre are 3 options with the special home system value.

1/ Leave it as is which causes a slight bug with one central tile and four other seperated from the home system.

2/ Disable the fuction leaving your homesystem as a single tile. Is this throughout the game? I have tried playing through 50 turns and it sems the home system terratory never expands.

3/ Edit the following,
00447526 sub ecx, 2
0044755D add ecx, 2

00447598 sub ecx, 2
004475D5 add ecx, 2

As isual i have some questions. sub and add? teh add isnt an assembler code. is it to replace from the location stated in the sub? Also, what does this option actually do?

Thank you for your time and patience
User avatar
Dafedz
Lieutenant-Commander
Lieutenant-Commander
Posts: 131
Joined: Mon May 05, 2008 2:00 am

Re: Territorial Claims

Post by Dafedz »

Hi, old modder here looking to experiment with some of these great new discoveries, but I'm looking for a bit of noob help. My expertise runs as far as using an old hex editor for altering such values. I'm unsure as what exactly to change in hex, in regards to system and starbase perimeter values as outlined in original post:

-Outposts:

00447761 push 40240000h // claim value / sector = +10.0

0044776C mov ecx, 1 // perimeter size in sectors


-Inhabited major systems:

004475EC push 40240000h // claim value / sector = +10.0

004475F7 mov ecx, 1 // perimeter size in sectors
Any assistance will be much appreciated, thanks
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7849
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Territorial Claims

Post by thunderchero »

I will try to help,

Code: Select all

-Inhabited major systems:

004475EC                 push    40240000h  // claim value / sector = +10.0

004475F7                 mov     ecx, 1  // perimeter size in sectors
004475EC is botf assembler offset. use UE to convert to hexadecimal address. "0x469ec" (this is in tools/other/convert address)

push 40240000h this is what would be shown in disassembler program like "ida"
but at address of trek.exe it is
68 (push)
00 00 24 40 (this is last 4 bytes of a double (8 byte) 10 = 00 00 00 00 00 00 24 40)
so if you wanted to increase value enter new value in decimal area of UE press convert and use last 4 bytes.
example 20 = 00 00 00 00 00 00 34 40 but only use 00 00 34 40

hope this helps

thunderchero
User avatar
Dafedz
Lieutenant-Commander
Lieutenant-Commander
Posts: 131
Joined: Mon May 05, 2008 2:00 am

Re: Territorial Claims

Post by Dafedz »

Cheers Thunder, much appreciated mate. But I must indeed be a Pakled - an old one as well :/ I can follow what you explain here, but I'm still not sure what to input to get the desired effect, which is: expand Starbase sector claim to 2 sectors radius on each side, and 1 on each side for an inhabited system. What am I doing wrong? lol

thanks in advance.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7849
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Territorial Claims

Post by thunderchero »

ok to give starbases;
  • X | X | X
    X | B | X

    X | X | X
with "X" being new territorial claims

change at 0x46b61 68 00 00 24 40 -> 68 00 00 34 40

this will increase value from 10 -> 20

and if you change at 0x46b6c B9 01 -> B9 02
  • O | X | X | X | O
    X | X | X | X | X
    X | X | B | X | X
    X | X | X | X | X

    O | X | X | X | O
the corners will be open territory.

Note uninhabited sectors will also be open if on edge.

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

Re: Territorial Claims

Post by Flocke »

first, get a disassembler like ida pro (there's a free version) or OllyDbg so you can actually see some code that is talked about.
In there you can also directly compare hex and assembler including adress offsets.
Ida is great for analysis, OllyDbg is great to alter code.
And HxD btw is a good free hex editor I recommend, just to complete the tools list.

To get some easier look on the asm code, check out the IDA Database of QuasarDonkey.

then you need to alter the claim values at adresses listed above.
these are float/double values, stored in little endian, either use the disassembler to tell you the hex or UE or one of the online float hex converters. first check the hex values given to figure the right hex value order when converting.

just copy pasting the solution doesn't bring you far, most changes by now are in asm code

hope that gets you go :)
User avatar
Dafedz
Lieutenant-Commander
Lieutenant-Commander
Posts: 131
Joined: Mon May 05, 2008 2:00 am

Re: Territorial Claims

Post by Dafedz »

Thanks Thunder for your continued help mate. In fact, I followed the original explanation well enough it seemed, for I already made these changes, altering lines 0x46b61 and 0x46b6c exactly as described. But it still didn't work for me - not correctly, not the way I had imagined. In the test game I'm running all these new surrounding sectors don't read: 'Federation Sector', as I would expect, they are not all coloured in blue, and some still say: 'Unclaimed Sector'. So something's not quite right. I also crashed soon after building the Starbase. Upon sending a scout though one adjacent (and empty) sector I received a CTD. The crashlog entry of concern reports:

File: ..\..\source\universe\readrace.c, Line: 257, 0

From what I could discover the reason for this crash is related to Galaxy generation, and it is recommended to wait for the intro video to finish before starting a game. I couldn't figure this out. This isn't Turn 1. Anyway, I kept trying the same turn, and tried sending the ship to a different nearby sector. The game continued to crash. So I loaded up a previous non-modded version of trek.exe (the old backed up version before the territorial claim mod) and played the same turn to see what that would do. Success. No crash. This suggests to me that the crash was related to the changes I made to re: starbase sector claim.

Cheers Flocke. I've been fiddling around with IDA for the last couple of days. And I still have my old copy of UE for Hex editing (UltraEdit that is, not Ultimate Editor). But assembly code is a different world for me - a strange new world you could say lol. I just don't have the experience or expertise to know exactly what I'm doing - just as one doesn't have any context for what they're seeing when looking at a book written in a foreign language. I could sit down and study long and hard, but that's a big task, and I just don't have a lot of free time atm.

I'm not looking to delve really deeply into the code analysis side of things. Originally my mod releases involved chiefly ships/buildings/minors/ and basically giving BoTF an extra kick, a new flavour. Now, thanks to so many doing such awesome work, I'm quite out of the loop! I'm doing my best though, and each day as I look through the forums I'm finding new and more impressive fixes/features - things I long thought impossible, but with this new info mostly provided in assembly language, it's beyond my means to understand/translate, and to mod myself with my limited and humble knowledge of hex editing.

But thanks to you guys I'm trying :)
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7849
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Territorial Claims

Post by thunderchero »

It sounds like you are not editing the correct location.

how are you getting to 0x46b61 and 0x46b6c

most editors will have a "go to" function that will take you dircetly to that code location.

that brings me to next question, what hex editor do you use?

in my hex editor that line would look like this;

before changing
00046b60h: C0 68 00 00 24 40 8A 44 24 0C 6A 00 B9 01 00 00 ; Àh..$@ŠD$.j.¹...

after changing
00046b60h: C0 68 00 00 34 40 8A 44 24 0C 6A 00 B9 02 00 00 ; Àh..4@ŠD$.j.¹...

(I added red just to show where I changed)

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

Re: Territorial Claims

Post by Flocke »

wait, I dunno how trek.exe is dealing with saves here, better try start a new game
territorial claim is stored with the savegames

beside that, don't fear that strange looking asm code, with some time it starts to make more sense. It's just quite helpful to at least get some better guess at what you're changing. When you click on a value in IDA on bottom of asm window it shows both asm and hex address. Further you can switch to the hex view and jump both to asm or hex offsets.
Ofc it takes time to find out all the details. Not that I'm asking to learn it all. ;)
User avatar
Dafedz
Lieutenant-Commander
Lieutenant-Commander
Posts: 131
Joined: Mon May 05, 2008 2:00 am

Re: Territorial Claims

Post by Dafedz »

Here's a capture of one of the changed lines:
Image

The other is also correct. I'm using Ultaredit (an older version) but it's the one I'm comfortable with, and have been using for modding for years and know my way around it for my purposes.

Here's a cap with the starbase in question:
Image

This is Turn 15 or something, I had begun with a brand new game, Tech 5. I built a couple of Transports, sent them out, built the SB, and as you can see the surrounding sector claim is as it was before.

Cheers Flocke, yeh I've been doing that, having the IDA view synchronized with the Hex view. That way I see the correspondence between the two, and using Ultimate editor to convert the addresses, looking them up in UltraEdit and making the changes there.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7849
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Territorial Claims

Post by thunderchero »

Flocke wrote:wait, I dunno how trek.exe is dealing with saves here, better try start a new game
no worries here saved game is adjusted on load up to new value (tested)

I would test 1 change at a time, example build a starbase with no systems within changing area.

from your image it looks like the first starbase change is working.

Is the other changes you are making to "uninhabitated sectors"? this would cancel out starbase claims

thunderchero
Post Reply

Return to “Territorial Claims”