Territorial Claims

Territorial Claims; support/discussion/questions

Moderator: thunderchero

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

Territorial Claims

Post by Spocks-cuddly-tribble » Sun Aug 21, 2011 7:44 am

Since extending the sphere of territorial claims has been requested, mainly due to the intercept option being almost useless on larger maps, here is how it can be done:


ds:[5B4210] points to a sector list for each empire (like the SphOfIn) containing the cumulative claim predictor values as 8 byte floats per sector.



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

Code: Select all

0044742E                 fcomp   ds:[578AA4]  // 10.0

00447437                 jbe     short 447493  // no claim if lower than 11

Territorial claim predictor values & areas of surrounding sectors for: (perimeter works just like the range & scan mechanics)

Note; the claim values are 4 bytes parts of 8 bytes floats, and they are additive.

Code: Select all

-Outposts:

004477BC                 push    3FF00000h  // claim value / sector = +1.0

004477C7                 mov     ecx, 1  // perimeter size in sectors


-Starbases:

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
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
Using this information, even a Pakled now should be able to predict and achieve any desired effect. :)
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2065
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: Modifying Territorial Claims

Post by Tethys » Sun Aug 21, 2011 9:13 am

Oh my word this is just wonderful, looks like I have something to test today after all :mrgreen:
Not for the weak of heart...
Image
GALM <--- GALM/Galaxies Mod

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 » Sun Aug 21, 2011 9:56 am

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: 723
Joined: Sun Apr 27, 2008 2:00 am

Re: Territorial Claims

Post by Spocks-cuddly-tribble » Sun Feb 19, 2012 7:37 am

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
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

User avatar
jonesie85two
Lieutenant-Commander
Lieutenant-Commander
Posts: 201
Joined: Sat Apr 26, 2008 2:00 am

Re: Territorial Claims

Post by jonesie85two » Thu Dec 06, 2012 6:41 pm

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: 109
Joined: Mon May 05, 2008 2:00 am

Re: Territorial Claims

Post by Dafedz » Sun Feb 24, 2013 2:56 pm

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

Re: Territorial Claims

Post by thunderchero » Sun Feb 24, 2013 3:12 pm

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: 109
Joined: Mon May 05, 2008 2:00 am

Re: Territorial Claims

Post by Dafedz » Sun Feb 24, 2013 7:43 pm

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

Re: Territorial Claims

Post by thunderchero » Sun Feb 24, 2013 8:41 pm

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: 2546
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: Territorial Claims

Post by Flocke » Sun Feb 24, 2013 9:02 pm

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: 109
Joined: Mon May 05, 2008 2:00 am

Re: Territorial Claims

Post by Dafedz » Mon Feb 25, 2013 11:52 am

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

Re: Territorial Claims

Post by thunderchero » Mon Feb 25, 2013 12:07 pm

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: 2546
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: Territorial Claims

Post by Flocke » Mon Feb 25, 2013 12:42 pm

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: 109
Joined: Mon May 05, 2008 2:00 am

Re: Territorial Claims

Post by Dafedz » Mon Feb 25, 2013 1:44 pm

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

Re: Territorial Claims

Post by thunderchero » Mon Feb 25, 2013 2:24 pm

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”

Who is online

Users browsing this forum: No registered users