Designing your own Campaign maps

Moderators: rbodleyscott, Slitherine Core, Gothic Labs

Post Reply
Patrick Ward
Slitherine
Slitherine
Posts: 1145
Joined: Thu Sep 04, 2014 2:49 pm
Location: A small island in the Outer Hebrides.

Designing your own Campaign maps

Post by Patrick Ward »

Hi all,

I'll try to give a quick run down on how to prepare the campaign maps. I've been told that the following might frighten some people off. Don't let it. Its really not difficult or complicated. It's just that Photoshop can make it a pain in the backside. Maybe its easier with Gimp or some other tool because it's Photoshops colour profiling that makes things awkward. I had long discussions with Adobe people about it but, while they were very helpful, their response was .. that's the way it's meant to work.

So if you've done any texturing work you'll understand the principal of using texture channels for things other than colour. ie. RGB can be used for things other than Red, Green and Blue. They can represent the glossiness, height, opacity, normals etc.. Well the campaign maps work the same way. There are three bitmaps that make up each map. The first two are basic colour maps that you see on screen, each coloured to represent one side of the conflict. I won't discuss these here as you can approach that however you like.

It's the third, the CampaignDisplayMap, which uses its channels to define the different areas on the map, that needs some explanation. Again most of the process of creating it is down to you and your choice of software.

The RGBA channels are used for

R - The areas simply coloured in black. No anti-aliasing. White gap separating them.
G - Contains the selection outlines. So when you mouse over an area and you see the pink outlined edging, That's defined here. You can create this while you're making your main map images.
B - Not used.
A - The greyscale values here (0-255) are used to give each area a number. This allows the game to know one area from another so you'd fill one area with 0 the next with 1 then 2 and so on in some kind of order. These numbers are referenced in the .dat file but I'll leave that to Richard to explain. No anti aliasing.

(Sadly, as this is a new account, I can't post pictures)

If you're signed up for Photoshop then I need to outline the dificulties with the Alpha since this is the most crucial element you won't figure from just looking at the files.

Problem : When assigning greyscale values, Photoshop doesn't support 0-255 .. you can only input percentages .. 0-100.
Solution : Use the RGB values instead. eg. 1,1,1 130,130,130 5,5,5. Create the image in a regular RGB document and then copy/paste it into the A channel of the final map.

Problem : Copying RGB values into a greyscale channel forces Photoshop to use a colour conversion profile. Unless you're using linear then these conversion profiles do not match 1:1 on a straight line. ie 128,128,128 RGB does NOT map to 50% grey. It will depend on the colour profile you're using. The result is that Photoshop adds dithering to your solid colour. Noise.
Solution (Partial) : In your Colour Profile, if RGB is set to sRGB .. ensure your Gray profile is set to sGray. RGB and Gray have to use the same profile. By default they don't.

Problem : This works for the lower end, the blacks. Its probably ok for the first 30 values which should be enough but you'll still get noise in the higher values - the white space.
Solution : Paint out the noise. This is more awkward than it sounds since it'll be near impossible to see a 254 pixel surrounded by 255 pixels and automated noise reduction tools make it worse.

So the trick is to use a levels layer adjustment to compress the colour range to something you can see. Then paint 255 over the noise. This can also be used to paint any of the black areas that have noise but you'll have to set the sampling/inkdropper tool to sample the correct value from the underlying layer. Tell it to ignore the affect of adjustment layers from its drop down. The chances are you'll miss some but as soon as you get it into the game it'll stand out like a sore thumb . . black or pink noise looking really bad.

I'm sure that's clear as mud but most of it will be obvious when you open up the relevant files. If anyone comes up with a more practical solution to the noise issue I'd love to hear.

(I've copied this post to my own site since I'm not quite so new and can post pictures .. www(dot)colourandnoise(dot)com/blog )

Pat

EDIT: Just wanted to add that there's another file .. Icon.dds ..that is used when selecting a campaign .. you'll need Nvidias texture tools for Photoshop to be able to save out and load the .dds. Naturally it's old, buggy and no longer supported but is all we've got since Adobe don't support the format.
Last edited by Patrick Ward on Tue Aug 25, 2015 2:37 pm, edited 3 times in total.
............................

Pat a Pixel Pusher

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

Re: Designing your own Campaign maps

Post by rbodleyscott »

See also:

https://sites.google.com/site/battleaca ... umentation

The relevant section being:

REGIONMAP

However, you don't really need to understand all that. (I still find it hard to get my head round it, however often I read it).

If you clone one of the existing campaigns, such as the Gustavus Adolphus campaign, you just need to change certain things to fit your own map.

1) In /My Games/My Documents/PSCAMP/Campaigns/YourCampaignName/Data/UI/Textures

