Towns
评价数不足
Towns Map Creation: Part 6: Materials: Adding Materials to the Surface
由 Varsh 制作
In this tutorial you will learn how to add materials to the surface while keeping certain materials just below the surface so they are not as abundant on top.
   
奖励
收藏
已收藏
取消收藏
Notes
Without raw materials our citizens will not have much to build, in fact they probably won't be able to defend themselves. To solve this we will create raw materials that will be required for making all of your early game items and tools.

For early game tools and weapons you will need iron, copper, coal, and stone and potentially gravel for the flint. Other than gravel we will create new seeds for the 4 materials.
Where to put the seeds
Each of the seeds require percentages in all 6 directions but at a very low number!, the reason is that there needs to be many different occurrences of these materials and having a high percentage will mean that they would spread too much on the landscape, to counter not having any appear though there will be a higher turn number.

The starting point for the seeds are to be below the surface while being able to appear on the surface if possible so the player knows where the material can be found. Even with a low percentage chance it is still possible for the material to go up 15 tiles if the turns are set to 15 so to prevent so having at least 1+24 levels will mean that it will always start at least 1 layer below the surface, but to have it further deeper in places it would be a better idea to include a die roll as to not conflict too much with other materials. Also to not overcrowd the map underground there will only be 20 seeds set per material.
The material code
For each material you should have the following immediately after the “seedGrassNoFlower1” seed:
<seed id="seedStone"> <type>stone</type> <num>200</num> <level>1d10+24</level> <turns>25</turns> <northPCT>8</northPCT> <southPCT>8</southPCT> <eastPCT>8</eastPCT> <westPCT>8</westPCT> <upPCT>5</upPCT> <downPCT>10</downPCT> </seed> <seed id="seedCoal"> <type>coal</type> <num>20</num> <level>1d9+24</level> <turns>15</turns> <northPCT>8</northPCT> <southPCT>8</southPCT> <eastPCT>8</eastPCT> <westPCT>8</westPCT> <upPCT>5</upPCT> <downPCT>10</downPCT> </seed> <seed id="seedIron"> <type>iron</type> <num>20</num> <level>1d9+24</level> <turns>15</turns> <northPCT>8</northPCT> <southPCT>8</southPCT> <eastPCT>8</eastPCT> <westPCT>8</westPCT> <upPCT>5</upPCT> <downPCT>10</downPCT> </seed> <seed id="seedCopper"> <type>copper</type> <num>20</num> <level>1d9+24</level> <turns>15</turns> <northPCT>8</northPCT> <southPCT>8</southPCT> <eastPCT>8</eastPCT> <westPCT>8</westPCT> <upPCT>5</upPCT> <downPCT>10</downPCT> </seed>
As stone is far more abundant in real life and is a primary building material there are many more seeds required. Remember that the types refer to the graphics.ini file. Try out the map and hopefully you should see plenty of stone and the odd few other materials available.
Adding gravel
With gravel however we want to do something different, we will have initially 10 seeds that are on the surface with the same values as the others however gravel naturally occurs around running water so having these appear by the river will require a “change” instead. For the seed we will use:
<seed id="seedGravel"> <type>gravel</type> <num>10</num> <level>24</level> <turns>10</turns> <northPCT>10</northPCT> <southPCT>10</southPCT> <eastPCT>10</eastPCT> <westPCT>10</westPCT> <upPCT>5</upPCT> <downPCT>5</downPCT> </seed>
The gravel from the code is going to be generated right on the surface but still has the chance to be higher up too. But what we really need is an abundance of gravel near the river so for the change (added at the end of the file before </gen_map>) we will use:
<change id="changeGravel"> <source>grass</source> <destination>gravel</destination> <terrain>_WATER_INF_</terrain> <PCT>50</PCT> <radius>2</radius> </change>
Wherever there is grass close by to the river then the grass will change to gravel and not go any more than 2 spaces away from the water, half of the terrain tiles will change to gravel. If you want you can do the same for water in which case just create a new “change” and copy the exact same code but change the id to “changeGravel2” and have the type set to _WATER_ instead.
Try it out
Try out the map and you should now see gravel placed alongside the river and the lakes, if you play around with the values then see what you can come up with and work it for your map.
Code
Here's the code for the gen_map.xml file with the new additions:
<?xml version="1.0" encoding="UTF-8"?> <gen_map> <init id="init"> <numLevelsOutside>24</numLevelsOutside> <numLevelsUnderground>40</numLevelsUnderground> <mainTerrain>grass,dirt,stone</mainTerrain> <numCitizens>100</numCitizens> <startingLevel>23</startingLevel> </init> <seed id="seedGrassNoFlower"> <type>grassnoflower</type> <num>1d10+15</num> <level>24</level> <turns>30</turns> <northPCT>25</northPCT> <southPCT>25</southPCT> <eastPCT>25</eastPCT> <westPCT>25</westPCT> </seed> <seed id="seedGrassNoFlower1"> <type>grassnoflower1</type> <num>1d10+15</num> <level>24</level> <turns>30</turns> <northPCT>25</northPCT> <southPCT>25</southPCT> <eastPCT>25</eastPCT> <westPCT>25</westPCT> </seed> <seed id="seedStone"> <type>stone</type> <num>200</num> <level>1d10+24</level> <turns>25</turns> <northPCT>8</northPCT> <southPCT>8</southPCT> <eastPCT>8</eastPCT> <westPCT>8</westPCT> <upPCT>5</upPCT> <downPCT>10</downPCT> </seed> <seed id="seedCoal"> <type>coal</type> <num>20</num> <level>1d9+24</level> <turns>15</turns> <northPCT>8</northPCT> <southPCT>8</southPCT> <eastPCT>8</eastPCT> <westPCT>8</westPCT> <upPCT>5</upPCT> <downPCT>10</downPCT> </seed> <seed id="seedIron"> <type>iron</type> <num>20</num> <level>1d9+24</level> <turns>15</turns> <northPCT>8</northPCT> <southPCT>8</southPCT> <eastPCT>8</eastPCT> <westPCT>8</westPCT> <upPCT>5</upPCT> <downPCT>10</downPCT> </seed> <seed id="seedCopper"> <type>copper</type> <num>20</num> <level>1d9+24</level> <turns>15</turns> <northPCT>8</northPCT> <southPCT>8</southPCT> <eastPCT>8</eastPCT> <westPCT>8</westPCT> <upPCT>5</upPCT> <downPCT>10</downPCT> </seed> <seed id="seedGravel"> <type>gravel</type> <num>10</num> <level>24</level> <turns>10</turns> <northPCT>10</northPCT> <southPCT>10</southPCT> <eastPCT>10</eastPCT> <westPCT>10</westPCT> <upPCT>5</upPCT> <downPCT>5</downPCT> </seed> <seed id="seedLake"> <type>_WATER_</type> <num>1d3</num> <level>24</level> <pointx>1d160+20</pointx> <pointy>1d160+20</pointy> <turns>10</turns> <northPCT>100</northPCT> <southPCT>100</southPCT> <eastPCT>100</eastPCT> <westPCT>100</westPCT> <downPCT>100</downPCT> </seed> <bezier id="bezierRiver1"> <type>_WATER_INF_</type> <level>24</level> <depth>5</depth> <wide>5</wide> <point1_x_min>25</point1_x_min> <point1_x_max>175</point1_x_max> <point1_y_min>-50</point1_y_min> <point1_y_max>-50</point1_y_max> <point2_x_min>25</point2_x_min> <point2_x_max>175</point2_x_max> <point2_y_min>250</point2_y_min> <point2_y_max>250</point2_y_max> <controlpoint1_x_min>-50</controlpoint1_x_min> <controlpoint1_x_max>250</controlpoint1_x_max> <controlpoint1_y_min>25</controlpoint1_y_min> <controlpoint1_y_max>75</controlpoint1_y_max> <controlpoint2_x_min>-50</controlpoint2_x_min> <controlpoint2_x_max>250</controlpoint2_x_max> <controlpoint2_y_min>125</controlpoint2_y_min> <controlpoint2_y_max>175</controlpoint2_y_max> </bezier> <heightSeed id="seedHeight1"> <num>2d3+2</num> <turns>20</turns> <flatsBetweenLevels>1d3</flatsBetweenLevels> <northPCT>50</northPCT> <southPCT>50</southPCT> <eastPCT>50</eastPCT> <westPCT>50</westPCT> </heightSeed> <heightSeed id="seedHeight2"> <num>2d10+5</num> <turns>10</turns> <flatsBetweenLevels>1d5</flatsBetweenLevels> <northPCT>50</northPCT> <southPCT>50</southPCT> <eastPCT>50</eastPCT> <westPCT>50</westPCT> </heightSeed> <change id="changeGrassNoFlower1"> <source>grassnoflower</source> <destination>grassnoflower1</destination> <terrain>grassnoflower</terrain> <PCT>50</PCT> <radius>20</radius> </change> <change id="changeGrassNoFlower2"> <source>grassnoflower1</source> <destination>grassnoflower2</destination> <terrain>grass</terrain> <PCT>50</PCT> <radius>10</radius> </change> <change id="changeGravel1"> <source>grass</source> <destination>gravel</destination> <terrain>_WATER_INF_</terrain> <PCT>50</PCT> <radius>2</radius> </change> <change id="changeGravel2"> <source>grass</source> <destination>gravel</destination> <terrain>_WATER_</terrain> <PCT>50</PCT> <radius>2</radius> </change> </gen_map>
5 条留言
Cerberus/Bram 2013 年 12 月 6 日 上午 5:35 
Well, that's a shame. Thanks anyway for the tutorials you have provided so far, and I'll just try and make my own way modding Towns.
Varsh  [作者] 2013 年 12 月 6 日 上午 4:21 
Sorry I haven't got back to this (again) but I've hit crunch time with work and also I've recently got my PS4 so I've been spending my spare time on that. On top of that the game is completely abandoned so the main bugs won't be fixed so I've fully lost interest in the game now, sorry. :(
Cerberus/Bram 2013 年 11 月 14 日 下午 1:15 
No worries, mate. Your own life goes before helping people with a game, of course. But any help you can find the time to give is greatly appreciated.
Varsh  [作者] 2013 年 11 月 14 日 上午 11:00 
Sorry about not getting back to this series. I recently got a second job (to help pay the bills and such) so most of my time suddenly vanished. I do have next week off so I'll be able to try and get a few more of the tutorials done.
Cerberus/Bram 2013 年 11 月 14 日 上午 3:45 
Hey Varsh, really loving your modding guide. I would, however, like to see the other parts you mentioned on the Towns forums to be uploaded. Because right now I can make basically half a map, which is great, but it'd be even better if I could make the whole map by myself without borrowing script from other maps.