Revolutionary but Probably Impossible Mod Idea

General Modding Information/Questions; support/discussion/questions

Moderator: thunderchero

Forum rules
:idea: Please search before starting new topic. :idea:
There is a good chance it has already been asked.
Post Reply
User avatar
MarkXXX
Cadet 4th Year
Cadet 4th Year
Posts: 17
Joined: Sun May 02, 2010 2:00 am

Revolutionary but Probably Impossible Mod Idea

Post by MarkXXX »

Simple in theory, but probably impossible to execute as a mod: changing the player's empire mid-game.

Example: You're playing as the Feds and you're kicking the AI empire's butts. Okay. Now suddenly, at, say, turn 200, you are in control of the Romulans instead and the AI takes over for you as the Feds. The AI gets all of your precisely managed colonies, your incredible research accomplishments and your devastating fleets, and you have to deal with whatever mess the AI left the Romulans in.

Can something like this be done? Because I've always wanted to be dropped into the middle of a game where I am a severe underdog. I know selecting a lower starting level for myself could sort of do this, but I like the idea of having to find a way to rescue an underdog empire mid-game.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7824
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Revolutionary but Probably Impossible Mod Idea

Post by thunderchero »

I don't see any way to create an interface to accomplish your idea.

but you can do it manually;
1. open saved game with UE
2. change to multi player game (edit\game\game info)
3. save changes to saved game with UE
4. start a multiplayer game
5. host loads save and selects underdog race you want to play
6. joining player select original race
7. once both player are in game the joining player needs to exit game.
8. after joining player exits host player can save game in new/open slot.
9. open the saved game you just saved in open slot with UE
10. change to single player game (edit\game\game info)
11. save changes to saved game with UE
12 load saved game as underdog single player game

The reason you have to do all this is for AI to take proper control of original race and to allow you to get proper human control of underdog.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1870
Joined: Sun Apr 27, 2008 2:00 am

Re: Revolutionary but Probably Impossible Mod Idea

Post by Spocks-cuddly-tribble »

thunderchero wrote: Sat Jan 15, 2022 2:14 pmThe reason you have to do all this is for AI to take proper control of original race and to allow you to get proper human control of underdog.
In theory you can make it easier with a patch using sub_510BA0.

First update savegame file -> gameInfo

Code: Select all

Offset 0x0250 player empires bitmask
Offset 0x0252 player empire
then use call sub_510BA0 to update player/AI control of the empires.

Best would be to insert the call in the beginning of sub_4387F0 (Load Game) and test if that works.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7824
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Revolutionary but Probably Impossible Mod Idea

Post by thunderchero »

Spocks-cuddly-tribble wrote: Sat Jan 15, 2022 3:43 pm
thunderchero wrote: Sat Jan 15, 2022 2:14 pmThe reason you have to do all this is for AI to take proper control of original race and to allow you to get proper human control of underdog.
In theory you can make it easier with a patch using sub_510BA0.

First update savegame file -> gameInfo

Code: Select all

Offset 0x0250 player empires bitmask
Offset 0x0252 player empire
then use call sub_510BA0 to update player/AI control of the empires.

Best would be to insert the call in the beginning of sub_4387F0 (Load Game) and test if that works.
I tried to create a patch as suggested but would crash on game load
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1870
Joined: Sun Apr 27, 2008 2:00 am

Re: Revolutionary but Probably Impossible Mod Idea

Post by Spocks-cuddly-tribble »

thunderchero wrote: Sun Jan 16, 2022 12:00 amI tried to create a patch as suggested but would crash on game load
Sorry for the trouble.

I see it's more complex. sub_510BA0 does not seem to auto check and update player/AI controll of all empires.

It needs ds:5A2998 resp ds:597504 loaded into 'al', so more research is needed.

This could be the updated player empires bitmask or some other marker.

And there might be even more issues.


EDIT: I think I got it now.

Do NOT update/edit the savegame file / gameInfo!

Instead the updated player empires bitmask must be loaded into al and afterwards into DS: 5A2B28.

Question is if this works in the beginning of sub_4387F0 (Load Game).

Code example:

mov byte [5A2B2A], (new player empire ID) e.g. 4 romulan
mov al, (new player empires bitmask) e.g. 10h when changing player empire to romulan
call sub_510BA0
mov byte [5A2B28] (player_empires_bitmask), (new player empires bitmask) same as above e.g. 10h.
EDIT2: To be on the safe side also add:
call 4569E0
call 438740


Patch should be removed before loading the next game!
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7824
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Revolutionary but Probably Impossible Mod Idea

Post by thunderchero »

Spocks-cuddly-tribble wrote: Sun Jan 16, 2022 8:35 am And there might be even more issues.
I think you might be right :wink:

I think I followed your instructions correctly, but crash on attempt to load saved game with patch applied to change controlling race.

here is my changes using relocation table
crash.jpg
crash.jpg (115.64 KiB) Viewed 2174 times
here is botf crash log

Version Under Test: 72
File: gdllist.c, Line: 667, gdlList != NULL
Initialize State: 31
Player Empire: 4 Starting Seed: 0
Galaxy shape: 0 Galaxy Size: 0
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1870
Joined: Sun Apr 27, 2008 2:00 am

Re: Revolutionary but Probably Impossible Mod Idea

Post by Spocks-cuddly-tribble »

thunderchero wrote: Sun Jan 16, 2022 1:01 pmFile: gdllist.c, Line: 667, gdlList != NULL
Looks as if the files to alter aren't loaded yet.

The structure of sub_4387F0 (Load Game) is not well suited for multiplayer empire control update codes like sub_510BA0.

Adding the patch to end of 'load game' might cause issues with the saved game player data for this turn's incidents and other logs (calls at 438980 & 4389A3)?

Plus this little bugger needs to be adapted for GUI:

Code: Select all

00438864                 mov     al, ds:player_empire -> mov al, new empire ID
Dunno if this is worth a try.

The benfit of a patch solution would be avoiding the need of a MP settup i.e. force code to do this for you:
thunderchero wrote: Sat Jan 15, 2022 2:14 pm5. host loads save and selects underdog race you want to play -> sub_510BA0

7. once both player are in game the joining player needs to exit game. -> sub_510BA0
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7824
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Revolutionary but Probably Impossible Mod Idea

Post by thunderchero »

Spocks-cuddly-tribble wrote: Sun Jan 16, 2022 2:13 pm Dunno if this is worth a try.
I don't

I did try suggestions above still crashed. new log
File: hash.c, Line: 74, hash != NULL
Initialize State: 31
Player Empire: 4 Starting Seed: 1642348299
Galaxy shape: 0 Galaxy Size: 2
User avatar
MarkXXX
Cadet 4th Year
Cadet 4th Year
Posts: 17
Joined: Sun May 02, 2010 2:00 am

Re: Revolutionary but Probably Impossible Mod Idea

Post by MarkXXX »

Thanks all for looking into this.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7824
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Revolutionary but Probably Impossible Mod Idea

Post by thunderchero »

MarkXXX wrote: Mon Jan 17, 2022 10:29 am Thanks all for looking into this.
it is still possible you just need to do "race switch" manually. with UE and load as multiplayer game.
Post Reply

Return to “General Modding Information/Questions”