You need to put your version of CampaignDisplayMap.tga here. This is Pat's "third" file.

The other file that goes here is CampaignDisplayMap.dat

This contains references to Pat's 1st and 2nd maps.

e.g.

DRAWN0 Map_Generic_00.tga
DRAWN1 Map_Generic_01.tga
DRAWN254 Map_Generic_01.tga

You would put your versions of those textures in the same directory. (In the vanilla game they are elsewhere).

It also contains an entry for each region (province) in the form:

[0]
x 87
y 298

This defines the centre point of the province in pixels in the map .tga, so that the army flags can be correctly placed.

x is the horixontal position, y is the vertical position, numbering starting from the top left corner.

2) In /My Games/My Documents/PSCAMP/Campaigns/YourCampaignName/Data/Battle/Scripts

in the file call CustomCampaignTools.BSF

you need to edit the IsRegionAdjacent() function, so that it lists all legal region to region moves.

That's about it for making the maps.

You will also probably want to customise some of the other scripts in the CustomCampaignTools.BSF file to fit your campaign. If you compare the CustomCampaignTools.BSF files for the four vanilla campaigns, you will see how they differ to suit the needs of the campaign.
Richard Bodley Scott

Image
GBISSET
Corporal - Strongpoint
Corporal - Strongpoint
Posts: 72
Joined: Sat Mar 19, 2011 4:51 pm

Re: Designing your own Campaign maps

Post by GBISSET »

Im having a little trouble finding this data, which I take it is where the data for province values is stored?

X <x>
Y <y>
DATA <a> [<b> <c> <d>]

Where X and Y are the region map image pixel coordinates of the center point of the area (retrieved in script as 1024x768 coordinates using the RegionMapGetX/Y functions). DATA can be used for preset data on each area to be used in the script. There can be up to 4 data elements in the list.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28007
Joined: Sun Dec 04, 2005 6:25 pm

Re: Designing your own Campaign maps

Post by rbodleyscott »

GBISSET wrote:Im having a little trouble finding this data, which I take it is where the data for province values is stored?

X <x>
Y <y>
DATA <a> [<b> <c> <d>]

Where X and Y are the region map image pixel coordinates of the center point of the area (retrieved in script as 1024x768 coordinates using the RegionMapGetX/Y functions). DATA can be used for preset data on each area to be used in the script. There can be up to 4 data elements in the list.
It is in /Campaigns/CampaignName/Data/UI/Textures

e.g. /Campaigns/8OttomanCampaign/Data/UI/Textures
Richard Bodley Scott

Image
GBISSET
Corporal - Strongpoint
Corporal - Strongpoint
Posts: 72
Joined: Sat Mar 19, 2011 4:51 pm

Re: Designing your own Campaign maps

Post by GBISSET »

OK, I found the tools.bsf and am studying the data there. Im working on the Ottoman Camapign. I thought I might just ask one question at a time. If I come to understand the whole thing maybe I could summarize them later in one post.

Starting at the top, what does this do?

// Set strength multiplier
SetCampaignVar("CampaignStrengthMultiplier", 400);

Thanks,

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

Re: Designing your own Campaign maps

Post by rbodleyscott »

GBISSET wrote:Starting at the top, what does this do?

// Set strength multiplier
SetCampaignVar("CampaignStrengthMultiplier", 400);
That sets the scaling so that the units in the campaign are 4 times larger than usual.

If you want to use the default unit strengths you use

SetCampaignVar("CampaignStrengthMultiplier", 100);
Richard Bodley Scott

Image
GBISSET
Corporal - Strongpoint
Corporal - Strongpoint
Posts: 72
Joined: Sat Mar 19, 2011 4:51 pm

Re: Designing your own Campaign maps

Post by GBISSET »

Great, and further down there is this (I see the long list of provinces later seems to list which connect, but this is a quick way to put some provinces out of bounds to change the historic situation):

}

