summaryrefslogtreecommitdiff
path: root/notes.md
blob: d0d02c6427c8a870353b6d5607a527cd10c96316 (plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
> I have a programmer's superstitions about always using powers of 2, which are more 
> pleasing to the spirit of the machine.
-mewo2, whose sentiment I share


grid generation
---------------

The basic sequence is:

	- pick N random points
	- relax them a lil
	- generate their voronoi diagram

Picking N random points it quite straightforward. For relaxation, I indent to just step 
over MxM points, get the closest of the set of N, and compute the averages to get the 
centroids. This, again, should be quite simple. Voronoi generation is then just a 
matter of using rhill's library.


terrain generation
------------------

mewo2 does this automatically; I'd like to do it interactively. Their primitives list 
is helpful to me though! I'd like to have "brushes" for these things, so that you can 
pick a radius and strength and then just go to town adding features.

	- constant slope: not entirely sure how this would work (pick a point and make things 
	  slope from there to the center?)
	- cones: pretty solid imo
	- round blobs: also pretty solid
	- relax: lerp with the average of neighboring points, with the lerp strength relative 
	  to brush strength and radius.
	- round: same as relax, but lerp with a point's own square root.

Normalization seems probably superfluous -- we'd like to be able to have really tall 
mountains and stuff, and it could also make some of the other operations a bit weird 
(like having stuff that was previously land disappear under water while building a 
mountain).

One thing to keep in mind is the effect of map scaling on brush radius size. I think I'd 
like to have the visual radius stay the same size, and shrink the internal radius to 
match it.

Rivers and erosion are interesting -- I may want to have an "erosion" and "rain" brush 
to generate these features.


rendering
---------

tba, not sure what I want to do here


additional features
-------------------

I want to take the same approach as OpenStreetMap and have all other features (and 
possibly even some, like rivers) be *nodes*, that exist independently of the terrain 
grid. These can be zero-, one-, or two-dimensional. Each node should exist on a *layer*,
so that different layers can be viewed at any given time. Additionaly, nodes may be 
assigned a relevance level, which corresponds to the scale required to view them. The 
highest-level nodes are only visible when broadly zoomed out, and reflect things like 
major cities, nations, and large-scale geographic features. The lowest-level nodes 
would represent things like individual buildings and only be visible when highly zoomed in.

Node should be able to indicate things like climate regions or land use patterns as well,
and those kinds of nodes should be on their own layers, so that the user can view or 
ignore relevant data at any time.


points
------

Points are objects with the following properties **only**:

	- x: the x-coordinate in meters
	- y: the y-coordinate in meters


shapes
------

A shape is an object containing the following properties **only**:

	- type: a string, either 'point', 'path', or 'polygon'
	- points: an array of `points`, or, if type is 'point', a single point object.
	- boundingBox: AABB that contains every point in `points`


mapObject
---------

mapObjects are objects with the following properties:

	- core: a point
	- shapes: an array of `shape` objects
	- mapObjects: an array of child mapObjects
	- boundingBox: AABB that contains the bounding boxes of every shape in shapes
	- minZoom: a number from 0 to 6 (see maxZoom)
	- maxZoom: a number from 0 to 7:
		0. global
		1. regional
		2. national
		3. provincial
		4. city
		5. neighborhood
		6. building


tiles
-----

A tile is an object with the following properties:

	- region: an AABB bounding the tile area
	- mapObjects: an array of references to the mapObjects that intersect this square

worlds
------

a world is an object with the following properties: