Skip to main content
User login
OpenID
What is OpenID?
Username or e-mail
*
Password
*
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
Search Terms
FLARE [ARCHIVED]
random map generator
ervinzed
Friday, May 17, 2013 - 11:09
is it possible to create a random map generator?
Anything is possible if you believe in yourself!
Random map generation isn't part of the goal for Flare 1.0 but maybe it will be for later versions. I also do want to try pseudo-random maps: e.g. making four versions of each map so that most playthroughs will have a different feel
It would be pretty cool to have some random generated dungeons in flare!
I'm not 100% sure with the following info, so everyone is welcome to correct me :)
the maps can be accessed by simply opening the coresponding text files in \mods\alpha_demo\maps
e.g. the starting map in the current alpha, "Frontier Outpost" is frontier_outpost.txt
In this file, under [layer] you'll find the map structure (this giant list of numbers beginning with 0,0,0,....). Those numbers represent the 2D map for Frontier Outpost. I think it's simply rotated 45° clockwise ingame.
The "background" layer contains the noninteractive graphics, "object" layer interactive objects and "collision" tells the player if he can enter this tile.
From there you can use one of the many dungeon algorithms to begin with ( e.g. http://www.roguebasin.roguelikedevelopment.org/index.php?title=Dungeon-Building_Algorithm ).
As there are three layers in Flare you'd have to create three maps as output. And I'm not sure about the collision layer. There seem to be at least 5 collision states (0 to 4), so it's probably not just "go" and "nogo".
edit: see also Map Files - Flare Wiki
Here's my feelings on randomly generated maps: they are an easy way to add endless replayability at the expense of final polish.
My favorite thing in games is exploring a well-thought out world where the locations are quite distinct. I've been playing Half Life lately and I get a kick every time I look at an area I can't get to and later find myself looking back from that area at the place I stood a level (or more) ago.
Don't get me wrong, a polished-feeling random map isn't impossible - Blizzard did well in Diablo 3 using macrotiles. (Though I still get bored of the maps in that game.)
Okay, now that I'm done explaining why I don't like random dungeons... I actually would really love a random dungeon generator feature. I think it wouldn't be hard at all to adapt a randomly generated map from the above-mentioned algorithm to Flare. If someone wanted to do it, I can definitely teach them how to use the Flare map format.
I think I remember that in the Diablo 2 not randomly generated maps, but had the same map made in various ways, and then He selected randomly 1 for example:
Durance of Hate Level 1-1
Durance of Hate Level 1-2
Durance of Hate Level 1-3
Durance of Hate Level 1-4
Durance of Hate Level 1-5
It generates a random number from 1 to 5, the number that decides which map out Durance of Hate Level 1 is loaded in the game.
Obviously would have many types of map, but I remember that on more than one occasion I've run into the same map (same structure)
I did a pretty basic map generator and added some kind of "wall tile recognition". Still very rough around the edges, but s.th. like this should work fine within Flare:
http://pastebin.com/hkZZ5MXq
That looks great :) Personally I really like the second image in that pastebin.
My approach would be this:
This part can easily be done via porting the Automapping of Tiled to flare. See https://github.com/bjorn/tiled/wiki/Automapping for an overview of Automapping
This would split up the abstract layout of the map from the very tileset-specific informations, such as tile ids.
So the generation algorithm 'only' needs to cover the intelligent creation of rooms and interconnections of those.
Also the current maps of flare-game are using the Automapping feature already quite extensively (i.e. the rules how to transform schematic to the actual layers is already there)
I might be a little biased as I was the author of the Automapping feature of tiled, but I think splitting it up reduces complexity. Also the proper generation of the schematic is quite a challenging task, so it's best if we concentratte on only setting up a schematic there.
I started porting the Automapping to flare (plain c++, removing Qt as dependency, ripping off tiled specific things, such as undo/redo, tileset management), it can be found at https://github.com/stefanbeller/flare-engine/tree/randommapgeneration
Maybe you can get some inspiration from that or focus more on the schematic generation.
I for one am a huge fan of procedurally generated content.
I recently completed the foundation of randomly generated dungeons in one of my projects.
Although I still have bigger plans for them, like random loot, doors, stairs etc...
I think for some instances like town maps, or maps of significance are best designed by hand, but for a nice deep cave or multi level dungeon, sometimes a well generated dungeon is good for replayability.
You could save the seed for the randomly generated map, so maps are only randomly generated once per game.
I think implementing a random map generator for Flare could be pretty straightforward, the only issue I can forsee is figuring out Flare's custom map format. Its been a year or two since I last looked at the map format for Flare....
Can't seem to find a definition of the map format on the Flare website, nor on the github wiki. :(
Here is a link to my attempts at a random dungeon genoration, notice I am using Clint's awesome tilesets! ;) The code is open source, but I instead use the TMX map file format though.
http://physhexgames.weebly.com/1/post/2013/05/random-map-generation.html
If you want to play with the source, you can find the code for it here in the source/core/ folder.
https://github.com/Paul-Wortmann/Frost_and_Flame
fyi, just stumbled upon an older flare thread:
http://opengameart.org/content/random-dungeons
I also think adding some random dungeon levels would really benefit Flare-game.
some ideas come to my mind:
I think variety is really important for a successful hack n slash. There could be mazes, random rooms, random arrangements of fixed architecture, hybrids etc. But of course all these things need to be used wisely. A too simple dungeon generation will bore very fast
@Stefan: Your approach sounds good. Some details:
Hmmm... correct me if I'm wrong, but it sounds like you could take a schematic and generate any number of areas with it simply by using a different tileset? So it could be a cave where the paths are tunnels or a swamp where the paths are the only dry land or a city where the paths are roads between the buildings. If you pick a tileset that looks sufficiently different, it will not be immediately obvious that it uses the same schematic.
Especially if you also rotate it 90 degrees.
So reuse of schematics sounds like a fast way to increase the number of areas in the game.
As to the original post, a map generator (random or otherwise) sounds like a class instance to me rather than a set mod file format. How difficult would it be to put the class name in the mod file and have the engine run that class when it needs the info?
Pur
P.S. A perfect example of a need for a "random map generator" is a forest-fire zone. Each time you enter, different trees are on fire, forcing you to find the path that will get you safely through.