// Can be used to put some provinces out of bounds
FUNCTION IsProvinceOutOfBounds(province)
{
return 0;
}


Could you write an example of 2 or 3 provinces being out of bounds? None are out of bounds here.

Much thanks!

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

Re: Designing your own Campaign maps

Post by rbodleyscott »

[replaced by next post]
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28007
Joined: Sun Dec 04, 2005 6:25 pm

Re: Designing your own Campaign maps

Post by rbodleyscott »

GBISSET wrote:Great, and further down there is this (I see the long list of provinces later seems to list which connect, but this is a quick way to put some provinces out of bounds to change the historic situation):

}

// Can be used to put some provinces out of bounds
FUNCTION IsProvinceOutOfBounds(province)
{
return 0;
}


Could you write an example of 2 or 3 provinces being out of bounds? None are out of bounds here.
To make province number 3 and province number 5 out of bounds:

Code: Select all

FUNCTION IsProvinceOutOfBounds(province)
{
        if ((province == 3) || (province == 5))
           {
               return 1;
           }
        else
           {
               return 0;
           }
}
Richard Bodley Scott

Image
GBISSET
Corporal - Strongpoint
Corporal - Strongpoint
Posts: 72
Joined: Sat Mar 19, 2011 4:51 pm

Re: Designing your own Campaign maps

Post by GBISSET »

Thanks! The rest of that file seems intuitive to me, so just one question about Campaign.BSF (this file is very intuitive, too)

I see how to set the turns for each year (currently 6) If you change that, say to half months, do you need to provide names for the new turns (say, "early May"), and if so where is the file to do that?

Thanks!

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

Re: Designing your own Campaign maps

Post by rbodleyscott »

GBISSET wrote:I see how to set the turns for each year (currently 6) If you change that, say to half months, do you need to provide names for the new turns (say, "early May"), and if so where is the file to do that?
Text3.txt in \Data\Text

Don't edit this here, but (assuming you are using P&S; Campaigns, and your campaign is called "MonmouthRebellion") put a copy in

\My Documents\My Games\PSCAMP\Campaigns\MonmouthRebellion

i.e. In the main folder of your custom campaign, not in a \Data\Text subfolder. (See the tree for custom campaigns at the end of http://www.slitherinebravo.net/GameWiki ... tub_engine)

If you used a clone of one of the existing campaigns as the starting point for your campaign, you will need to rename the file so it does not clash with any of the text files that are already in the campaign. (It will probably already have a text1.txt, text3.txt, text4,txt and text5.txt, so you could rename it text2.txt for example).

Edit the strings in the version of text3.txt that is in your custom campaign - it will automatically replace the strings in the main build.

IDS_CAMP_TURN0, "Early Spring",
IDS_CAMP_TURN1, "Late Spring",
IDS_CAMP_TURN2, "Early Summer",
IDS_CAMP_TURN3, "Late Summer",
IDS_CAMP_TURN4, "Early Autumn",
IDS_CAMP_TURN5, "Late Autumn",

rename these and add the rest you need.

Note that the textn.txt files in the game are not standard .txt files, they are Unicode files. Normal .txt files won't work. The easy way to create a new (Unicode) .txt file is to copy an existing one and (if necessary) strip out any strings you don't need. (As to what the hard way is, I don't know, you might need special software).

Also, don't edit the string files in a word processor such as Word, because it will automatically replace some characters (e.g. quotes) with non-Unicode characters that won't display in game. Use Notepad++ or another text editor.

If you want linefeeds in any string, use the "~" (tilde) character.
Richard Bodley Scott

Image
GBISSET
Corporal - Strongpoint
Corporal - Strongpoint
Posts: 72
Joined: Sat Mar 19, 2011 4:51 pm

Re: Designing your own Campaign maps

Post by GBISSET »

Thanks so much, I believe I understand now. There are no other files a person might want to customize to mod a campaign on an existing map?

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

Re: Designing your own Campaign maps

Post by rbodleyscott »

GBISSET wrote:Thanks so much, I believe I understand now. There are no other files a person might want to customize to mod a campaign on an existing map?
Well you might want to customize anything at all, but we have tried to put the scripts you are likely to want to customize for Campaigns in CustomCampaignTools.BSF.
Richard Bodley Scott

Image
Post Reply

Return to “Scenario Design”