2023-04-05

模倣子 Terrain Generation in mDnD

Initial mDnD Essay HERE 

Introduction 

We need a simple way to divide up space, so that an entire globe may be easily generated, preferably mostly as the party of adventurers makes their way through it.

I propose a set of nested increasingly large triangles that ultimately reach the size of an entire planet, in the form of an icosahedron (same shape as a d20).

A macromemetic-like system is needed to generate the next blob of terrain as the party enters it. Crossing the boundary from one triangle to the next, we could ask whether one needs to know where the given triangle (whatever its size) is located in the larger one. Perhaps this is not the case.

In a given terrain, such as town, kind of town, desert, forest, hilliness, mountains, the weather, winter, where is the seashore and so on, the next tiny step in any direction is going to tend to be more of the same.

So our requirements for this system are that:

  1. it be scalable from person size to whole world size
  2. it be easy to dynamically generate the next grid as the party approaches it.

The Icosahedron (d20) as Globe 

Quick overview: the Earth has a surface area of approximately 200 million square miles. Thus each face of an icosahedron (d20 solid shape) would contain 10 million square miles.

fig 1. icosahedron (20 faces) as approximate globe

This means that the edge of each face would be some 5,000 miles.

We can endlessly tile a gigantic equilateral triangle thusly:

fig 2. triangular face tiled into four, then each of four into four, etc.

In other words, the first "cutting" or "tiling" gives us four equilateral triangles inside the original one, and each edge is half the edge length of the original. This dividing by two property is intriguing. It makes things simple and clean if we just use multiples of two. In other words, if we just say that the largest edge is 4,096 miles, then we can go all the way down to one foot, which we call the "zeroth tiling level" (1).  

To extend from the scale of the very small to the very large, i.e., the level at which characters might experience a town or dungeon up to planet size, we have tiling level and edge length:

tiling levelfeetmiles
010
120
240
380
4160
5320
6640
71280
82560
95120
101,0240
112,0480
124,0961
138,1922
1416,3844
1532,7688
1665,53616
17131,07232
18262,14464
19524,288128
201,048,576256
212,097,152512
224,194,3041,024
238,388,6082,048
2416,777,2164,096

fig 3. triangle edge sizes from one foot to planet size


How to Generate the Next Bit of Terrain? 

We want to be able to generate new terrain as the party moves into it. The overall concept I want to follow is that the chance of a totally new terrain type starting is always at some level of possibility, and is also based on surrounding already decided terrain.
fig 4.1. triangles that abut upon the party's triangle

Every triangle is surrounded on three sides by three other triangles, as well as three triangles which only touch on the points. There must be continuity between triangles that abut one another. Or must there?

Another thing to think of is the next higher level, or even higher than that. The triangle we are currently in is within a larger triangle, and that triangle is within a still larger one. All of the surrounding triangles influence the triangle between them. Each one of those triangles are either the same kind of terrain, or a transition to some other kind of terrain.
fig 4.2. What terrain transitions look like

A terrain tile triangle is either solid, i.e., a continuation of the current terrain, be it grasslands, forest, town, dungeon, or whatever, or it's two-thirds one terrain and a third some new one, with the line of division going between the midpoints of two of its sides. When a party enters a new grid space, they will still have the same terrain, but they may or may not face a boundary ahead of them, as in figure 4.2.

Now comes the next big question: how to determine which kind of terrain happens next? The odds are that things will stay the same at any given moment. However, as in figure 4.2., if a neighboring tile changes terrain, then at least one, possibly two, and perhaps even three or four will change to the same new terrain. This is obvious since a change in terrain cannot take place on a single grid tile -- it must be continuous with the tiles around it.

The reality is that this needn't be decided for more than one tile if one is moving across an edge, and still even one is sufficient if one is moving through a point.

The problem is what kind of dice roll is needed to determine a change in terrain? Is this totally arbitrary, or is there some way to make it reasonable?
fig. 4.3. terrain of smaller area determined by surrounding area

Terrain Intersections and Boundaries

Two sections of terrain can border one another like in fig. 5.1a.

fig. 5.1a. two bordering terrain regions

The only kind of division of tiles that is "needed" is a triangle the tip of which may be cut off by one or the other of the bordering regions, see fig. 5.1b.

fig. 5.1b. A triangular tile shared between two regions

Now, if we have three regions intersecting we have two choices: 1. disallow certain terrains to border one another, e.g., no mountains next to sea shore, no forests next to deserts, and so on, or 2. have tiles that connect three different regions. This basically translates into things like needing a solid band of grassland that you have to cross to get from the ocean to the mountains and such. Figure 5.3. shows how two or more regions of terrain can meet. Note the red exes depict where more than two regions touch, and where we would need special tiles beyond the "tip bitten off" tiles from figure 5.2.

fig. 5.2a. Four sections of terrain and how they meet

fig. 5.2b. Triangular Tile Dividing between three regions

You might object that there has to be a tile that has a different region on each corner and a fourth type of tile in the center.

Maybe this is all just too complicated.

K.I.S.S (Keep it Simple and Spiritual, Dummy) 

It may be enough to say that each next segment of terrain, of whatever size, will tend to be of the same type as the current one, unless there is some kind of a change, and maybe this can be determined by a natural twenty roll on a d20. Or possibly rolling two d20s and seeing how far apart they are. If they exactly match, say, it might mean that the terrain changes drastically, and that can be up to the DM.

One way this might make sense is to think of the tile the party is in, and all of the tiles in the "super triangle." Think of this as the triangle that contains the party's triangle and the triangles around it, or two levels higher out. This is the first triangle that points in the same direction. Including the party's triangle, this is a total of 16 triangles. If you roll a 20, say, or a 17, 18, 19, or 20, this can be interpreted as "our triangle is special in this supertriangle." In other words, that the next triangle should be different.

Just a thought. More work needed on this, probably.

The scale of the terrain can be a foot, which is probably too small, or can be sixteen feet, or 128 feet, or half a mile or even several miles. An entire triangular tile could be all "grassland" or "forest" but as the party moves into it, the smaller tiles are revealed to be of different, or more specific, composition.

Summary & Conclusions 

I think at this point the next step may be to run some actual virtual campaigns and generate the terrain as the party goes forward. I think I want to write some campaigns as scripts, and do a play by play of the characters' actions and the terrain, and so forth.

Addendum 

A good approach might be to recognize that every triangular space is at the center of three intersecting hexagons each made up of five other triangles. Terrain changes could be based on these three hexagons, eg, one direction leads to forest 🌳 and the two others to grassland. More on this later. 



___________________________

FOOTNOTES

(1) The tiling level is the power of two.

No comments:

Post a Comment