Multiplayer Deployment (now includes large QB scenario)

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Multiplayer Deployment (now includes large QB scenario)

Post by Merr »

I created an MP scenario that demonstrates the Merr Deployment ...

Version 1.1

Fixed ... Units can unload to hidden tiles after player's first turn.

- Large QuickBattle Scenario.
- US vs Germans (meeting engagement).

Can redeploy forces on first turn.

Includes "pop-up" text on first turn explaining "how-to".

:arrow: http://www.gamefront.com/files/20973179 ... y_v1.1.zip

Unzip MP version to ... \Documents\My Games\BBCBA\MULTIPLAYER

---------------------------

I recommend playing in HOTSEAT mode first.

Comments/Suggestions welcome.

- Rob

.....................................................
Pip,

I created a workaround to allow Multiplayer Deployment that uses their first turn as their deployment phase.

I'll start by explaining the scenario BSF with StartTurn() and StartTurnPost() ...

Code: Select all

include "functions.BSF"

FUNCTION StartTurn(side)
{
	// create deploy area ... 5 tiles from player edge.
	if ( GetTurn() == 0 )
	{		
		SetAreaLOS(16, 16, 47, 20, 0, 1) ;
	}
	if ( GetTurn() == 1 )
	{		
		SetAreaLOS(16, 43, 47, 47, 1, 1) ;
	}	
}

FUNCTION StartTurnPost(side)
{
int i ;
int j ;
int id ;

	if ( GetTurn() <= 1 )
	{
		for(i=0;i<2;i++)
		{
			for(j=0;j<GetUnitCount(i);j++)
			{
				id = GetUnitID(i,j) ;
				SetAttrib(id, "AP", 0) ;
				SetAttrib(id, "LOS", 0) ;
				SetAttrib(id, "CoverLOS", 0) ;
			}
		}
	}
	if ( GetTurn() == 2 )
	{				
		for(j=0;j<GetUnitCount(1);j++)
		{
			id = GetUnitID(1,j) ;
			SetAttrib(id, "AP", GetBaseAttrib(id, "AP")) ;
			SetAttrib(id, "LOS", GetBaseAttrib(id, "LOS")) ;
			SetAttrib(id, "CoverLOS", GetBaseAttrib(id, "CoverLOS")) ;			
		}
	}				
}
In the StartTurn(), you can see the area being setup.
In the StartTurnPost(), the units LOS,CoverLOS, and AP are all set to 0. By default, the unit's tile is also considered a deployment location because it naturally has an LOS to itself. Setting all the values to 0 prevents the units from being moved, and when the unit get's redeployed to another tile, it prevents the player from "walking" the LOS update logic. Also, you'll note that in turn #2, player(1) needs to have it's values reset to normal, and now everything is ready to go for the Allied player(0) to take the turn. Basically, the scenario doesn't really start until it's the Allied players second turn. The next step would be disabling any bonus' for the players first turn, but it's not mandatory.

Here's the new deployment Action ...

Code: Select all

FUNCTION ALL_DEPLOY(me, tilex, tiley)
{
	if ( Check_ALL_DEPLOY(me, tilex, tiley) == 0 )
	{
		UnitDeploy(me, tilex, tiley) ;
	}
}

FUNCTION CHECK_ALL_DEPLOY(me, tilex, tiley)
{
int ret ;

	ret = -2 ;
	
	if ( GetTurn() == GetCurrentSide() )
	{
		if( (GetTileLOS(tilex, tiley, GetCurrentSide()) == 1) && (GetTileCost(me, tilex, tiley) < GetBaseAttrib(me, "AP")) )
		{
			ret = -1 ;
		
			if (GetUnitOnTile(tilex, tiley) == -1)
			{
				ret = 0 ;
			}
		}
	}
	
	return ret ;
}

FUNCTION UISETUP_ALL_DEPLOY(me, tilex, tiley)
{
	StartString() ;
	
	if ( CHECK_ALL_DEPLOY(me, tilex, tiley) == 0 )
	{
		PrintString("IDS_TT_DEPLOYUNIT") ;
	}
	if ( CHECK_ALL_DEPLOY(me, tilex, tiley) == -1 )
	{
		PrintString("IDS_TT_NODEPLOYUNIT") ;
	}	
	
	SetUITooltip() ;
	
	SetUITexture("action_select", "ffffffff") ;
}

