Infinite Wilderness -- phase 1 to phase 2

All new ideas for the upcoming releases of ToME 4.x.x should be discussed here

Moderator: Moderator

Post Reply
Message
Author
asthmatic_thematic
Higher
Posts: 79
Joined: Tue Aug 19, 2008 7:15 pm

Infinite Wilderness -- phase 1 to phase 2

#1 Post by asthmatic_thematic »

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.
Screen shot 2011-03-11 at 1.20.22 AM.png
Screen shot 2011-03-11 at 1.20.22 AM.png (192.56 KiB) Viewed 1298 times
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.
Screen shot 2011-03-11 at 1.18.24 AM.png
Screen shot 2011-03-11 at 1.18.24 AM.png (70.97 KiB) Viewed 1298 times
Last edited by asthmatic_thematic on Fri Mar 11, 2011 1:47 am, edited 1 time in total.

asthmatic_thematic
Higher
Posts: 79
Joined: Tue Aug 19, 2008 7:15 pm

Re: Infinite Wilderness -- phase 1 to phase 2

#2 Post by asthmatic_thematic »

Next pictures. The authority map: this is after about 1000 years of fighting. The civs are all different colors--there are eight of them. They happen to be, in order from zero, of type: plains, plains, deepwater, plains, plains, mountains, woods, and desert. There are two odd spots of civ 1 that are projecting into civ 0: those are fortifications which have been cut off from civ 1's main territory, but are too strong to be conquered even so. Civ 2, deepwater, has also claimed some rivers extending into other territory, and deepwater civs also try to claim shores. The elf civ in the woody valley is #6, sort of puke orange. Civ 3 is plains, and you can see it doesn't control the big lake in the middle of it (no one does). Each civ has a strength associated with it, which is why some lay claim to more territory than others. (The mountain civ is pretty weak.)
Screen shot 2011-03-11 at 1.18.38 AM.png
Screen shot 2011-03-11 at 1.18.38 AM.png (28.4 KiB) Viewed 1295 times
Finally, sites. Here, "H" means it's the home or capitol. The number is the civ #. And the size of the site is done by symbol for this map, in ascending order of : ; - + * %. If a site has been destroyed, it's shown as _. A ghost town, or site abandoned due to fighting, is shown as o. (But there aren't any here--they're either intact, or reduced to rubble.) You can see #6, the elves, had only one city outside their valley--and it got destroyed by the plains civ to the east. The desert civ, yellow in the south, owns some of the hills in a sort of arc, but can't hold on to the plain. They're protected from the plains civ #3 by mountains separating them along the east. That plains civ has a fort overlooking the elf valley--they'd better look out.
Screen shot 2011-03-11 at 1.18.51 AM.png
Screen shot 2011-03-11 at 1.18.51 AM.png (15.28 KiB) Viewed 1295 times
I'm not claiming I have the best viewing method of all time--but I get gnuplot to make these all overlaying, then I can flip back and forth and see what is going on.
Last edited by asthmatic_thematic on Fri Mar 11, 2011 2:17 am, edited 1 time in total.

asthmatic_thematic
Higher
Posts: 79
Joined: Tue Aug 19, 2008 7:15 pm

Re: Infinite Wilderness -- phase 1 to phase 2

#3 Post by asthmatic_thematic »

