map creating tutorial

Talk about everything related to CoCoNet or Colonial Conquest!

Moderator: Kroah

map creating tutorial

Postby Christine » 17 Aug 2012, 12:47

This is just a little tutorial with all you need to build a custom map from the standard scenario like I did it in the nieuw standaard scenario. After doing this tutorial, some options in the mapeditor will be more selfexplaining than before.

First: you want to create a new land, lets call it "the netherlands".

1. unpack the "std scenario" in a subfolder of the custom maps directory.
2. edit the mapfile:
the std country bordercolor is not #010101. So create your country border with 010101, not 000000. If you want to change that, look at the "BorderColor"-tag in the map.xml-file.
After creating the countryborder in the map.png file, just fill the new country with a colour. Lets take us "yellow" at this time.

now draw a nice looking pattern-graphic in one single colour in your new country. For example, we're using pink for that.

3. creating an area by hand
in the map.xml file, youll find some areas like this:
Code: Select all
   
<Area Id="110" CellX="78" CellY="17">
      <Name>Midway</Name>
      <Terrain>0</Terrain>
      <RegionId>6</RegionId>
      <IsInner>False</IsInner>
      <AdjacentAreasId />
      <AdjacentZonesId>67</AdjacentZonesId>
    </Area>

area means the country.
just scroll down the file and figure out whats the last id is. Just copy the code of the area and change the id to last-id+1.

cellx and celly:
this doesnt mean "pixels". The game uses cells. An cell has just the size an normal flag-grafic has. Let us use cellx="0" and celly="0" for this moment.

terrain: is the terrain type. Use a number within 0 and 3.

region id: use a id from an other land that is near by the netherlands. Berlin for example. A region defines an number of countrys. If a region is totally conquered by one major, the major gets a yearly $-bonus for that.

IsInner: defines if the country is connected to a seazone - or in other words: Inner countrys cant reached by navys.
So our nehterlands should be connected to a sea sone, so use "IsInner" = FALSE.

AdjacentAreasId:
The areas which are connected to the netherlands. It should be: berlin, belgium. Maybe the ruhr.
So search for the names "belgium" and "berlin" in the xml file. Write down the ids from the countrys and fill them - comma seperated - in the new countrys AdjacentAreasId-tag.
And DONT FORGET to edit AdjacentAreaIds from Berlin, Belgium and maybe the ruhr-province. If you dont alter the other countrys, the game will crash after loading the mapfile.
(the map editor does all of that for you in an really nice way!)

AdjacentZonesId:
it means the connected sea zones. If your netherlands are only connected to one sea zone, look for an other country which is connected to the sea zone and just copy the id to the new netherlands.
The zones are only used to display coloured boats if the contry is conquered by an major power.
(the map editor can do this as well)

4. do the fill
the fill tag can be found at the end of the map.xml file.
It looks like this:
Code: Select all
<Fill ResetColor="Purple" Id="0" AreaId="0" OffsetX="8" OffsetY="0" />

The ResetColor is the colour the countrys filled with before the majors colour is filled into. For creating the netherlands were used the colours of pink and yellow.
If you draw the pattern graphic correctly, you can set the ResetColour option to "pink". If one colour isnt continuos, you have to write some more fill tags for the new country.

id: is just the fill-id. It has nothing to do woth the countrys id. Just take an new (latest-number+1) id for the new fill you want to create.

areaid: is the id of the area created in step 3.

OffsetX & OffsetY:
It defines the point (one pixel) from the flag used for the fill.
n is given in pixels.
you can use positive and negative numbers for that (0, 14, -15, ...)
just take 0 and 0 for this moment.



5. open the map editor
the editor crashes if you have created more than 1 land in exactly this way. If you have created 2 or 3 countrys and the editor crashes, you've probably used the same CellX and CellY options in the area-tag:
Code: Select all
<Area Id="110" CellX="0" CellY="1">

just make sure youre using not the same cellx/y options for all your new countrys.

5a. click the flag at cell 0,0. It can be found in the north of america if you've used X=0 and y=0. Just move the flag over "the netherlands".

5b. make sure your adjecentAreaIds are corretly. Switch the "show adjacent areas" option on and see by youself. A red line means "its only connected from A to B, but not from B to A". If you see it, connect it in both ways or the game will crash.

5c. turn the "show area fills" option on. Look at the little square neary by the countrys flag. (if you move the flag again, the fill-square will move with it!)

5d. make sure you've connected the right seazone to your new country.

