-
Notifications
You must be signed in to change notification settings - Fork 0
/
mapgen.h
40 lines (27 loc) · 1.02 KB
/
mapgen.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* set average region size (e.g. 36)
* count tiles (e.g. 24x100 = 2400) and determine the number of regions (e.g. 2400 / 36 = 67)
* randomly assign region centers to float (do not overlap within same tile/integer)
* create regions (name = order number)
repeat X times
* for each tile, find closest region center and assign it to that center
* from tiles belonging to a region, recalculate region centers
end
* distort borders ?
**/
#ifndef MAPGEN_H
#define MAPGEN_H
#include <stdint.h>
int voronoi_iterations;
float **region_centers;
float **create_region_centers(uint16_t nr_regions);
void create_regions(uint16_t nr_regions);
void create_characters(uint16_t nr_characters);
void assign_tiles_to_centers();
void voronoi(int nr_regions);
unsigned char **create_height_grid();
void delete_height_grid(unsigned char **grid);
void populate_height_grid(unsigned char **grid);
void blur_height_grid(unsigned char **grid);
int create_contiguous_area(unsigned char **grid, unsigned int percent_unwalkable);
#endif /* MAPGEN_H */