Infinite Wilderness -- phase 1 to phase 2
Posted: Fri Mar 11, 2011 1:35 am
The code which generates wilderness areas, civilizations, and sites is done, at least for now, although there are a lot of possible improvements. A sample is shown below. The current code makes a wilderness, creates civilizations, places their sites, and then has them fight over disputed territory. Civilizations are classified by their capitols as, e.g., plains civs, hill civs, river civs, etc. Civilization sites which fall into enemy hands are destroyed (in some modes they can be taken over, reduced to rubble, etc.) Civilizations which have their capitol captured will try to move it; if they fail, the civilization is destroyed (although it still may control small territories and any remaining sites).
The next part, phase 2, is taking the output of this program, and generating T4 module code. I've been reviewing the module structure of T4, and while I have a basic handle on things, I may need some help. Phase 2 will be somewhat simplistic: here is what it will do.
(A) associate civilizations with their type
(B) output the site list, and generate dungeons, towns, or castles based on it
(C) generate the wilderness file using the wilderness map and the site list
On part (A), phase 2 will just associate the 12 types of terrain-civilizations with an already existing race/monster type, or make very simple additions. I want to do as little coding on this as possible for now.
0: deepwater: psyrens (?)
1: plains: humans
2: desert: sandmen
3: woods: weak elves
4: hills: dwarves
5: tundra: weak snow giants
6: scorching: strong sandmen
7: forest: strong elves
8: mountain: trolls
9: glacier: strong snow giants
10: peak: rock giants
11: site (not used)
12: freshwater: weak psyrens (?)
If a civilization is destroyed, all its members will just be turned to generic undead for now. If a site is destroyed, people in it will be set to outlaws/bandits/etc for now.
On (B), I plan to use as much as possible current dungeons associated with the above types. Elves will use Old Forest type code, hills-mtns-glaciers will for now just look like Daikara, etc. As a first pass, I might just use the sandworm lair for sandy sites, and so forth. For now, I think the capitols will be just single-level static towns.
On (C), I'll just use the typical map generator for T4, using the sites and such, and using a static map taken from the wilderness map. I plan on making the wilderness map fairly large--probably 256x256, so it's fun to explore around--if memory can easily handle this.
---
This by itself is pretty basic. It would just be about 20 dungeons or so, scattered about a big beautiful map: just hack and slash. (Yay!) The next steps would be the following. Code up some more specific monsters and more specific dungeons. Make structured towns & castle-types, depending on civ type. Add in unique monsters (leaders of civs), along with their artifacts. Add monster generators so baddies are spawned on the worldmap, and move to attack enemy civs (or @).
Finally, I would like to make the civilization struggle dynamic. That is, the civ code currently has a dynamic year-by-year function which incrementally puts into effect issues like, for example, the current strength of the civilization (which affects its territorial reach) and the resisting force of a castle and such. But all this just happens inside the C code, and gets spit out at the end as a final product. I'd like to be able to run certain changes in real time, so that @'s actions like destroying a castle affect the dynamics on the map. If the player weakens a civ, it will lose territory, and might be eventually destroyed. This would require much much more Lua-fication; currently I am just using C code generation to make Lua input files, and making the phase 2 module is just a more advanced version of this.
---
Some sample plots. The code now runs in about fifteen seconds (which seems annoyingly slow). I've taught gnuplot to make things the same size, and make several plots, so just flipping cmnd-` let's me cycle through them.
(I'll have to split this up into two posts, since there's a limit of three pictures per post.)
First, the typical elevation plot. Rivers and lakes are in false yellow. Not that it matters, but the rivers are formed from springs (which start at moderate elevation and seek the ocean or make a lake) and anti-springs (which start in the ocean, and seek high elevations, making a lake at the highest point). Just thought you should know.
Second, the terrain feature plot. This is hard to read unless you know what you're looking for. White is ocean; except where I've made mountain peaks white, too: you can tell it's a peak when it's white surrounded by light purple (which is mountains--dark purple is hills). Black is plains. Yellow is desert; except for way down south, where there are scorching deserts that are sort of speckled purple. Woods are maroon, and forests are brighter red (forests occur in the heart of woods, or where there is a lot of wetness, eg in a rainy area, or near a river). There's a nice valley in the middle with a saltwater lake and some good woods and forests, and an exit from the valley to the east. (It turns out there's a elf civilization in the valley.) Glaciers are up north, and are also purple, and hang down from the top of the map, esp at high elevations. There's a free standing glacier at the top of a mountain too, with a glacier river that flows down into a lower-elevation glacier. The border of glaciers is usually tundra, but you can't much see it here, because it's also kind of purplish. (Too much purple!) There's also a mountain top lake to the NW with a neat triple river coming out of it.
The next part, phase 2, is taking the output of this program, and generating T4 module code. I've been reviewing the module structure of T4, and while I have a basic handle on things, I may need some help. Phase 2 will be somewhat simplistic: here is what it will do.
(A) associate civilizations with their type
(B) output the site list, and generate dungeons, towns, or castles based on it
(C) generate the wilderness file using the wilderness map and the site list
On part (A), phase 2 will just associate the 12 types of terrain-civilizations with an already existing race/monster type, or make very simple additions. I want to do as little coding on this as possible for now.
0: deepwater: psyrens (?)
1: plains: humans
2: desert: sandmen
3: woods: weak elves
4: hills: dwarves
5: tundra: weak snow giants
6: scorching: strong sandmen
7: forest: strong elves
8: mountain: trolls
9: glacier: strong snow giants
10: peak: rock giants
11: site (not used)
12: freshwater: weak psyrens (?)
If a civilization is destroyed, all its members will just be turned to generic undead for now. If a site is destroyed, people in it will be set to outlaws/bandits/etc for now.
On (B), I plan to use as much as possible current dungeons associated with the above types. Elves will use Old Forest type code, hills-mtns-glaciers will for now just look like Daikara, etc. As a first pass, I might just use the sandworm lair for sandy sites, and so forth. For now, I think the capitols will be just single-level static towns.
On (C), I'll just use the typical map generator for T4, using the sites and such, and using a static map taken from the wilderness map. I plan on making the wilderness map fairly large--probably 256x256, so it's fun to explore around--if memory can easily handle this.
---
This by itself is pretty basic. It would just be about 20 dungeons or so, scattered about a big beautiful map: just hack and slash. (Yay!) The next steps would be the following. Code up some more specific monsters and more specific dungeons. Make structured towns & castle-types, depending on civ type. Add in unique monsters (leaders of civs), along with their artifacts. Add monster generators so baddies are spawned on the worldmap, and move to attack enemy civs (or @).
Finally, I would like to make the civilization struggle dynamic. That is, the civ code currently has a dynamic year-by-year function which incrementally puts into effect issues like, for example, the current strength of the civilization (which affects its territorial reach) and the resisting force of a castle and such. But all this just happens inside the C code, and gets spit out at the end as a final product. I'd like to be able to run certain changes in real time, so that @'s actions like destroying a castle affect the dynamics on the map. If the player weakens a civ, it will lose territory, and might be eventually destroyed. This would require much much more Lua-fication; currently I am just using C code generation to make Lua input files, and making the phase 2 module is just a more advanced version of this.
---
Some sample plots. The code now runs in about fifteen seconds (which seems annoyingly slow). I've taught gnuplot to make things the same size, and make several plots, so just flipping cmnd-` let's me cycle through them.
(I'll have to split this up into two posts, since there's a limit of three pictures per post.)
First, the typical elevation plot. Rivers and lakes are in false yellow. Not that it matters, but the rivers are formed from springs (which start at moderate elevation and seek the ocean or make a lake) and anti-springs (which start in the ocean, and seek high elevations, making a lake at the highest point). Just thought you should know.
Second, the terrain feature plot. This is hard to read unless you know what you're looking for. White is ocean; except where I've made mountain peaks white, too: you can tell it's a peak when it's white surrounded by light purple (which is mountains--dark purple is hills). Black is plains. Yellow is desert; except for way down south, where there are scorching deserts that are sort of speckled purple. Woods are maroon, and forests are brighter red (forests occur in the heart of woods, or where there is a lot of wetness, eg in a rainy area, or near a river). There's a nice valley in the middle with a saltwater lake and some good woods and forests, and an exit from the valley to the east. (It turns out there's a elf civilization in the valley.) Glaciers are up north, and are also purple, and hang down from the top of the map, esp at high elevations. There's a free standing glacier at the top of a mountain too, with a glacier river that flows down into a lower-elevation glacier. The border of glaciers is usually tundra, but you can't much see it here, because it's also kind of purplish. (Too much purple!) There's also a mountain top lake to the NW with a neat triple river coming out of it.