Terrain generator (river and lake)

Post your mods and custom content here

Terrain generator (river and lake)

Postby Tutamun » Sat Dec 03, 2011 3:36 pm

I think the terrain generator needs a little bit of work to generate more natural river(s) and lake(s).

Now it is always a circular lake and an s-formed river.
It isn't really bad or noticeable on the main screen... but you can always see it on the mini map. It looks artificial. And it is something visible on every screenshot... and thus may turn customers away.
User avatar
Tutamun
 
Posts: 294
Joined: Mon Nov 21, 2011 10:52 am

Re: Terrain generator (river and lake)

Postby supermalparit » Sat Dec 03, 2011 3:58 pm

I agree.

If you have time and you want, you can edit the file gen_map.xml and try to generate different maps and playing a little with the options!
Xavi Canal
Image
User avatar
supermalparit
Towns team
 
Posts: 2444
Joined: Thu Oct 27, 2011 11:57 pm

Re: Terrain generator (river and lake)

Postby NakedFury » Sat Dec 03, 2011 6:50 pm

Code: Select all
[Dec 3, 2011 3:40:53 AM][Utils] Error parsing number [1d200+20]. Return default [-1]
[Dec 3, 2011 3:40:53 AM][Utils] Error parsing number [-1d200+20]. Return default [-1]
[Dec 3, 2011 3:40:53 AM][Utils] Error parsing number [1d200]. Return default [-1]
[Dec 3, 2011 3:40:53 AM][Utils] Error parsing number [1d300]. Return default [-1]
[Dec 3, 2011 3:40:53 AM][Utils] Error parsing number [1d400]. Return default [-1]
[Dec 3, 2011 3:40:53 AM][Utils] Error parsing number [1d200]. Return default [-1]
[Dec 3, 2011 3:40:53 AM][Utils] Error parsing number [1d200]. Return default [-1]
[Dec 3, 2011 3:40:53 AM][Utils] Error parsing number [1d200]. Return default [-1]
[Dec 3, 2011 3:40:53 AM][Utils] Error parsing number [1d400]. Return default [-1]
[Dec 3, 2011 3:40:53 AM][MapGenerator] Bezier. Bad points
[Dec 3, 2011 2:21:46 PM][Utils] Error parsing number [1d200+20]. Return default [-1]
[Dec 3, 2011 2:21:46 PM][Utils] Error parsing number [-1d200+20]. Return default [-1]
[Dec 3, 2011 2:21:46 PM][Utils] Error parsing number [1d200]. Return default [-1]
[Dec 3, 2011 2:21:46 PM][Utils] Error parsing number [1d300]. Return default [-1]
[Dec 3, 2011 2:21:46 PM][Utils] Error parsing number [1d400]. Return default [-1]
[Dec 3, 2011 2:21:46 PM][Utils] Error parsing number [1d200]. Return default [-1]
[Dec 3, 2011 2:21:46 PM][Utils] Error parsing number [1d200]. Return default [-1]
[Dec 3, 2011 2:21:46 PM][Utils] Error parsing number [1d200]. Return default [-1]
[Dec 3, 2011 2:21:46 PM][Utils] Error parsing number [1d400]. Return default [-1]
[Dec 3, 2011 2:21:46 PM][MapGenerator] Bezier. Bad points
[Dec 3, 2011 2:44:51 PM][Utils] Error parsing number [1d200+20]. Return default [-1]
[Dec 3, 2011 2:44:51 PM][Utils] Error parsing number [-1d200+20]. Return default [-1]
[Dec 3, 2011 2:44:51 PM][Utils] Error parsing number [1d200]. Return default [-1]
[Dec 3, 2011 2:44:51 PM][Utils] Error parsing number [1d300]. Return default [-1]
[Dec 3, 2011 2:44:51 PM][Utils] Error parsing number [1d400]. Return default [-1]
[Dec 3, 2011 2:44:51 PM][Utils] Error parsing number [1d200]. Return default [-1]
[Dec 3, 2011 2:44:51 PM][Utils] Error parsing number [1d200]. Return default [-1]
[Dec 3, 2011 2:44:51 PM][Utils] Error parsing number [1d200]. Return default [-1]
[Dec 3, 2011 2:44:51 PM][Utils] Error parsing number [1d400]. Return default [-1]


