New MP Map: Two Roads *now contains RANDOM FORCES version*

Download scenarios and talk about scenario design.

Moderators: Slitherine Core, BA Moderators

Post Reply
djddalton
Senior Corporal - Ju 87G
Senior Corporal - Ju 87G
Posts: 81
Joined: Wed Sep 22, 2010 7:18 pm

New MP Map: Two Roads *now contains RANDOM FORCES version*

Post by djddalton »

Hi,

Here is a new multiplayer scenario created by bones65 and djddalton.

Download link: www.djddalton.talktalk.net/Dom_n_Ian_MP_Maps_Rand.zip

- Both Allies and Axis forces must mount offensive and defensive positions
- Although the Allied force is strong, they must face heavy artillery and aerial fire with no air defense
- Emphasis is on a fun and tactical game rather than historical/geographical accuracy
- The map has been tested for balance, but would welcome opinions whether or not improvements need to be made
- place the zipped folder under User/Documents/My Games/BBCBA/MULTIPLAYER and unzip contents to this location

Hope you enjoy, there is already a sequel/random version in the works ;)

Happy gaming,

bones65 and djddalton

edit: to add random forces to your list, simply replace the entire folder in your MULTIPLAYER folder with the new download
Last edited by djddalton on Wed Jun 15, 2011 12:15 pm, edited 9 times in total.
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

Thanks for your work .... but ... clicking the link, then following the folder links results in No items in this folder

:?
djddalton
Senior Corporal - Ju 87G
Senior Corporal - Ju 87G
Posts: 81
Joined: Wed Sep 22, 2010 7:18 pm

Post by djddalton »

Sorry! A few edits later and finally got the download (and instructions) working!
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

djddalton wrote:Sorry! A few edits later and finally got the download (and instructions) working!
Got it !

Thanks again for your work!

I hope to get my B.O.C. cleaned up enough for public use ... Right now, if anyone tried to read my scripts without taking a motion-sickness-pill ...
Well, need I say more!

Looking forward to more "scripted" heavy MP scenarios from you ... that is, if you don't end up in a mental hospital in the process! :wink:
djddalton
Senior Corporal - Ju 87G
Senior Corporal - Ju 87G
Posts: 81
Joined: Wed Sep 22, 2010 7:18 pm

Post by djddalton »

No prob, hope you enjoy!

There is absolutely no scripting in this map, however I would like to create maps with random forces, reinforcements, and special victory conditions, so I'm only fiddling around atm! Is there anything I can reference for the coding?

Edit: ok I reminded myself of the STUB engine documentation, just need to find a way to do randomised forces for both sides!
bones65
Sergeant - 7.5 cm FK 16 nA
Sergeant - 7.5 cm FK 16 nA
Posts: 246
Joined: Mon Mar 08, 2010 1:50 am
Location: devon u.k.
Contact:

Post by bones65 »

hey waddyaknow!.. the link works haha! 8)
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

djddalton wrote:No prob, hope you enjoy!

There is absolutely no scripting in this map, however I would like to create maps with random forces, reinforcements, and special victory conditions, so I'm only fiddling around atm! Is there anything I can reference for the coding?

Edit: ok I reminded myself of the STUB engine documentation, just need to find a way to do randomised forces for both sides!
Ok ... This should be rather painfull ... but, I'll just post the script you need ...
(I got the script from BETA_Slith_MP_Random, and cut out the parts you don't need)
... Copy/Paste the code below into a new text file ...
... Save this text file into your scenario folder as two_roads.bsf

Note how I chose 1000 pts for each side ...
Side 0 had 1579 pts ... Side 1 had 1326 pts ... so, basically I chose roughly 3/4 your total pts.
You may need to adjust accordingly ... add more units, lower the selection points ... whatever :wink:
I tested this and it works!
This is what I'm using in my B.O.C..

Code: Select all

include "Functions.BSF"

// called at the start of every turn.
// You would tend to use this for events
FUNCTION StartTurn(side)
{	
	if (GetTurn() == -1 )
	{
		RandomForce(0, 1000) ;
		RandomForce(1, 1000) ;
	}	
}

//*****************************************************************************
//*****************************************************************************
FUNCTION RandomForce(side, points)
{
int i ;
int id ;
int count ;
int placed ;
int index ;
int tries ;
int cost ;
int loaded ;

	ClearArray(-1) ;
	
	count = 0 ;		// not strictly needed as all vars default to 0, but clearer
	
	for(i=0;i<GetUnitCount(side);i++)
	{
		id = GetUnitID(side, i) ;
		if( IsUnitValid(id) == 1 )
		{
				// valid unit to look at
				SetArray(count, id) ;
				count++ ;
		}

	}
	
		// now have all the team members in the array that are not fixed
		
	// try 512 times at most
	placed = 0 ;
	tries = 1024 ;
	for(i=0;i<tries;i++)
	{
		if( placed == count )
		{
			// done
			i = tries ;
		}
		else
		{
			index = Rand(0, count-1) ;
			
			id = GetArray(index) ;
			
			if( id != -1 )
			{
				cost = GetUnitCost(id) ;
				loaded = GetLoadedUnit(id) ;
				if( loaded != -1)
				{
					cost += GetUnitCost(loaded) ;
				}
				
				if( cost <= points )
				{
					// we will keep this unit
					SetArray(index, -1) ;
					points -= cost ;
					placed++ ;
				}
			}
		}
	}
	
	// now remove any units still in the list
	for(i=0;i<count;i++)
	{
		id = GetArray(i) ;
		if(id != -1)
		{
			RemoveUnit(id, 1) ;
		}
	}

}
djddalton
Senior Corporal - Ju 87G
Senior Corporal - Ju 87G
Posts: 81
Joined: Wed Sep 22, 2010 7:18 pm

Post by djddalton »

Merr, you are a legend! That's a great help, much easier than what I was trying to do (TOTALLY random reinforcements, which I might try anyway)

Is it possible to split each side into teams (so for example, I randomise tanks, infantry separately) or will that take more work?

Also, who's property is functions.bsf? I suspected it belonged to Insidius, that or was created by Slitherine. Anyhow it's very useful ;)

Will post random version soon when I am happy with it
pipfromslitherine
Site Admin
Site Admin
Posts: 9867
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

Functions is a kind of dropbox for all our useful helper functions :).

You could fairly easily add logic to do teams seperately, that is in fact what the random plugin does. You would just need a points total per team and then cycle across each team, rather than the whole side.

Cheers

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

Post by Merr »

djddalton wrote: Is it possible to split each side into teams (so for example, I randomise tanks, infantry separately) or will that take more work?
That, I'm afraid, will take more work. Let us know if you want to take the plunge into more scripting.

Now, I looked at your recent version and we may need to make a slight change to the script, this depends on what your intention was when generating the random forces.
I noticed, in the editor, that some of your units are FIXED.
The script was built for MP and it's different from the solo script used in the PLUGIN.
What's different is that it includes FIXED units(when randomly selecting) in the MP script. Also, the MP script looks at loaded units and adds them to the point total.
If your intention was to have FIXED units always present, then we need to fix that.

So, lets do that now ... (saves an extra post by you if this was the case!)
Open the two_roads_random_forces.bsf , locate the FUNCTION RandomForce(side, points).
Scroll down to this code below ...

Change this ...

Code: Select all

      if( IsUnitValid(id) == 1 ) 
      { 
            // valid unit to look at 
            SetArray(count, id) ; 
            count++ ; 
      }
To read this ...

Code: Select all

      if( IsUnitValid(id) == 1 ) 
      { 
         if( IsUnitFixed(id) == 0 )
         {
            // valid unit to look at
             SetArray(count, id) ;
             count++ ;
         }          
      }
So now, your FIXED units will always be in the scenario, and non-fixed units will be randomly selected.

One more note ... I see that you physically added the FUNCTIONS.BSF to your scenario file. This isn't needed unless you made a change to that bsf. So, you can remove that bsf. Don't worry that the script says to include that bsf, because the functions.bsf is already there, in the core folder.

Hope that helps!
macnab
Senior Corporal - Ju 87G
Senior Corporal - Ju 87G
Posts: 84
Joined: Fri May 28, 2010 3:50 pm

Post by macnab »

Thanks for maps i have put in folder and they show up on My Challenge screen ,but as yet i havent played with them will let you know how they go,
djddalton
Senior Corporal - Ju 87G
Senior Corporal - Ju 87G
Posts: 81
Joined: Wed Sep 22, 2010 7:18 pm

