Playing a singleplayer scenario from the other side by making a new AI

Byzantine Productions Pike and Shot is a deep strategy game set during the bloody conflict of the Thirty Years War.

Moderators: rbodleyscott, Slitherine Core, Gothic Labs

Post Reply
TheOldie
Private First Class - Wehrmacht Inf
Private First Class - Wehrmacht Inf
Posts: 6
Joined: Sat Dec 26, 2020 7:52 pm

Playing a singleplayer scenario from the other side by making a new AI

Post by TheOldie »

Has anyone successfully converted a scenario so that one could play it from the originally non-player side? I would like to be able to play Odenthus' Minden scenario from the Allied side against a French AI. I attempted the "switch sides" method from the ScenarioDesign PDF which is:

"Open a copy of the .BAM file in a text editor.
Replace all "_0_" with "_2_"
Replace all "_1_" with "_0_"
Replace all "_2_" with "_1_"
Swap the values in SIDEID0 and SIDEID1
And voila, the scenario sides are reversed.
But, of course, you will need to write completely new AI...."

For a new AI, I tried dropping in the "AI Masterplan" file the PDF also mentions, deleting the "//" where told. I assumed this would likely not work, and it did not. I am able to load the scenario with the Allied units under my control, but the French side does not spawn at all: I instantly get a message saying "The enemy has lost heart."

So I presume I will most likely have to write a brand-new AI, which I have no idea how to do, unless there is some miraculous way to make Minden work with the masterplan.
Cronos09
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 326
Joined: Thu Feb 22, 2018 4:28 pm

Re: Playing a singleplayer scenario from the other side by making a new AI

Post by Cronos09 »

For successful conversion you also need to replace UNITCOUNT_0 with UNITCOUNT_1 and below UNITCOUNT_1 with UNITCOUNT_0.
You don't always need to rewrite AI. Eg. Odenathus' Poltava can be played immediately after changing the sides.
TheOldie
Private First Class - Wehrmacht Inf
Private First Class - Wehrmacht Inf
Posts: 6
Joined: Sat Dec 26, 2020 7:52 pm

Re: Playing a singleplayer scenario from the other side by making a new AI

Post by TheOldie »

I switched the unitcount numbers, and now I get two error messages when I try to load the scenario and the program crashes. One of them says something like “moving unit into occupied tile.” I can screenshot them for you. It looks like to get the scenario to load, each section containing a “_0_”, “_1_”, etc. had to have a header with the matching number (where the numbers look like “_0”). But then the opposing side will still not spawn.

What all did you do in Poltava’s BAM file to get it to work from the other side? Maybe I’m changing a number that shouldn’t be changed somewhere?
Cronos09
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 326
Joined: Thu Feb 22, 2018 4:28 pm

Re: Playing a singleplayer scenario from the other side by making a new AI

Post by Cronos09 »

TheOldie wrote: Sun Jan 10, 2021 4:31 pm I switched the unitcount numbers, and now I get two error messages when I try to load the scenario and the program crashes. One of them says something like “moving unit into occupied tile.” I can screenshot them for you. It looks like to get the scenario to load, each section containing a “_0_”, “_1_”, etc. had to have a header with the matching number (where the numbers look like “_0”). But then the opposing side will still not spawn.
It looks like you have a couple of .BAM files in the scenario folder. You have to leave only one with your changes. I have done all actions mentioned by you and me and voila
Image
I can play Minden for the Allied side. Of course, it would be better to script AI in a new way.
You can also to swap "IDS_MP_INTRO_Minden_Allied" and "IDS_MP_INTRO_Minden_French" in FUNCTION StartTurn(side) of MINDEN.BSF to see the appeal to Prince Ferdinand of Brunswick (C-in-C of the Allied side) at the beginning of the scenario.
Image
If it works you can rename the scenario folder eg MINDEN_ALLIED and in TEXT1.TXT scenario name eg IDS_CAMPAIGN_NAME,"Minden (Allies), 1st August 1759 A.D.", and IDS_SCENARIO_Minden,"Minden (Allies), 1st August 1759 A.D.", Then you will be able to download the original Minden again.
TheOldie
Private First Class - Wehrmacht Inf
Private First Class - Wehrmacht Inf
Posts: 6
Joined: Sat Dec 26, 2020 7:52 pm

Re: Playing a singleplayer scenario from the other side by making a new AI

Post by TheOldie »

Cronos09 wrote: Sun Jan 10, 2021 7:12 pm It looks like you have a couple of .BAM files in the scenario folder. You have to leave only one with your changes. I have done all actions mentioned by you and me and voila
Image
I can play Minden for the Allied side. Of course, it would be better to script AI in a new way.
You can also to swap "IDS_MP_INTRO_Minden_Allied" and "IDS_MP_INTRO_Minden_French" in FUNCTION StartTurn(side) of MINDEN.BSF to see the appeal to Prince Ferdinand of Brunswick (C-in-C of the Allied side) at the beginning of the scenario.
Image
If it works you can rename the scenario folder eg MINDEN_ALLIED and in TEXT1.TXT scenario name eg IDS_CAMPAIGN_NAME,"Minden (Allies), 1st August 1759 A.D.", and IDS_SCENARIO_Minden,"Minden (Allies), 1st August 1759 A.D.", Then you will be able to download the original Minden again.
I deleted both the original Minden folder and my modded folder, then redownloaded the Minden scenario. I edited the text in the BAM and BSF files exactly as you said. There is only one copy of the scenario in my Campaigns folder now. I went to play the scenario, and I am controlling the Allies, but the French army still does not spawn. Also, Sackville's cavalry are being controlled by the AI on the French turns, and appear with French flags above them. So on my system the AI is still controlling those units as it would in the original scenario, while the actual French units are not being generated at all.

Am I still missing something? Would you be able to upload your Minden file so I can download it and see exactly what you did?
Cronos09
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 326
Joined: Thu Feb 22, 2018 4:28 pm

Re: Playing a singleplayer scenario from the other side by making a new AI

Post by Cronos09 »

Sackville's reinforcement is scripted in MINDEN.BSF. So I have changed it for the Allied side now.
https://yadi.sk/d/xDI0KLjtKoWgBA MINDEN.BAM
https://yadi.sk/d/fYzUsM8Y6x595A MINDEN.BSF
TheOldie
Private First Class - Wehrmacht Inf
Private First Class - Wehrmacht Inf
Posts: 6
Joined: Sat Dec 26, 2020 7:52 pm

Re: Playing a singleplayer scenario from the other side by making a new AI

Post by TheOldie »

It works now! Thanks! Look like I was changing numbers where they shouldn't have been changed. I though that "Unitcount" would need to match the numbers below it, and so I changed it to a 2. Seems that the ScenarioDesign PDF isn't completely accurate.

Now I can play Minden as the allies. The French AI seems intent on attacking the northern part of my line in my current playthrough, and isn't moving its forces on its right flank. Maybe that's similar to what happened historically, but as you said it would be best for a new AI to be written. I'll have to start playing with the scenario editor and see what I can do.
Post Reply

Return to “Pike & Shot”