(08.12.2014 12:29)ic111 schrieb: Worüber ich gerade auch nachdenke ist ob ich als Nachverarbeitungsschritt gleich noch Städte generieren soll. Wie ich auf die Idee komme:
Ich denk ich werd das so machen:
- Erstmal für jedes 16x16 (oder evtl. 32x32-Grid) auf der Karte ein paar Kennzahlen ausrechnen, für Flussgröße, Flußverzweigungen, Anteil Wasser, Flachheit des Geländes, absolute Höhe des Geländes, etc., skaliert jeweils auf den Bereich 0...1000
- Daraus kann man dann ablesen wie geeignet die Umgebung für eine Stadt ist.
river_size_score = 800, river_end_score = 800, water_amount_score = 500 würde zum Beispiel nahelegen, dass da eine große Flussmündung irgendwo in der Nähe ist, wenn dann noch das Gelände eben ist ist das kein schlechter Standort für eine größere Stadt.
- Dann wie gehabt zufällige Positionen auf der Karte überprüfen, und wenn sie im Sinne der Kennzahlen passen eine Stadt dort anlegen.
Zusätzlich am Beginn der Generierung vielleicht noch ein paar größere zusammenhängende Bereiche die gut für Städte geeignet sind zusammensuchen und zum Ballungsraum erklären.
Die ersten paar Kennzahlen die ich schon implementiert hab:
Code:
struct CityScore {
/** The maximum river flow in the grid divided by the maximum river flow on the map,
* scaled on a range 0...1000
*/
int river_size_score;
/** The maximum value (flow_one / flow_two) * (branch_flow / maximum_map_flow) for any
* river branch (where two or more rivers join in a tile) in the grid, scaled to a range
* 0...1000.
* flow_one and flow_two are the flows of the incoming rivers (switched such that flow_one <= flow_two),
* if more than two rivers merge the two biggest flows, branch_flow is the first flow of the merged river,
* maximum_map_flow is the maximum river flow on the map.
*
* The idea is that this value is the bigger the more flow the merging rivers have, and the more
* equal-sized the two rivers are.
*/
int river_branch_score;
/** The percentage of lake or ocean in the grid, scaled to a range 0...1000
*/
int water_amount_score;
/** The size of the biggest lake intersecting the grid, divided by the size of the biggest lake on map.
*/
int lake_size_score;
/** The flow of the biggest river ending up in a lake or the ocean, divided by the maximum river flow on
* map, scaled on a range 0...1000
*/
int river_end_score;
};
Dazukommen wird noch was für die Flachheit des Geländes und die absolute Höhe.