FUNCTION UIBUTTON_ALL_DEPLOY(me, x,y,width, height, tilex, tiley)
{
	
}
And finally, to allow the player to unload/load units without any restrictions, I added an "or" condition to the LOAD.BSF, under the Check_Unit_Load ...

Code: Select all

if( ( IsDeploying() == 1 ) || ( GetTurn() == GetCurrentSide() ) )
It's pretty cool and I can make a demo template if anyone wants to try out the functionality.

Merr
Last edited by Merr on Thu Dec 08, 2011 4:16 am, edited 2 times in total.
random27
Lieutenant Colonel - Panther D
Lieutenant Colonel - Panther D
Posts: 1257
Joined: Tue Dec 21, 2010 4:30 pm

Post by random27 »

What a great idea.
If one day you could create a mod where we can choose troops before battle (depending on points) it will be for me the perfect game.
Thank you for all your mods ; we ve fought against and you were a pleasant opponent.You re a very pleasant modder.
pipfromslitherine
Site Admin
Site Admin
Posts: 9937
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

I'm not sure what you mean? You want to allow the player to deploy, but not to then move in MP? Does the skipfirstturn command not work in MP? Or have I gotten the wrong end of the stick :).

Cheers

Pip
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

pipfromslitherine wrote:I'm not sure what you mean? You want to allow the player to deploy, but not to then move in MP? Does the skipfirstturn command not work in MP? Or have I gotten the wrong end of the stick :).
Yeah ... you're on the wrong end of the stick.
Ok ... step-by-step ...

:arrow: Turn 0 ... Allied turn. The Allied player can deploy his units (via deploy action).
When the Allied player has "setup" his forces, he ends the turn... period.
The Allied player can't move (yes) because the Axis player needs to deploy his forces!
:arrow: Turn 1 ... Axis turn.
Same procedure as Allied player.
Again, the Axis player can't move, and ends his turn when he's done.
:arrow: Turn 2 ... Allied turn.
Now, everything is set back to normal, the Allied player can resume operations.

I don't see a reason to use the SkipFirstTurn because I don't want to skip the turn ... I'm using the players first turn as a seudo "deployment" turn.

Now, it would be better if you had an "MP Deployment" button select in the editor, which, would do the exact same thing ... That is, use the first players turn to setup forces.

Also, I could make a PLUGIN of the above script and there can be an ON/OFF button that runs the logic. To allow the freedom of "load/unloading" I would have to add a universal variable and when the "MP Deploy" is ON, it sets the variable to 1, meeting the condition to load/unload freely ... eg..

Code: Select all

if( ( IsDeploying() == 1 ) || (GetUnviversalVar("MPdeploy") == 1 ) )
Make sense or do you need more coffee :wink:
I'm loaded with caffeine now, so everything makes sense even when it doesn't! :lol:

Merr
pipfromslitherine
Site Admin
Site Admin
Posts: 9937
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

Ah - I see. You add specific orders and logic to get around the fact that usually in MP, if you set the map to deploy, only the first player can deploy their forces.

Got it!

It's probably not worth making it a plugin, as it is the intent to allow this via internal logic (along with force purchase) at some point in the near future. But it is very clever :). A both sides deploy MP mission is very cool!

Cheers

Pip
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

pipfromslitherine wrote: It's probably not worth making it a plugin, as it is the intent to allow this via internal logic (along with force purchase) at some point in the near future. But it is very clever :). A both sides deploy MP mission is very cool!
Ok ... cool. I think the near future needs to be pushed forward to like ... this year Pip? :wink:

My idea only simulates what it "might" look like and hopefully it tackles any problems on your end when you get to that part of the code.

The cool part about BA is that (for the most part), it can be done ... Unfortunately it's a little ugly in the mod department.

I'm looking forward to a professional solution!

