Multi Player Scenarios

Moderators: rbodleyscott, Slitherine Core, Gothic Labs

Post Reply
Paul59
General - King Tiger
General - King Tiger
Posts: 3859
Joined: Tue Jul 21, 2015 11:26 pm

Multi Player Scenarios

Post by Paul59 »

Hi Richard,

On occasion, I would like to offer Multiplayer versions of my scenarios. Unfortunately I have not been able to find anywhere that explains how to make a Multiplayer scenario. I guess it must be a pretty straightforward process and obviously the scenario should be balanced to give both sides an equal chance of winning, but please can you explain how I would convert a single player scenario to Multiplayer?


Paul
Field of Glory II Scenario Designer - Age of Belisarius, Rise of Persia, Wolves at the Gate and Swifter than Eagles.

Field of Glory II Medieval Scenario Designer.

FOGII TT Mod Creator

Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28294
Joined: Sun Dec 04, 2005 6:25 pm

Re: Multi Player Scenarios

Post by rbodleyscott »

Paul59 wrote:Hi Richard,

On occasion, I would like to offer Multiplayer versions of my scenarios. Unfortunately I have not been able to find anywhere that explains how to make a Multiplayer scenario. I guess it must be a pretty straightforward process and obviously the scenario should be balanced to give both sides an equal chance of winning, but please can you explain how I would convert a single player scenario to Multiplayer?


Paul
Well you don't really need to do anything much except make a copy of the campaign folder, prefix the folder name with "MP_" (purely to avoid confusion) and put it in /PSCAMP/Multiplayer instead of /PSCAMP/Campaigns.

Obviously, if there is AI scripting that can be stripped out of the scenario script.

In

Code: Select all

FUNCTION VictoryConditions()
{
	StandardVictoryConditions(60, 40, 60, 40, 2, 0); // The last parameter should be 1 instead of 0 for Multiplayer scenarios.
	
	return 1; // VictoryConditions() must return a non-zero value so that the main program knows it exists and therefore not to use the default version.
}
you should replace the last parameter with 1.
Richard Bodley Scott

Image
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28294
Joined: Sun Dec 04, 2005 6:25 pm

Re: Multi Player Scenarios

Post by rbodleyscott »

FUNCTION StartTurnPost(side)
{
// Scenario-specific AI code goes here - you can look at some of the historical scenarios for examples.
if (side == 1)
{
// AI_Masterplan() can be used to provide automated AI for encounter battles where Side 0 is on the left side of the map and Side 1 is on the right side of the map.
// Be warned that it may not cope well with unusual AI deployments.
// If used, PreBattleSetup() must include AI_ReassignTeams(1);
// The parameter is the turn on which the AI side will start to advance its infantry if it has not done so already. (Turn 0 is side 0's first turn, Turn 1 is Side 1's first turn, and so on).
// If the value is set at -1 the infantry will only ever advance if the tactical situation merits it.

// AI_Masterplan(15);

// If you want to use AI_Masterplan() in a scenario where the AI foot is defending fortifications you need to use the following code here
// SetUniversalVar("SkirmishGame",1);
// SetUniversalVar("ScenarioType",0);
// AI_Masterplan(-1);
// SetUniversalVar("SkirmishGame",0);
// You would also need to set the position of the fortification line in PreBattleSetup(), using
// SetUniversalVar("FootMinX", 24); // X-coordinate of bottom end of fortifications line
// SetUniversalVar("FootMaxX", 28); // X-coordinate of upper end of fortifications line
// SetUniversalVar("FrontLine", 26); // Y-coordinate of fortifications line


// Otherwise insert any custom AI code here
}

// Set up MP scenario to use adjusted MP victory conditions:
// SetMPForceRatio();
}
If you remove the comment marks from the line show in red, the game will automatically adjust the victory conditions to take into account force disparity between the two sides.

You can tweak the way this works if you like, to deal with imponderables, by putting

SetUniversalVar("Side0CustomPointsAdjustment", value0);
SetUniversalVar("Side1CustomPointsAdjustment", value1);

in PreBattleSetup() where value0 and value1 are integer points values added to the actual points values of the armies before calculating the MPForceRatio(). For example, if one side has field defences, you can add a certain number of points to the total notional points value of their army (for ForceRatio calculation purposes) to compensate.

Email me if you cannot follow my ramblings here.
Richard Bodley Scott

Image
Paul59
General - King Tiger
General - King Tiger
Posts: 3859
Joined: Tue Jul 21, 2015 11:26 pm

Re: Multi Player Scenarios

Post by Paul59 »

Thanks Richard,

That is simpler than I thought! I will provide MP versions starting with my next two scenarios, which will be complete my battles for the Nine Years War, Staffarda and Marsaglia.


Paul
Field of Glory II Scenario Designer - Age of Belisarius, Rise of Persia, Wolves at the Gate and Swifter than Eagles.

Field of Glory II Medieval Scenario Designer.

FOGII TT Mod Creator

Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
Paul59
General - King Tiger
General - King Tiger
Posts: 3859
Joined: Tue Jul 21, 2015 11:26 pm

Re: Multi Player Scenarios

Post by Paul59 »

rbodleyscott wrote:
If you remove the comment marks from the line show in red, the game will automatically adjust the victory conditions to take into account force disparity between the two sides.

You can tweak the way this works if you like, to deal with imponderables, by putting

SetUniversalVar("Side0CustomPointsAdjustment", value0);
SetUniversalVar("Side1CustomPointsAdjustment", value1);

in PreBattleSetup() where value0 and value1 are integer points values added to the actual points values of the armies before calculating the MPForceRatio(). For example, if one side has field defences, you can add a certain number of points to the total notional points value of their army (for ForceRatio calculation purposes) to compensate.

Email me if you cannot follow my ramblings here.
Hi Richard,

If Side0 has 800 points of reinforcements would you have "SetUniversalVar("Side0CustomPointsAdjustment", value800);"? Or is the value of reinforcements already calculated by the program?

Cheers

Paul
Field of Glory II Scenario Designer - Age of Belisarius, Rise of Persia, Wolves at the Gate and Swifter than Eagles.

Field of Glory II Medieval Scenario Designer.

FOGII TT Mod Creator

Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28294
Joined: Sun Dec 04, 2005 6:25 pm

Re: Multi Player Scenarios

Post by rbodleyscott »

The multiplayer force ratio is recalculated each turn, so if the reinforcements are added by scripts, the victory conditions will automatically be adjusted when they arrive. If they are added by the non-script editor method, I am not sure what will happen, it depends on whether the engine treats them as already existing or not. If so, they will be taken into account all the time, if not they will be taken into account when they arrive. You may need to try it out to see exactly what happens.
Richard Bodley Scott

Image
Post Reply

Return to “Scenario Design”