Jump to content
  • Advertisement
Sign in to follow this  
suliman

Randomize small maps for 2D-RPG? Rooms etc

This topic is 965 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi

Im doing a topdown 2D-rpg similar to fallout, stalker with a view similar to zelda: a link to the past. At least the maps are tile-based with enterable houses (walls are one tile thick).

 

You travel on a map and can enter locations: first time you visit a location it is created semi-randomly (the seed is stored so it can be recreated on next visit).

 

The idea is like this:

A location concists of 4x4 (or whatever) section. Each section is picked from a large collection of handmade section. A section might have none to two houses/rooms and maybe other features. They are then randomly rotated, mirrored (and gets a random look of the walls, floors, cealings as well) and placed in the 4x4 grid. These together form a location.

 

Would this work? Would the "maps" look boring and unnatural? Any other ideas or examples of how this can be achieved?

Thanks!
Erik

Share this post


Link to post
Share on other sites
Advertisement

I always felt like half of the success of A Link to the Past was its level design, how everything was finely crafted together. I felt the Binding of Isaac lacked this critical feature and made for a much lesser game as a result.

I think that by creating 'easy replay value', you're also lessening your core value. That's a trade I'm unwilling to make, and from the above question, you seem to be aware of the cost involved.

Share this post


Link to post
Share on other sites

Yeah but i cannot have premade maps, the game works sort of like a rougelike. So i need to find the least bad solution for generating maps!

Share this post


Link to post
Share on other sites

Depending on the environment type, arranging pre-made objects of various sizes in a large empty environment might be simpler and/or more effective than matching edge types of Wang tiles (which are subject to combinatorial explosion, usually causing uncanny regular structures due to not supporting a large part of the plausible edge types). For example:

  • For a JRPG-style village, start with grass and place entrances around the border and prefab houses in the middle, then build pathways between houses, a fence around the whole village, trees or rocks outside the fence, etc.
  • For a city, place horizontal and vertical roads at random positions, then fill each rectangular space between them with a combination of buildings, alleys, empty space, etc. of the appropriate size.
    Irregular slack between buildings can be added to gardens and courtyards and fenced procedurally.
    Adjacent blocks could be merged, removing the intervening road segment, to add variety (very large buildings, parks, squares, etc.) or large blocks could be split into sub-blocks independently, even recursively one road at a time, for a more medieval look.

Share this post


Link to post
Share on other sites

Good ideas.

I also start to think maybe its better to make premade "houses/rooms/map features" of varying size (lets say from 10x10 tiles to 50x50 tiles) and place these rotated/mirrored freely on the map (200x200 tiles) until map is "full enough" insetad of placing premade mapsections (50x50 tiles) in a rigid 4x4 grid of mapsections.

 

This would mean a more fluid/natural map (village/base/wilderness) layout i think.

Share this post


Link to post
Share on other sites

For manmade places especially, it might be worth thinking of the problem in terms of a "place grammar" that describes how places can possibly nest inside each other and a corresponding set of functions that can generate random "sentences" (that is, places) that fit this grammar.  This can render both of your ideas compatible, so you can use each when they have the right results.

 

So for a simple example, suppose you have a plot within a town that's 20 by 30.  And you call fillRandomPlot(x,y,20,30) which might randomly choose:

  • fillWithFence(x,y,20,30), which places a fence and then calls fillRandomPlot(x+2, x+2, 16, 26) to place something inside the fence
  • fillWithYard(x,y,20,30), which makes a nice "front yard" of no more than a third of the plot, and then calls fillRandomPlot on the remaining space.
  • splitVertically(x,y,20,30) which splits the area vertically, somewhere roughly in the middle, with just plain grass, and then calls fillRandomPlot on each remaining piece.
  • fillWithBuilding(x,y, 20, 30), which draws exterior walls and then starts calling fillRandomRoom...
The actual complexity of your place grammar would be higher, of course, but you get the basic idea.  You have a variety of recursive functions at each scale (from setting neighborhoods within a big city to setting furniture within a room), some of which place actual tiles in the tilemap, some of which semi-randomly choose an appropriate delegate function that can fill a subspace of a particular size with something of the appropriate scale/size/density/use, and some of which do both.  Some of them will need to systematically "waste" space so that you don't look like you have a 100%-full rectangular city in the middle of an empty grassland :)
 
Anyway, that might give you a framework to hang your ideas in.  The placement functions (on grids or placing things loosely) would just be functions, among many possible functions, that fill space.  There's lots of ways to fill space, and you can do them all and them mess with the probabilities until it looks least artificial.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!