Subject: Re: Swamps, forests and other open locations From: bear@sonic.net Group: rec.games.roguelike.development Date: Fri, 23 May 2003 06:21:56 GMT DarkGod wrote: > > The Sat, 10 May 2003 00:28:24 +0200, after eating far too many mushrooms > of confusion Tomasz "Warui" Nowakowski wrote: > > > If you venture deeper into the forest you will nastier monsters ;) > > > > I would connect different forest areas using exit grids on the edges of > > maps (remember fallout ? :) ). You enter such grid and you move to another > > location. The farer you get from the entrance area the worst enemies you > > find, and better treasures. > > > > example (x - exit): > > > > TTTTTTTTT > > TT....TTT > > T..TT.@.T > > ..TTTT..x > > TTT.....x > > TT....TTT > > Thats what ToME does for forests and other flat places. > it places "ways to to text area" at the level edges I use several deterministic functions to build dungeons, and part of the whole deal is the "stairway generator". It's a deterministic function, which is initialized with a seed that stays constant throughout the game, and then "perturbed" using the current dungeon level to generate the coordinates of staircases down. You can do the same thing with the level minus one, and that will give you the coordinates of stairways up (when you go down stairs, your xy coordinates in the map don't change). Anyway, this wilderness thread got me thinking, that you could use the same kind of approach with wilderness. The staircase generator is basically a connection function, which is upward staircases for one level and downward staircases for another. But you could just as easily have a "connectivity generator" that would define eastern edge connectivity of one map square or western-edge connectivity of the one just east of it. Your map generator would then start with the connectivity on its edges, and fill in the gaps from there in some way that's also repeatable, so you could generate arbitrary map squares that fit together perfectly. With the classic dungeon thing, we don't really need more than one map segment in memory at a time, but if you want the player to be able to move around randomly in the wilderness, you could just use four screen-sized map segments at a time: where X is the actual screen, and the maps are a, b, c, and d, you'd have this situation: a a a a a a a b b b b b b b a a a a a a a b b b b b b b a a a a a a a b b b b b b b a a a a a a a b b b b b b b a a a a a a a b b b b b b b a a aXaXaXaXaXbXbXb b b b b c c cXcXcXcXcXdXdXd d d d d c c cXcXcXcXcXdXdXd d d d d c c cXcXcXcXcXdXdXd d d d d c c cXcXcXcXcXdXdXd d d d d c c c c c c c d d d d d d d You could always keep the character at the center of the screen if you wanted to; if you go far enough up that you need new screens north of a and b, it means you're far enough up that you don't need c and d anymore. Same thing happens if the player srolls down or left or right, just different map segments get recycled. So... To do wilderness, you'd first develop a function that tells you which squares on the borders of any two adjacent map sections connect, which could be pretty arbitrary, 'cause you'd just seed it with the map coordinates. Another few functions to tell basic information about different segments, like "terrain type" or "toughness" or whatever that would affect what needed to be generated there by some algorithm that made a plausible large-scale map. Then you'd develop a map segment generator that took the border connections and terrain information as parameters and used the coordinates for a random seed, and made up a plausible map segment connected at those borders and having that terrain type and approximate toughness. The player would never need to know you're not actually holding an infinitely vast 2D map in memory. Bear