Monster planet attacks & Borg spawning

Monster planet attacks & Borg spawning; support/discussion/questions

Moderator: thunderchero

Post Reply
User avatar
afc
Site Founder
Site Founder
Posts: 70
Joined: Fri Apr 25, 2008 2:00 am
Location: USA
Contact:

Monster planet attacks & Borg spawning

Post by afc »

This topic has been renamed from former: editing planet type after Borg Attack


When the borg destroy a system is it possible to have them wipe out the planets but not change them to barron worlds?

Spocks-cuddly-tribble wrote:Yes, in trek.exe at 0x4E8DD change 0F 83 to 90 E9.


Alternatively they could destroy all planets:

At asm-44F4B1:
call 4406F0 (super_nova_effect)
jmp 44F4DD
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2392
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Post by Tethys »

OH MY GOD SCT! The destruction will work great with the Doomsday Machine random! ha! thanks so much!!

Spocks-cuddly-tribble wrote:For this case the better workaround would be changing replacement-planet type from barren to gas giant & replace brg[l,m,s].ani with debris field grapics:

Code: Select all

44F561                 mov     edx, 1 // -> 3
Disable spawning:

Code: Select all

44F4DD                 jnb     loc_44F5D3 // -> jnb loc_44F4FD
However, you still must solve the borg transwarp issue...
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

Post by Peter1981 »

given that we know, thanks to gowron, how the program selects randomly a planet is it possible to destroy or borgify (at most) one planet at a time?

i always liked the borg but i just wish one planet could be change insted of the population smashing follwed by complete borgifiction?

Spocks-cuddly-tribble wrote:For only one planet replaced: (in total i.e. not one per turn!)

Code: Select all

- Check next planet:
44F592                 jmp     loc_44F4CA
44F5AD                 jmp     loc_44F4CA
44F5CE                 jmp     loc_44F4CA

change all to ->  jmp loc_44F5D3 // goto spawning
User avatar
count23
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 66
Joined: Thu May 01, 2008 2:00 am

Post by count23 »

I think this would work wonders with the Crystaline Entity, instead of depopulating a system it de-terraforms it too.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1884
Joined: Sun Apr 27, 2008 2:00 am

Monster planet attacks & Borg spawning

Post by Spocks-cuddly-tribble »

Some important notes for editing:

-> the Ultimate Editor changes some code of sub_44F42C when altering shiplist (monster switch) or map size (for borg spawning)

-> the global map- resp combat- behavior of monsters is not governed by sub_44F42C:
- Borg / Map: stay IF system still populated ELSE transwarp jump to next (not monster occupied) system: viewtopic.php?p=34119#p34119
- Tarellian / Combat: don't fire any weapons: viewtopic.php?p=29166#p29166

-> whereas it's possible to add new system effects for other monster (e.g. +/- credits, morale, research...), adding corresponding new message pop-ups is a bit more complicated i.e. one would have to know about effects

-> enabling planetary defense (OBs/SH) against monster (or system damage besides pop loss), unfortunately, would be excessive work, since we cannot use even part of sub_466CF0(standard system attack). Also note the attack immediately on arrival setting.



At asm-44F3F0 is the switch/jump table for monster system behavior (case=4byte address of code sequence) sorted by shiplist.sst-ID, cf here.


1. Population loss:

Code: Select all

-> Borg:
44F4A4                 cmp     ebx, 0Ah  // kill all if pop lower 10
44F7F3                 fmul    ds:5791B0 (0.5)  // pop loss 50%
44F802                 cmp     dword ptr [esp+20h], 14h  // if pop loss lower 20...
44F809                 mov     dword ptr [esp+20h], 9  // make pop loss 9 (odd values?)

-> Crystal Entity:
44F832                 cmp     esi, 5  // kill all if pop lower 5
44F8AB                 fmul    ds:5791A8 (0.3)  // pop loss 30%

-> Tarellian:
44F8DC                 cmp     edx, 5  // kill all if pop lower 5 
44F955                 fmul    ds:5791A0 (0.15)  // pop loss 15%

2. Planets after Borg Attack: (loc_44F4CA...)

Code: Select all

44F4E3                 cmp     byte ptr [esi+48h], 3 // if not a gas giant...
44F561                 mov     edx, 1 // change to barren
44F56F                 mov     al, [esi+38h] // planet size for brg[l,m,s].ani

3. Borg spawning: (loc_44F5D3...) -> copies after system assimilation (for main borg limits see: viewtopic.php?p=10788#p10788)

For adjusting probabilities see Scheme of the Random Events (#1.1). Turning off random events doesn't prevent borg copies after system assimilation :!:

Code: Select all

44F635                 cmp    ds:58FDE0, 10h //exit if 16 or more cubes in game(redundant)

For difficulty level 1-5:

Random divisor:
44F65B                 mov     eax, 6
44F79A                 mov     edi, 4
44F7AD                 mov     esi, 3
44F7C0                 mov     ebx, 2
44F7D3                 mov     dword ptr [esp+1Ch], 2

44F683                 cmp     edx, 1 // if remainder not 1...
44F686                 jnz     loc_44F4FD  // no new cube

No new cube if number of cubes already in game:
44F660                 mov     ecx, 2
44F79F                 mov     ecx, 3
44F7B2                 mov     ecx, 4
44F7C5                 mov     ecx, 8
44F7DB                 mov     ecx, 10h

44F6A6                 mov     ebx, 24h // Monster race-ID to spawn

4. End turn code for system attack tasks: (prepare message screens)

Code: Select all

Borg: (loc_44F4FD)
44F539                 mov     dword ptr [edx+4], 24h // Borg race-ID

Crystal Entity: (loc_44F84B)
44F887                 mov     dword ptr [edx+4], 25h // Crystal race-ID

Tarellian: (loc_44F8F5)
44F931                 mov     dword ptr [edx+4], 29h // Tarellian race-ID
Last edited by Spocks-cuddly-tribble on Fri Apr 29, 2022 9:20 pm, edited 3 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
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1884
Joined: Sun Apr 27, 2008 2:00 am

Fixing the Crystal Entity (+ Assimilated Systems)

Post by Spocks-cuddly-tribble »

Let's rectify the last unfixed parts of the random events code. :smile:

Adding the Planet Killer: (replaces tarellian system 'attack') viewtopic.php?f=231&t=319#p46143

Testing the Doomsday Machine I found the Crystal Entity, due to a calculation-bias, unable to depopulate the most systems, no matter how long it stays there. The fix-code also changes a random populated planet per turn to 'barren' to render the Crystal Lifeform more canon. :wink:

In order to accomplish this, code of 'negative climate shift' random event has been altered to keep barren planets barren (default changes barren to volcanic).

Random Events: (for disabling/lowering system events and adding counteractions for negative events) viewtopic.php?f=229&t=1493&start=15#p46044


Since the Borg Queen is not amused about recolonizing assimilated systems :twisted: , contrary to sanity and canon :shock: , I also added a simple hex code correcting the oddity.


Fixing the Crystal Entity (enables depopulating systems & shifting populated random planet per turn to barren, due to randomness this can always be the same)

Code: Select all

0x4EC25 change 0x12 bytes -> 8B 75 40 83 FE 00 90 74 F1 EB 63 90 90 83 FE 07 73 6E
0x4EC93 change 0x18 bytes -> 8B 45 00 8B DC 8D 4B 04 33 D2 4A E8 ED C3 FF FF EB 8D 89 34 24 DB 04 24
0x4B13B -> 43 -> 59 

-asm--

0044F825   8B75 40      MOV ESI,[EBP+40]  // population
0044F828   83FE 00      CMP ESI,0
0044F82B   90           NOP
0044F82C  ^74 F1        JE 44F81F  // exit
0044F82E   EB 63        JMP 44F893  // goto shift planet
0044F830   90           NOP
0044F831   90           NOP
0044F832   83FE 07      CMP ESI,7
0044F835   73 6E        JNB 44F8A5

0044F893   8B45 00       MOV EAX,[EBP]
0044F896   8BDC          MOV EBX,ESP
0044F898   8D4B 04       LEA ECX,[EBX+4]
0044F89B   33D2          XOR EDX,EDX
0044F89D   4A            DEC EDX  // set negativ i.e. barren
0044F89E   E8 EDC3FFFF   CALL 44BC90 // shift populated random planet
0044F8A3  ^EB 8D         JMP SHORT 44F832
0044F8A5   893424        MOV DWORD [ESP],ESI
0044F8A8   DB0424        FILD DWORD [ESP]

climate shift negativ keep barren (default: change barren to volcanic)

0044BD3A   7C 59    JL 44BD95  // change barren -> barren
simple hex-code to make borg assimilated system un-colonizable

Code: Select all

0x4E962 -> 01 -> 03
Last edited by Spocks-cuddly-tribble on Fri Apr 29, 2022 7:52 pm, edited 1 time 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
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1884
Joined: Sun Apr 27, 2008 2:00 am

Borg Attack Message fix for Uninhabited Systems

Post by Spocks-cuddly-tribble »

Code: Select all

trek.exe at 0x4E897 change 0xA bytes to 83 7D 40 00 0F 8E B5 00 00 00

-asm--
0044F497   837D 40 00      CMP DWORD [EBP+40],0
0044F49B   0F8E B5000000   JLE 44F556
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Kurn
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 93
Joined: Thu Aug 12, 2010 2:00 am
Location: Germany

Re: Fixing the Crystal Entity (+ Assimilated Systems)

Post by Kurn »

Spocks-cuddly-tribble wrote: Sat Apr 16, 2011 11:46 am Crystal Entity / Tarellian -> erratic stay behavior i.e. won't stay long enough in systems for pop loss "if pop killed" events. Crystal doesn't even search for systems?
Spocks-cuddly-tribble wrote: Wed May 04, 2016 3:53 pm Fixing the Crystal Entity (enables depopulating systems & shifting populated random planet per turn to barren, due to randomness this can always be the same)
I've noticed in my mod that the crystal just waits now for over 100 turns in empty sectors...
Is there a hex code to make the crystal search for systems like the borg do?
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1884
Joined: Sun Apr 27, 2008 2:00 am

Re: Monster planet attacks & Borg spawning

Post by Spocks-cuddly-tribble »

Monsters getting stuck on the map(or even disappear) is a mod independent problem.

'Monster editing info' should hold a post on monster map movements, but options are very limited. You can change the crystal value (second on the switch table if by monster race ID i.e. crystal 25h). But this might render the monster too destructive in low tech games and also affects planet killer if added.

Obligatory advice: you must start a new game to make it work and/or to prevent bugs.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Kurn
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 93
Joined: Thu Aug 12, 2010 2:00 am
Location: Germany

Re: Monster planet attacks & Borg spawning

Post by Kurn »

Thanks for the information, Code Master. I also want to use the opportunity to thank you for all your great fixes! You really improved the game during all the years. Pesonally I think "Protecting the AI from Neutron Stars" was your finest fix.
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2392
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: Fixing the Crystal Entity (+ Assimilated Systems)

Post by Tethys »

Spocks-cuddly-tribble wrote: Wed May 04, 2016 3:53 pm Let's rectify the last unfixed parts of the random events code. :smile:

Adding the Planet Killer: (replaces tarellian system 'attack')
viewtopic.php?f=231&t=319#p46143

Testing the Doomsday Machine I found the Crystal Entity, due to a calculation-bias, unable to depopulate the most systems, no matter how long it stays there. The fix-code also changes a random populated planet per turn to 'barren' to render the Crystal Lifeform more canon. :wink:

In order to accomplish this, code of 'negative climate shift' random event has been altered to keep barren planets barren (default changes barren to volcanic).

Random Events: (for disabling/lowering system events and adding counteractions for negative events)
viewtopic.php?f=229&t=1493&start=15#p46044


Since the Borg Queen is not amused about recolonizing assimilated systems :twisted: , contrary to sanity and canon :shock: , I also added a simple hex code correcting the oddity.


Fixing the Crystal Entity (enables depopulating systems & shifting populated random planet per turn to barren, due to randomness this can always be the same)

Code: Select all

0x4EC25 change 0x12 bytes -> 8B 75 40 83 FE 00 90 74 F1 EB 63 90 90 83 FE 07 73 6E
0x4EC93 change 0x18 bytes -> 8B 45 00 8B DC 8D 4B 04 33 D2 4A E8 ED C3 FF FF EB 8D 89 34 24 DB 04 24
0x4B13B -> 43 -> 59 

-asm--

0044F825   8B75 40      MOV ESI,[EBP+40]  // population
0044F828   83FE 00      CMP ESI,0
0044F82B   90           NOP
0044F82C  ^74 F1        JE 44F81F  // exit
0044F82E   EB 63        JMP 44F893  // goto shift planet
0044F830   90           NOP
0044F831   90           NOP
0044F832   83FE 07      CMP ESI,7
0044F835   73 6E        JNB 44F8A5

0044F893   8B45 00       MOV EAX,[EBP]
0044F896   8BDC          MOV EBX,ESP
0044F898   8D4B 04       LEA ECX,[EBX+4]
0044F89B   33D2          XOR EDX,EDX
0044F89D   4A            DEC EDX  // set negativ i.e. barren
0044F89E   E8 EDC3FFFF   CALL 44BC90 // shift populated random planet
0044F8A3  ^EB 8D         JMP SHORT 44F832
0044F8A5   893424        MOV DWORD [ESP],ESI
0044F8A8   DB0424        FILD DWORD [ESP]

climate shift negativ keep barren (default: change barren to volcanic)

0044BD3A   7C 59    JL 44BD95  // change barren -> barren
simple hex-code to make borg assimilated system un-colonizable

Code: Select all

0x4E962 -> 01 -> 03
Hi SCT, thank you for this wonderful addition. However, I am having some trouble understanding something here. I am wanting all planets to change to Volcanic EXCEPT for the Barren worlds.. so I'd be keeping 44BD3A > 7C 59

I suppose my question is how does one extrapolate "Barren" from value "4A" when "Barren" is "01"?

Also, I am looking at 0x4E962, but you explain here that this is for Borg. I can only assume that this is possibly a shared value between Borg and new code? If so, will altering 4E962 01 > 07 have the desired effect? Assuming they are shared, if I wanted them separate, I would be looking at adding a new section for climate shift > negative?

Thank you again :)
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1884
Joined: Sun Apr 27, 2008 2:00 am

Re: Fixing the Crystal Entity (+ Assimilated Systems)

Post by Spocks-cuddly-tribble »

Tethys wrote: Fri Jan 14, 2022 4:52 pmI am wanting all planets to change to Volcanic EXCEPT for the Barren worlds.. so I'd be keeping 44BD3A > 7C 59
First note that climate shift negative will only change one random planet per call, not all.

And no, in this case you want to keep vanilla defaut jump destination 7C 43 loc_44BD7F for climate shift negative.

And change:

Code: Select all

0044BD83                 jnz     short  loc_44BD95 -> jz
Tethys wrote: Fri Jan 14, 2022 4:52 pmI suppose my question is how does one extrapolate "Barren" from value "4A" when "Barren" is "01"?
No, sub_44BC90 climate_shift (here shared for Crystal Entity) is shared for positive and negative shifts, 4A DEC EDX is just switch indicator for negative shifts.
Tethys wrote: Fri Jan 14, 2022 4:52 pmAlso, I am looking at 0x4E962, but you explain here that this is for Borg. I can only assume that this is possibly a shared value between Borg and new code?
No, the default borg code (after population annihilation) changes all planets (except gas giants) to barren 01 (here changed to gas giant 03 to make them uninhabitable in vanilla) while the borg planet replacement anis stay the same.
Tethys wrote: Fri Jan 14, 2022 4:52 pmIf so, will altering 4E962 01 > 07 have the desired effect?
Yes, adapting default borg code, changing the gas giant exception to barren and replacement type from barren to volcanic might be the best way for you.

See above @ 2. Planets after Borg Attack: (loc_44F4CA...) But the old borg code will first lower population as explained @ 1 above. (My Planet killer code works different, see link).
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: Monster planet attacks & Borg spawning

Post by Tethys »

Thank you SCT, I got it figured out now. I was able to create another cmp for asteroid type within Borg ani replacement sub and I ended up switching Crystal and Doomsday graphic file and text info description on shiplist and lexicon (Crystal behaves like Borg now and "grows" new Crystal ships with each system "eaten"). I am very happy with these results. :up:

Code: Select all

AUTO:0044F4E3 80 7E 48 01                                     cmp     byte ptr [esi+48h], 3 ; 03 gas giant (check type)
AUTO:0044F4E7 0F 85 B3 D6 23 00                               jnz     brgs_ani        ; jump if not type > 68CBA0

0068CBA0   807E 48 03       CMP BYTE PTR DS:[ESI+48],3
0068CBA4  -0F85 B729DCFF    JNZ trek.0044F561            ; jump if not type > brgs_ani
0068CBAA  -E9 3E29DCFF      JMP trek.0044F4ED            ; end_borg_planet_loop

Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2392
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: Monster planet attacks & Borg spawning

Post by Tethys »

Whew, good thing I documented that code change above. It's one that got lost when *ahem* one of my kids uninstalled BotF from the laptop I was using to dev at the time. Most of the code changes exist in .3.6x1, but damn.. some got lost.

I also added a climate shift check for type 01 Barren, now it will skip Gas Giant as well as Asteroid type :up:

Basically, the monster isnt going to blow up the asteroids into more asteroids now :roll: because asteroids will no longer be able to shift into anything, they will always be asteroids

Code: Select all

0044BD29   E9 820E2400      JMP 0068CBB0				; reloc

0068CBB0   807E 48 01       CMP BYTE PTR DS:[ESI+48],1			; 01 barren
0068CBB4  ^0F84 63F1DBFF    JE 0044BD1D					; go to same place gas giant goes after check
continue >
0068CBBA   3B0C24           CMP ECX,DWORD PTR SS:[ESP]			; relocated data
0068CBBD  ^0F84 72F1DBFF    JE 0044BD35					; relocated je
0068CBC3  ^E9 66F1DBFF      JMP 0044BD2E				; go back to right place after relocated data

Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
Post Reply

Return to “Monster planet attacks & Borg spawning”