When I tried to change them:
Code: Select all
<seed>
      <!-- At the moment _WATER_ and _LAVA_ are special types, hardcoded in-game, NOT in terrain.xml -->
      <type>_WATER_</type>
      <num>1</num>
      <level>0</level>
      <turns>150</turns>

      <northPCT>2</northPCT>
      <southPCT>5</southPCT>
      <eastPCT>7</eastPCT>
      <westPCT>6</westPCT>
      <upPCT>4</upPCT>
      <downPCT>2</downPCT>
   </seed>

   <!-- river -->
   <bezier>
      <!-- At the moment _WATER_ and _LAVA_ are special types, hardcoded in-game, NOT in terrain.xml -->
      <type>_WATER_</type>
      <level>0</level>
      <depth>3</depth>
      <wide>1d6+4</wide>

      <!-- First Bezier point -->
      <point1_x_min>0</point1_x_min>
      <point1_x_max>1d200</point1_x_max>
      <point1_y_min>-1d200</point1_y_min>
      <point1_y_max>-50</point1_y_max>

      <!-- Second Bezier point -->
      <point2_x_min>0</point2_x_min>
      <point2_x_max>1d200</point2_x_max>
      <point2_y_min>1d300</point2_y_min>
      <point2_y_max>1d400</point2_y_max>

      <!-- First Bezier control point -->
      <controlpoint1_x_min>-150</controlpoint1_x_min>
      <controlpoint1_x_max>0</controlpoint1_x_max>
      <controlpoint1_y_min>2d50+20</controlpoint1_y_min>
      <controlpoint1_y_max>1d200</controlpoint1_y_max>

      <!-- Second Bezier control point -->
      <controlpoint2_x_min>1d200</controlpoint2_x_min>
      <controlpoint2_x_max>1d300</controlpoint2_x_max>
      <controlpoint2_y_min>0</controlpoint2_y_min>
      <controlpoint2_y_max>0</controlpoint2_y_max>
   </bezier>
NakedFury
 
Posts: 63
Joined: Thu Dec 01, 2011 8:28 am

Re: Terrain generator (river and lake)

Postby Tutamun » Sat Dec 03, 2011 7:20 pm

I removed the lake and turned the river into an ocean on the lower right part of the map. (I was trying to figure out the coordinate system.)
Code: Select all
   <!-- ocean -->
   <bezier>
      <type>_WATER_</type>
      <level>0</level>
      <depth>3</depth>
      <wide>1d20+40</wide>
      <point1_x_min>-50</point1_x_min>
      <point1_x_max>-50</point1_x_max>
      <point1_y_min>175</point1_y_min>
      <point1_y_max>210</point1_y_max>
      <point2_x_min>250</point2_x_min>
      <point2_x_max>250</point2_x_max>
      <point2_y_min>180</point2_y_min>
      <point2_y_max>220</point2_y_max>
      <controlpoint1_x_min>25</controlpoint1_x_min>
      <controlpoint1_x_max>90</controlpoint1_x_max>
      <controlpoint1_y_min>100</controlpoint1_y_min>
      <controlpoint1_y_max>250</controlpoint1_y_max>
      <controlpoint2_x_min>110</controlpoint2_x_min>
      <controlpoint2_x_max>175</controlpoint2_x_max>
      <controlpoint2_y_min>100</controlpoint2_y_min>
      <controlpoint2_y_max>250</controlpoint2_y_max>
   </bezier>


I did not try min/max values to see if it always is an ocean... but the four or five maps I generated looked fine.

I'm still thinking about how to make a river... probably connect static designed bezier curves? Hmm... I need a break for now.

One other thing I realized:
The blue (water) and yellow (sand) right next to each other on the minimap hurt my eyes. Can you (or we?) change the color of sand and water? Get it closer to the actual color on the main map.
User avatar
Tutamun
 