Post by djddalton »

Much appreciated, I'm adding this to a document called 'coding lessons from Merr' lol ;)

I realised this was the case, I'm playing one now where I'm lacking my wespe...but in actuality it's quite cool, I'll think I'll stick to totally random for now.

Your trackhit is awesome btw, I'm surprised it hasn't been included in any updates yet!
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

djddalton wrote:Your trackhit is awesome btw, I'm surprised it hasn't been included in any updates yet!
I'm glad you liked TrackHit! .... It's just a concept really. It shows how a noob like me can script-in changes.
Maybe we'll see a professional Slitherine version someday.

This is my view on the whole thing :

Slitherine gave us a sandbox to play in ...
Slitherine maintains the sandbox (functionality, server, etc) ...
We, the players, create the fun stuff (like you did!) ...
If Slitherine can "fit" our toys and ideas into their sandbox without breaking anything .... Yipee!

Hey ... I've got an idea about FIXED units ...

Pretend the FIXED units are your core forces ... Infantry Company, Tank Company, whatever.
The NON-FIXED are your initial support forces.
Now, with this idea (and more scripting) .... You can expand the MP exerience another notch.

Also, there are several approaches to a TOTAL Random force. However, scripting is required to make it work correctly.
The script outline would be like this ...
1. Create several real world OOB's.
2. Randomly select that OOB.
3. Randomize the OOB strength, experience, etc.
4. Drop the OOB onto the map.

When you're ready to take the plunge into scripting, holler!
pipfromslitherine
Site Admin
Site Admin
Posts: 9867
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

It might be something that I can look at to allow 'global' mods - that is, if you wanted to play a campaign with trackhit or some other feature in it, to allow you to do so without having to copy the campaign and add in script files etc. The main issue is making it all play nicely if we alter our core scripts etc.

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 might be something that I can look at to allow 'global' mods - that is, if you wanted to play a campaign with trackhit or some other feature in it, to allow you to do so without having to copy the campaign and add in script files etc. The main issue is making it all play nicely if we alter our core scripts etc.

Cheers

Pip
Pip,

I was thinking the same thing .... Something like an "Include Mod" button ... However, the mod would have to be configured correctly to import into a players camp, and I can see errors popping up left and right with that one!

Pip .... while I have you .... Can you look into allowing SIDE(0), in the editor, to change the Team number? Currently, side(1) can only be changed since the editor was built for solo editting. Having this functionality would allow the side(0) to use the PLUGIN code for Teams. Basically, it's another RandomForce Plugin for side(0).

The only way I know to change teams is to edit the BAM .... ugly, but it works! (I think).

Thank you.
pipfromslitherine
Site Admin
Site Admin
Posts: 9867
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

I'll take a look. We altered it to make it friendlier for people, but I can see the possible uses for sure.

Cheers

Pip
blownapart
Private First Class - Wehrmacht Inf
Private First Class - Wehrmacht Inf
Posts: 5
Joined: Thu Nov 10, 2011 4:44 pm

Re: New MP Map: Two Roads *now contains RANDOM FORCES versio

Post by blownapart »

how do you edit a .BSF file
pipfromslitherine
Site Admin
Site Admin
Posts: 9867
Joined: Wed Mar 23, 2005 10:35 pm

Re: New MP Map: Two Roads *now contains RANDOM FORCES versio

Post by pipfromslitherine »

blownapart wrote:how do you edit a .BSF file
The wiki has details on installing and setting up Notepad++

http://www.slitherinebravo.net/GameWiki ... gine#tools

that is the simplest way to edit BSF files.

Cheers

Pip
leci
Master Sergeant - Bf 109E
Master Sergeant - Bf 109E
Posts: 456
Joined: Tue Apr 03, 2012 12:00 pm

Re: New MP Map: Two Roads *now contains RANDOM FORCES versio

Post by leci »

Hi - I have placed this Mod/Scenario on the Playable Mods & Scenario directory Sticky at viewtopic.php?f=87&t=43167

Gilles
My directory of Battle Academy Playable Mods & Scenarios at viewtopic.php?f=87&t=43167

Gilles
Post Reply

Return to “Battle Academy : Scenario Design”