This is ALL you need to play the game with the new minor country. But ill just going on to explain some tags:


Were going throu the map.xml file line by line:
name: the name fo the scenario
description: be lucky if you onky using normal chars for you discription. Otherwise the game will crash. Nee? oh, really! Using "Nee" or "no" is always better as using the middle-german "nä".

most of the settings are selfexplaining. So were going to the "SpecialAreas" tag:
NbWeakAreas/StrongAreas:
number of the weak & strong areas. The Armysize if this areas if ginven in from-to: [10;399] means an strong minor neutral can have an army betwen 10.000 and 399.000 men.

SpecialSprites:
Im sure kroah will explain this by himself. I dont know what it is...

MajorColors:
the html-color name of the countrys. The original country-colours are also useable as england, germany, ...
you can use the html-color-names or the color-number. Its up to you.
the first colorname, england in this case, is used by the first given major. If you want a red england, just type in russia at the first, or maybe #000000.

bordercolor:
explained in step 1. deafault is 010101.

fillopacity:
i never used it, but i think kroah has explained it in the thread asking for a tutorial.

patternconfig:
I never used it, but use it if you want to use the pattern graphics in patterns.png. Look at the "elora" scenario how to use it. If you use it it would make the fills much easier.

groups - group id=0:
name: england location
here you can edit the navys and armys of each major home country. IsCapital will build a factory here.
In our example, we want know create an new major: the netherlands!

go at the end of the grous section. Just fill in
Code: Select all
    <Group Id="6">
      <Name>The Netherlands location</Name>
      <GroupAreas>
        <GroupArea AreaId="[b]the-netherlands-areas-id-goes-here[/b]">
          <Army>2000</Army>
          <Navy>100</Navy>
        </GroupArea>
</group>

this will give the netherlands 2 mio trooops and 100 ships. The netherlands have only one province here, so if you want to give it one province more, you can create a new grouparea with an army and navy tag. I probably would use belgium for that.
Dont forget to make "the netherlands" IsCapital. Otherwise they dont get a factory.

Just create a new majors-tag for our new major country. For example, heres the one from england. Just change the name and the major-id (to the last possible id) and if you want, you can define a beginning-score, the starting treasury, the armys and navys costs and the attack and def factors of the armys and navys.
Code: Select all
 <Majors>
    <Major Id="0">
      <Name>England</Name>
      <DefaultFlagIndex>0</DefaultFlagIndex>
      <DefaultColorIndex>0</DefaultColorIndex>
      <DefaultGroupId>0</DefaultGroupId>
      <Score>0</Score>
      <Treasury>50</Treasury>
      <ArmyCost>6</ArmyCost>
      <NavyCost>2</NavyCost>
      <ArmyFactorOff>1</ArmyFactorOff>
      <ArmyFactorDef>1</ArmyFactorDef>
      <NavyFactorOff>1</NavyFactorOff>
      <NavyFactorDef>1</NavyFactorDef>
      <Ai>
        <ArmyNavyDistribution>2</ArmyNavyDistribution>
        <BaseArmyToLeft>20</BaseArmyToLeft>
        <HundredsToSend>2</HundredsToSend>
        <NbArmyMaxNeutralToAttack>50</NbArmyMaxNeutralToAttack>
        <RandomsRegionId>0,1,2,3,4,5,6,7,0,1,5,3,4,5,6,7</RandomsRegionId>
      </Ai>
    </Major>
</Majors>

the AI tag looks a bit better as it is. At the moment the std-AI dont use the RandomRegionId-tag. This should define in witch region the netherlands-AI will attack first.
ArmyNavyDistribution defines the way the ai handles the navys. A higher number will make the AI more using troops, a lower number will make it to attack more by navy.

HundreadsToSend defines the minimum army the ai uses to attack a neutral (or also a major?)

baseArmyToLeft defines the value of the armys witch the ai will leav in the new conquered provinces.

ArmyMaxNeutralToAttack: dont know!


After the majors-tag is a little other option:
Code: Select all
  <DefaultArea>
    <Army>[10;99]</Army>
    <Navy>0</Navy>
    <Worth>[6;23]</Worth>
    <Score>[13;50]</Score>
    <NeutralArmyFactorDef>[2;5]</NeutralArmyFactorDef>
    <Terrain>0</Terrain>
  </DefaultArea>