Posts: 294
Joined: Mon Nov 21, 2011 10:52 am

Re: Terrain generator (river and lake)

Postby Tutamun » Sat Dec 03, 2011 7:23 pm

@NakedFury:
You don't need to randomize the numbers in x_min and x_max... as the program chooses a random value between x_min and x_max.

<point1_x_min>0</point1_x_min>
<point1_x_max>200</point1_x_max>

This gives you a value between 0 and 200 for point1_x.
User avatar
Tutamun
 
Posts: 294
Joined: Mon Nov 21, 2011 10:52 am

Re: Terrain generator (river and lake)

Postby supermalparit » Sun Dec 04, 2011 6:08 am

Yes, currently not all values are dices. That's the cause of the errors.

Code: Select all
[Utils] Error parsing number [1d200]. Return default [-1]


So, you have to put fixed values on those fields.


Can you post some screenshots?
Xavi Canal
Image
User avatar
supermalparit
Towns team
 
Posts: 2444
Joined: Thu Oct 27, 2011 11:57 pm

Re: Terrain generator (river and lake)

Postby Tutamun » Sun Dec 04, 2011 2:52 pm

Now I have a coastline and a three segment river.
Code: Select all
   <!-- ocean - random -->
   <bezier>
      <type>_WATER_</type>
      <level>0</level>
      <depth>4</depth>
      <wide>1d20+40</wide>
      <point1_x_min>-50</point1_x_min>
      <point1_x_max>-50</point1_x_max>
      <point1_y_min>175</point1_y_min>
      <point1_y_max>210</point1_y_max>
      <point2_x_min>250</point2_x_min>
      <point2_x_max>250</point2_x_max>
      <point2_y_min>180</point2_y_min>
      <point2_y_max>220</point2_y_max>
      <controlpoint1_x_min>25</controlpoint1_x_min>
      <controlpoint1_x_max>90</controlpoint1_x_max>
      <controlpoint1_y_min>155</controlpoint1_y_min>
      <controlpoint1_y_max>250</controlpoint1_y_max>
      <controlpoint2_x_min>110</controlpoint2_x_min>
      <controlpoint2_x_max>175</controlpoint2_x_max>
      <controlpoint2_y_min>155</controlpoint2_y_min>
      <controlpoint2_y_max>250</controlpoint2_y_max>
   </bezier>
   <!-- river segment 1 -->
   <bezier>
      <type>_WATER_</type>
      <level>0</level>
      <depth>2</depth>
      <wide>1d2+4</wide>
      <point1_x_min>-50</point1_x_min>
      <point1_x_max>250</point1_x_max>
      <point1_y_min>-50</point1_y_min>
      <point1_y_max>-50</point1_y_max>
      <point2_x_min>150</point2_x_min>
      <point2_x_max>150</point2_x_max>
      <point2_y_min>100</point2_y_min>
      <point2_y_max>100</point2_y_max>
      <controlpoint1_x_min>0</controlpoint1_x_min>
      <controlpoint1_x_max>200</controlpoint1_x_max>
      <controlpoint1_y_min>0</controlpoint1_y_min>
      <controlpoint1_y_max>25</controlpoint1_y_max>
      <controlpoint2_x_min>150</controlpoint2_x_min>
      <controlpoint2_x_max>175</controlpoint2_x_max>
      <controlpoint2_y_min>50</controlpoint2_y_min>
      <controlpoint2_y_max>75</controlpoint2_y_max>
   </bezier>
   <!-- river segment 2 -->
   <bezier>
      <type>_WATER_</type>
      <level>0</level>
      <depth>3</depth>
      <wide>1d3+6</wide>
      <point1_x_min>150</point1_x_min>
      <point1_x_max>150</point1_x_max>
      <point1_y_min>100</point1_y_min>
      <point1_y_max>100</point1_y_max>
      <point2_x_min>-50</point2_x_min>
      <point2_x_max>250</point2_x_max>
      <point2_y_min>250</point2_y_min>
      <point2_y_max>250</point2_y_max>
      <controlpoint1_x_min>150</controlpoint1_x_min>
      <controlpoint1_x_max>175</controlpoint1_x_max>
      <controlpoint1_y_min>125</controlpoint1_y_min>
      <controlpoint1_y_max>150</controlpoint1_y_max>
      <controlpoint2_x_min>0</controlpoint2_x_min>
      <controlpoint2_x_max>200</controlpoint2_x_max>
      <controlpoint2_y_min>175</controlpoint2_y_min>
      <controlpoint2_y_max>200</controlpoint2_y_max>
   </bezier>
   <!-- river segment 3 -->
   <bezier>
      <type>_WATER_</type>
      <level>0</level>
      <depth>1</depth>
      <wide>1d2+2</wide>
      <point1_x_min>250</point1_x_min>
      <point1_x_max>250</point1_x_max>
      <point1_y_min>-50</point1_y_min>
      <point1_y_max>75</point1_y_max>
      <point2_x_min>150</point2_x_min>
      <point2_x_max>150</point2_x_max>
      <point2_y_min>100</point2_y_min>
      <point2_y_max>100</point2_y_max>
      <controlpoint1_x_min>190</controlpoint1_x_min>
      <controlpoint1_x_max>210</controlpoint1_x_max>
      <controlpoint1_y_min>-50</controlpoint1_y_min>
      <controlpoint1_y_max>100</controlpoint1_y_max>
      <controlpoint2_x_min>180</controlpoint2_x_min>
      <controlpoint2_x_max>190</controlpoint2_x_max>
      <controlpoint2_y_min>65</controlpoint2_y_min>
      <controlpoint2_y_max>80</controlpoint2_y_max>
   </bezier>


Note: The ocean is always on the lower right and the point where the rivers join is always the same.

Some screenshots of the map:
*edit* changed link
http://www.dropbox.com/gallery/52047543/2/Towns/terrain?h=b72d1f

*edit* maybe I should join the rivers more in the center of the map?
User avatar
Tutamun
 
Posts: 294
Joined: Mon Nov 21, 2011 10:52 am

Re: Terrain generator (river and lake)

Postby supermalparit » Sun Dec 04, 2011 4:39 pm

Wow, nice job!

Honestly I didn't played too much with the map generator. For sure we need to add more options, but what are you creating looks very well.
Xavi Canal
Image
User avatar
supermalparit
Towns team
 
Posts: 2444
Joined: Thu Oct 27, 2011 11:57 pm

Re: Terrain generator (river and lake)

Postby NakedFury » Sun Dec 04, 2011 6:27 pm

wow thats excellent.

I must ask, is there a way to generate a bigger map?
Also Tutamun or anyone else, can you tell what are the points? Are they the points through which the river will pass through?

like:
--------------------------
|.**********************|
|***********************|
|*********. ************|
|***********************|
|***************.*******|
|***********.***********|
--------------------------

Points 1 to 4 and the river line will pass through them.
NakedFury
 
Posts: 63
Joined: Thu Dec 01, 2011 8:28 am

Re: Terrain generator (river and lake)

Postby Tutamun » Sun Dec 04, 2011 6:55 pm

Map:
- left upper corner is x=0 and y=0.
- left lower corner is x=0 and y=199.
- right upper corner is x=199 and y=0.
- right lower corner is x=199 and y=199.
*edited* it is 199 and not 200, thanks Xavi.

Bezier Curve:
p1: first point is the start of the curve(river).
p2: second point is the end of the curve.
c1: first control point pulls the curve from p1 to c1.
c2: second control point pulls the curve from p2 to c2.

Also see:
http://en.wikipedia.org/wiki/B%C3%A9zier_curve
Last edited by Tutamun on Sun Dec 04, 2011 8:55 pm, edited 1 time in total.
User avatar
Tutamun
 
Posts: 294
Joined: Mon Nov 21, 2011 10:52 am

Next

Return to Modding

Who is online

Users browsing this forum: No registered users and 2 guests

cron