Rob
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

random27 wrote:What a great idea.
If one day you could create a mod where we can choose troops before battle (depending on points) it will be for me the perfect game.
Thank you for all your mods ; we ve fought against and you were a pleasant opponent.You re a very pleasant modder.
Thanks ...

Purchasing units for both sides is possible but it's ugly, cheap, and clumsy.

Deployment and purchasing units for MP is better left for the professionals ... You know, with appropriate windows, etc.

There is still a lot of uncharted territory to explore with mods and I fear that by the time I discover them, there's a better way to do or it's been done (professionally).
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

Demo scenario updated to version 1.1 ... (see next post) ...

After the player's first turn, you couldn't unload units to "hidden" tiles (darker tiles). :oops:

Fixed!
Last edited by Merr on Tue Nov 08, 2011 2:49 pm, edited 2 times in total.
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

I created an MP scenario that demonstrates the Merr Deployment ...

Version 1.1

Fixed ... Units can unload to hidden tiles after player's first turn.

- Large QuickBattle Scenario.
- US vs Germans (meeting engagement).

Can redeploy forces on first turn.

Includes "pop-up" text on first turn explaining "how-to".

:arrow: http://www.gamefront.com/files/20973179 ... y_v1.1.zip

Unzip MP version to ... \Documents\My Games\BBCBA\MULTIPLAYER

---------------------------

I recommend playing in HOTSEAT mode first.

Comments/Suggestions welcome.

- Rob
pomakli
Captain - Bf 110D
Captain - Bf 110D
Posts: 895
Joined: Thu Dec 03, 2009 12:40 pm
Location: Munich/Germany

Post by pomakli »

What should I do if there is

"missing IDS campaign name" error message after downloaded the and zipped the data

on the MP screen?

Thanks in advance
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

pomakli wrote:What should I do if there is

"missing IDS campaign name" error message after downloaded the and zipped the data

on the MP screen?

Thanks in advance
You running v1.1 or the previous version?

Also, don't unzip v1.1 over the previous version ... it's a stand alone version.

You shouldn't get any message like that unless you got mixed files (or the text1 file is missing)...

Start over ... (fresh)
:arrow: exit out of BA (if you are running BA)
:arrow: delete the old version folder.
:arrow: delete the v1.1 folder (if you unzipped correctly before).
:arrow: unzip v1.1 ... to ... \Documents\My Games\BBCBA\MULTIPLAYER
:arrow: restart BA.

This work?
pomakli
Captain - Bf 110D
Captain - Bf 110D
Posts: 895
Joined: Thu Dec 03, 2009 12:40 pm
Location: Munich/Germany

Post by pomakli »

YES! İt works.

Thank you very much for ALL your EFFORT MERR!
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

pomakli wrote:YES! İt works.

Thank you very much for ALL your EFFORT MERR!
Great! .... Enjoy!

Right now, the player "random27" has a challenge online ... He's waiting !

After I get all my other theaters done (blitzkreig, north africa, etc), I can use the deployment logic for random ATTACK/DEFENSE scenarios... which would allow the defender to setup no matter what side he's playing!
Lynz
Senior Corporal - Ju 87G
Senior Corporal - Ju 87G
Posts: 88
Joined: Mon Jan 11, 2010 2:09 am

Post by Lynz »

Hi Merr, where can I find Merr_QB_MP_US_V1.12 please? The search function for the forum finds nothing.

Thank you for all your great work. And the other developers.

As an aside, it would be great to have a sticky with links to all of the available extra scenarios.
junk2drive
BA Moderator
BA Moderator
Posts: 1478
Joined: Sun May 23, 2010 4:47 pm
Location: Arizona USA -7GMT

Post by junk2drive »

In the scenarios forum

viewtopic.php?t=28686
You can call me junk - and type that with one hand.
Lynz
Senior Corporal - Ju 87G
Senior Corporal - Ju 87G
Posts: 88
Joined: Mon Jan 11, 2010 2:09 am

Post by Lynz »

Thank you very much Sir.
Post Reply

Return to “Battle Academy : Modders Corner ”