Skip to main content

User login

What is OpenID?
  • Log in using OpenID
  • Cancel OpenID login
  • Create new account
  • Request new password
Register
  • Home
  • Browse
    • 2D Art
    • 3D Art
    • Concept Art
    • Textures
    • Music
    • Sound Effects
    • Documents
    • Featured Tutorials
  • Submit Art
  • Collect
    • My Collections
    • Art Collections
  • Forums
  • FAQ
  • Leaderboards
    • All Time
      • Total Points
      • Comments
      • Favorites (All)
      • Favorites (2D)
      • Favorites (3D)
      • Favorites (Concept Art)
      • Favorites (Music)
      • Favorites (Sound)
      • Favorites (Textures)
    • Weekly
      • Total Points
      • Comments
      • Favorites (All)
      • Favorites (2D)
      • Favorites (3D)
      • Favorites (Concept Art)
      • Favorites (Music)
      • Favorites (Sound)
      • Favorites (Textures)
  • ❤ Donate
Programming

OSARE map generator?

bart
Thursday, November 4, 2010 - 11:55
bart's picture

Hey Clint, didn't you mention somewhere that there's a random map generator for OSARE?  How's it working out thus far, and what language is it written in?

Bart

 

  • Log in or register to post comments
Clint Bellanger
joined 15 years 10 months ago
Thursday, November 4, 2010 - 12:01
Clint Bellanger's picture

Written by OGA user Tartos in Python.

See info in this thread: http://opengameart.org/forumtopic/osare-v010-released

It's interesting so far.  He's got it currently generating a 5-level deep dungeon.

From a rough perusal of the code, the general algorithm is like this:

  • create rooms with a random position, width, height
  • keep adding or enlarging rooms until there's a good amount of walkable area
  • for every 2x2 combination of walls|floors, have a list of acceptable tiles.  This handles proper concave/convex corners as well as wall options.
  • sprinkle in monsters, treasure chests

I'll ask Tartos if he can stop by and talk about his algorithm in-depth.

  • Log in or register to post comments
Tartos
joined 14 years 10 months ago
Thursday, November 4, 2010 - 12:30

Hi,

Clint has summarized it well, so I have nothing more to say :D. Here is the algorithm:

- I use a matrice with integers to generate the map. 0 for full wall, 1 for full ground and -1 for undefined. At initialization, the matrice is filled with 0. Numbers from 2 to 15 corresponds to tiles with ground and wall.

- Create X rooms with a random position, width = 3, height=3

- Keep enlarging rooms in the 4 directions. When a room meet another room, stop enlarging it.

- Remove impossible patterns : cells are put to -1 according to neighborhood conditions (e.g. 0 near 1)

- Replace all -1 with number from 0 to 15 according some rules. Using sets here to simplify the task. When the background layer is written, tiles of the corresponding class (among the 16) are taken at random

- The starting point is put as far as possible from the center of the map. The exit is put as far as possible of the entrance : usually the entrance is in a corner and the exit at the opposite corner.

 

What else do you want to know ? :)

  • Log in or register to post comments
Luke.RUSTLTD
joined 14 years 9 months ago
Friday, November 5, 2010 - 13:15

This is really cool. I just recently downloaded OSARE and while playing I thought: "How difficult would it be to procedurally generate randomized levels."

I am looking forward to seeing this in action.

  • Log in or register to post comments
Tartos
joined 14 years 10 months ago
Tuesday, November 9, 2010 - 06:17

I was playing with Clint's town tileset. Here is the result with the same algorithm that the one I used for dungeons.

 

It needs some improvement as there is no diversity for roofs. For the moment I see two kinds of algorithm :

- Have some classes (e.g. grass, water, roof) and define the rules for the transitions between those tiles. For the house's tile, this would involve the creation of a third class, and define the transition between this third class and the two first (or only the second).

- Have a biased random walker (the bias is for closing houses) and define the tiles that can be used to go from one tile to another neighbor.

The first solution could be used to generate dungeons with void though.

  • Log in or register to post comments