There are a lot of other doodads for the code. Some sites are placed strategically (roughly midway between home capitol and nearest or second-nearest enemy capitol) and some are placed randomly. There can be alliances (although I've turned them off, as they are somewhat boring), and there are attempts to connect sites that have been cut off. (Pathfind between the site and the nearest friendly connected site; increase the authority along that path, and hope you can keep from getting cut off again). Etc. There are also annoying features: often a civ will claim a much larger territory than it can remain connected to. The far extent of that territory, if it's not claimed by any other civ, and thus not fought over, remains owned, and looks odd. You can see that in civ 0 above. I am thinking of running a segmenter to label connected components, and, if a representative is disconnected from any friendly site, to wipe out that area (or maybe turn it into a new allied derivative civ?). But connected component labellers are a bit of a pain, and in any event I need to update my A* to use &functions as arguments, rather than having a semi-hardwired walkability terrain function.

I will be putting the C code which generates this up on sourceforge soon--I just made an account.

The immediate goal is to just turn these plots into a simple module. Some of the innards of the module files will get generated in part by the output of the C code. Then one can wander around and hack and slash at the sites. At the bottom of each will be a unique. Nothing else for this very moment--but I think this has a lot of long-term possibility. I think of this as potentially adding overall new structural possibilities to T4, rather than developing new classes or adding more items, etc. This might give classes more things to do.

asthmatic_thematic
Higher
Posts: 79
Joined: Tue Aug 19, 2008 7:15 pm

Re: Infinite Wilderness -- phase 1 to phase 2

#4 Post by asthmatic_thematic »

So here's my plan. There will be three parts. First, get a module up and working by manually cutting and pasting important data. Second, use the genworld.c program, along with a bash shell, to write important files automatically. Finally, try to rig up a lua system for doing this, once I understand the basic process using bash and as I get to know lua better.

First I copied the tome module folder to a new module folder infiwild, since so much is going to stay the same for now (eg, I'll be using all the same classes, artifacts, and so forth for now).

So let's say I wanted to use the data from the previous posts in a module, in this copied folder. Basically, I need to change the wilderness map and the particular sites.

For right now, I'll assume all sites are, say, Daikara-type sites, and that there are twenty five or so civ sites spread over 8 civilizations. To change the sites, I need to go to data/zones, and make twenty-five or so copies of the Daikara folder, labelled daikara0-0 to daikara7-4, where the first number is the civ it belongs to, and the second is the index of the site within that civ (so civilization seven has five sites, starting from 0). (Eventually this will look like civ3-2, and not be related to Daikara at all.)

I can actually leave everything intact inside this plethora of folders except a couple of things: change Rantha to Rantha0-0 etc. in the file zone.lua under "guardian," and change the zone name from "Daikara" to "Daikara0-0", and change "newEntity" under NPCs to Rantha0-0 etc. (I might also need to delete the backup boss, and the lore.) So now I have twenty five Daikaras, and twenty five Ranthas. (Think of the loot!) They need to be put on the map, now.

Head to zone/wilderness. First, we'll leave the name eyal in place, since it might appear in a lot of other areas (eg exits from other zones). But we'll need to change zone/wilderness/zone.lua to reflect the new map height and width of 256x256. Second, in data/maps/wilderness/eyal.lua, delete the addspot and addzone sections--these are only for exciting or changeable encounters, not static map sites, so all zonenames and world-encounters post-processing can go, for now. Third, add twenty five new quickEntities in eyal.lua. We can leave 'Daikara' alone--it's just a terrain type of mountains. But we need to replace the single quickentity 'daikara' with tons more, daikara0-0 to daikara7-4, with the corresponding change_zone "daikara0-0" etc., which links it up to the folders we created above. Next, replace the ascii map section with my map, in lua format--ie convert my terraintypes array to [[~]] and so forth. Finally, where do we put the daikara clones? My settlement list is a list of numbers {x, y, civ, settlement}. So I run through this list, and replace the particular [[^]] element at (x,y) with [[daikara0-0]] for each civ/settlement combo. (There are pathing issues here, but I have simple plans for that.)

So now we have a completely moronic Rantha-focused mod. Provided one makes @ start on the worldmap (since trollmire is no more!), one should be able to wander around killing Ranthas.

Is this the proper procedure? What am I missing? If this is fairly accurate, then it shouldn't be hard to automate this using c and bash to include a wider variety of things than just daikaras. I just tried this with one duplicate Daikara--I put a Daikara-2 right next to the original. I didn't get down to the final level to verify there's a Rantha-2, but everything else seemed normal, with just two entrances beside each other, with apparently duplicate content.

Post Reply