it just defines the "normal" neutral areas, not the special ones with more or less troops as the normal neutrals.
I think this all is selfexplaining. I dont really know, but think the "NeutralArmyFactorDef" is the equivalent for the defensive factor from the majors armys.
terrain: if you not given the netherlands an terraintype, the netherlands will use the worth you'll give in the terrain-field (right? Im not sure here...)

the regions:
Code: Select all
    <Region Id="8">
      <Name>Region #8[b]or an other fancy name goes here[/b]</Name>
      <Color>rose</Color>
      <Distances>
        <Distance RegionId="0">4</Distance>
        <Distance RegionId="1">2</Distance>
        <Distance RegionId="2">2</Distance>
        <Distance RegionId="3">2</Distance>
        <Distance RegionId="4">2</Distance>
        <Distance RegionId="5">4</Distance>
        <Distance RegionId="6">6</Distance>
        <Distance RegionId="7">6</Distance>
      [b]<Distance RegionId="8">0</Distance>[/b]
      </Distances>
    </Region>

the netherlands are known for there great land, right? so we'll give them here there own region!
Just create a new region number for that. The best idea is to take the european region as an example (i think it was number 3):


Were having here 8 regions (from 0 to 7). All you need is to write a new "distance regionId=X"-tag (ive marked it bold).
Like kroahs sayed an battleround has 8 turns. The given value defines how long you troops will need to go from one region to an other.
...so dont forget to edit the other "region"-tags, or you will probably have a "single-way region".

in this example your troops will need 0 battlerounds to go from region 8 to region 8 and 2 battlerounds from 8 (netherlands) to 3 (europe).

Than altering the RegionId-tag in the area id flied list where you created "the netherlands" in section 3.

After all, just start the map editor again. Look at the options and let the mapeditor display the regions (you can edit the regions here as well). Does it all looks correctly? Yes? Just start the game and try it out.

that way my little tutorial with some little explainations.... I hope this will help you creating new scenarios.
Christine
 
Posts: 68
Joined: 31 May 2012, 11:04

Re: map creating tutorial

Postby Kroah » 19 Aug 2012, 17:18

Thank you for your nice tutorial Christine.

As we can see, many things have to be done by hand in the XML. But the hard things can be edited in the editor (fills, areas & zones locations & adjacencies, area properties...).

I'm currently creating my second map, and when i see something hard/boring to do by hand in the xml, i think how i could add it in the editor (and withtout putting the map in an unstable state).

Two remarks concerning the tutorial:

- When the <BorderColor> tag is empty (like the standard scenario), CoCoNet uses the original fill method of Colonial Conquest (using the ResetColor if present) : a first pass will flood fill the pointed location with the ResetColor, a second pass will flood fill the pointed location with the attacking country color.

- When the <BorderColor> tag is not empty (like the provided Struggle for Elora map), CoCoNet uses an enhanced fill method : the flood fill algorithm fills ALL the colors starting from the pointed location up to the <BorderColor> color. BE AWARE this cannot be used in the original Colonial Conquest map as is because some countries aren't closed with the #010101 BorderColor!(check norway and north of Russia).

The second method is easier to use when creating a custom map because you don't need to hand edit all the patterns at the country borders and you don't need a ResetColor. A <FillOpacity> can be used too : the country will be filled with the attacking major color using an alpha transparency (check next release for this feature).

- The RandomRegionId tag is used for army moves only (bug or feature in the original game?). I may update the original AI in the next release so it will be used for navy moves too.
Kroah
Site Admin
 
Posts: 412
Joined: 07 Feb 2006, 01:01
Location: France

Re: map creating tutorial

Postby Christine » 19 Aug 2012, 19:28

Kroah wrote:I'm currently creating my second map, and when i see something hard/boring to do by hand in the xml, i think how i could add it in the editor (and withtout putting the map in an unstable state).


I wrote a little php script for the boringst thing I found... it checks for the given bordercolor and adds an country-tag with an id if a land is found.

in short, its something like:
while (go throuth X, then Y)
{
check pixel x,y
go +1/-1 in top, left, right, bottom if pixel X,Y
if found an other pixel then bordercolor then add to array_countrys
}
array_unique(array_countrys);

to avoid problems, the script sorts the countrys by the color. So before running the script, you have to give the countrys a unique color. Thats not a nice solution, but simple to code (and much faster than any other solution without unique bordercolors).

Another idea is... add an "create clean xml file" option.
Christine
 
Posts: 68
Joined: 31 May 2012, 11:04


Return to CoCoNet Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron