Rebellions & the message withdrawn bug (fix)

Rebellions & the message withdrawn bug (fix); support/discussion/questions

Moderator: thunderchero

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

Rebellions & the message withdrawn bug (fix)

Post by Spocks-cuddly-tribble »

Another teamwork by DCER & me. :)
DCER wrote:There's a bug in botf that when a minor has been conquered and then freed itself on it's own through rebellion, no empire can any longer send proposals to it. Only gifts.

If you send a proposal you'll get two entries in your report saying you withdrew the proposal.
As DCER pointed out the entry at [alienInfo+3C] won't be updated when subjugated minor races shake off slavery via rebellion.

Internal code for rebellion is 0x1000000 & 0x1C0000, set in loc_4402DF as a possible result of insufficient morale.

Confusingly enough, it seems next to impossible (due to a bug?) that minors rebel if random events = off. :?


Minor Race Rebellion / Message Withdrawn Bug (fix) - UPDATED :arrow: viewtopic.php?p=18640#p18640
Last edited by Spocks-cuddly-tribble on Wed Jan 11, 2023 3:22 pm, edited 4 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.
stardust
Rear-Admiral
Rear-Admiral
Posts: 1381
Joined: Sat Apr 26, 2008 2:00 am
Location: good ole Blighty

Post by stardust »

Right, sorry to drag you all down to my level of idiocy, but am I right in saying this code change would then allow you to successfully enter diplomatic relations with a rebelled minor race?
Spocks-cuddly-tribble wrote:Yes it does, but not afterwards!
Computers! [Expletive deleted]

My 4shared folder
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1925
Joined: Sun Apr 27, 2008 2:00 am

Minor Race Rebellion / Message Withdrawn Bug (fix) - UPDATED

Post by Spocks-cuddly-tribble »

Code: Select all

NAME: Minor Race Rebellion / Message Withdrawn Bug (fix) - UPDATED
AUTHOR: Spocks-cuddly-tribble
URL: https://www.armadafleetcommand.com/onscreen/botf/viewtopic.php?p=18640#p18640

>> 0x3F94E 66 8B 45 44 66 3D 05 00 72 47 66 3D 23 00 77 41 31 C0 66 8B 45 44
<< 0x3F94E 0F B7 45 44 3C 05 72 49 8B C8 C1 E1 06 81 C1 4C 20 5A 00 C6 01 00


#Sub_4403D0 (rebellion_effects) loc_44054E

#44054E    0FB745 44       movzx  eax, word [ebp+44h]
#440552    3C 05           cmp    al, 5
#440554    72 49           jb     short 44059F
#440556    8BC8            mov    ecx, eax
#440558    C1E1 06         shl    ecx, 6
#44055B    81C1 4C205A00   add    ecx, offset alienInfo+3C
#440561    C601 00         mov    byte [ecx], 0


On this occasion we prepare subroutine 4403D0 for rebellions even if the inhabitant empire is dead (without restoring source empire). By default it's impossible and causes a partial freeze of random events on such systems. :?

IF inhabitant empire dead THEN jump to code for native rebellions (i.e. create independent rebel system):

Code: Select all

NAME: Enabling Rebellions for Eliminated Empire Systems
DESC: Creates independent rebel systems like native rebellion.
AUTHOR: Spocks-cuddly-tribble
URL: https://www.armadafleetcommand.com/onscreen/botf/viewtopic.php?p=18640#p18640

>> 0x3F885 89
>> 0x3FA2B 89 F1
>> 0x3FA39 0F 85 9C FE FF FF
>> 0x3F178 0F 83
>> 0x4B4FF 73
>> 0x4B63F 73

<< 0x3F885 9D
<< 0x3FA2B 8B CA
<< 0x3FA39 8A 45 4C 75 62 90
<< 0x3F178 90 E9
<< 0x4B4FF EB
<< 0x4B63F EB


#440483   JB 440626 (skip redundant / keep ESI)

#44062B   MOV ECX, EDX

#440639   MOV AL, [ebp+4Ch]
#44063C   JNZ SHORT 4406A0 (native rebellion sequence)
#44063E   NOP

# low-morale penalties (sub_43FB90 - rebellion part starting at 43FD41)
#43FD78    jmp 4402DF

# default random event code (sub_44C04C)
#44C0FF     jmp short 44C132
#44C23F     jmp short 44C260
Last edited by Spocks-cuddly-tribble on Wed Jan 11, 2023 3:23 pm, edited 8 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: 1925
Joined: Sun Apr 27, 2008 2:00 am

Enabling Rebellions without Random Events

Post by Spocks-cuddly-tribble »

I finally found some time to test this. Observations:

1. The above fix for rebellions of dead empire inhabitant systems works flawless. :)

2. Rebellions are possible even without random events, but much rarer and with corrupted messages i.e. "[blank] declares independence from [blank]" (fix below). Note only the updated minor-rebellion fix works even in this case.

Testing with an empire consisting of 10 systems of all possible sorts (home, additional starting, self colonised, free & conquered minor, conquered major/dead+alive & conquered home) - keeping all systems at rebellious morale for 100 turns - I got just barely 2 rebellions without random events (by way of comparison: with random events ~2 per turn).

Also there appears to be a delay (~75 turns/ if not coincidence) and sporadic event accumulations regarding the low morale code. :?

Code: Select all

NAME: Enabling Rebellions without Random Events (updated)
DESC: Enables rebellion main code for 'rebellious' systems without random events. No system events for AI systems.
AUTHOR: Spocks-cuddly-tribble
URL: https://www.armadafleetcommand.com/onscreen/botf/viewtopic.php?p=18755#p18755

>> 0x0004b290 cc be 44
>> 0x0004b294 e1 be 44
>> 0x0004b298 d1 be 44
>> 0x0004b29c f6 be 44
>> 0x0004b2a0 0b bf 44
>> 0x0004b2a7 1e 00
>> 0x0004b2ba 66 3d 04 00
>> 0x0004b2c0 25 ff ff 00 00 ff 24 85 90 be 44 00 ba 2d 00
>> 0x0004b2d0 00
>> 0x0004b35b 23
>> 0x0004b35d 50
>> 0x0004b370 74
>> 0x0004b400 a3 c1 44
>> 0x0004b404 c4 c1 44
>> 0x0004b408 cb c1 44
>> 0x0004b40c d2 c1 44
>> 0x0004b410 d9 c1 44
>> 0x0004b596 11
>> 0x0004b59c ff 24
>> 0x0004b5a3 b9 2d 00 00 00 3b 0d 18 29 5a 00 0f 87 66 ff ff ff
>> 0x00057741 74 0f

<< 0x0004b290 2d 00 00
<< 0x0004b294 23 00 00
<< 0x0004b298 1e 00 00
<< 0x0004b29c 14 00 00
<< 0x0004b2a0 0a 00 00
<< 0x0004b2a7 10 27
<< 0x0004b2ba 8a c8 3c 04
<< 0x0004b2c0 80 3d 46 2b 5a 00 00 74 08 8b 14 8d 90 be 44
<< 0x0004b2d0 90
<< 0x0004b35b 22
<< 0x0004b35d 28
<< 0x0004b370 75
<< 0x0004b400 2d 00 00
<< 0x0004b404 23 00 00
<< 0x0004b408 1e 00 00
<< 0x0004b40c 14 00 00
<< 0x0004b410 0a 00 00
<< 0x0004b596 22
<< 0x0004b59c 8b 0c
<< 0x0004b5a3 3b 0d 18 29 5a 00 77 0e 80 3d 46 2b 5a 00 00 74 05
<< 0x00057741 90 90


#0044BE90     2D  // group 2 & 3 turn delays for difficulty 1-5
#0044BE94     23
#0044BE98     1E
#0044BE9C     14
#0044BEA0     0A

#0044BEA6     BA 10270000        MOV EDX,2710  // new skip delay for group 2 & 3

#0044BEBA     8AC8               MOV CL,AL // difficulty
#0044BEBC     3C 04              CMP AL,4

#0044BEC0     803D 462B5A00 00   CMP BYTE [5A2B46],0  // RANDOMEVENTS OFF ?
#0044BEC7     74 08              JE SHORT 44BED1  // keep skip delay
#0044BEC9     8B148D 90BE4400    MOV EDX,[ECX*4+44BE90]  // get turn delay
#0044BED0     90                 NOP

#0044BF5B     2215 282B5A00      AND DL, [5A2B28] // player empires bitmask

#0044BF70     75 34              JNZ SHORT 44BFA6 // is player (and alive)


#0044C000     2D  // group 1 turn delays for difficulty 1-5
#0044C004     23
#0044C008     1E
#0044C00C     14
#0044C010     0A

#0044C195     77 22              JA SHORT 44C1B9 // exit no events

#0044C19C     8B0C85 00C04400    MOV ECX,[EAX*4+44C000]  // get turn delay
#0044C1A3     3B0D 18295A00      CMP ECX,[5A2918]  // vs TurnNumber
#0044C1A9     77 0E              JA SHORT 44C1B9  // exit no events
#0044C1AB     803D 462B5A00 00   CMP BYTE [5A2B46],0  // RANDOMEVENTS OFF ?
#0044C1B2     74 05              JE SHORT 44C1B9  // exit no events


#00458341     9090               NOP // remove old RANDOMEVENTS OFF switch
Separates the 'Initial test for Rebellions' from the Random Events cf # 1.2 viewtopic.php?p=20540#p20540 (exploitable bias like the eliminated empire bug)



This solves the corrupted message issue with the low morale code: (replacement example taken from random events code at 44C132 & 44C26F)

Code: Select all

NAME: Rebellions with Corrupted Message (fix)
AUTHOR: Spocks-cuddly-tribble
URL: https://www.armadafleetcommand.com/onscreen/botf/viewtopic.php?p=18755#p18755

>> 0x3F6DF 8B 44 24 2E C1 F8 10 BA 00 00 1C 00 E8 E0 00 00 00 89 F8 E8 C9 8E 01 00 BA 00 00 00 01 89 F8 E8 ED 8E 01 00 31 C0 31 D2 8A 46 4C
<< 0x3F6DF 6A FF B8 00 00 00 01 0F BF 1E B9 FE FF FF FF 0F B6 56 4C 80 8E 07 03 00 00 01 E8 82 B7 00 00 0F BF 06 E8 CA 00 00 00 EB 32 90 90


#4402DF     6A FF              PUSH -1
#4402E1     B8 00000001        MOV EAX, 1000000 =rebellion event code
#4402E6     0FBF1E             MOVSX EBX, WORD [ESI] =system ID
#4402E9     B9 FEFFFFFF        MOV ECX, -2
#4402EE     0FB656 4C          MOVZX EDX, BYTE [ESI+4C] =ex-owner ID
#4402F2     808E 07030000 01   OR BYTE [ESI+307], 1
#4402F9     E8 82B70000        CALL 44BA80 (prepare event message/list)
#4402FE     0FBF06             MOVSX EAX, WORD [ESI] =system ID
#440301     E8 CA000000        CALL 4403D0 (rebellion effects)
#440306     EB 32              JMP SHORT 44033A (exit)
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
Post Reply

Return to “Rebellions & the message withdrawn bug (fix)”