Author Topic: Need some Help with small Maps  (Read 11814 times)

jasonpickering

  • Rogueliker
  • ***
  • Posts: 274
  • Karma: +0/-0
    • View Profile
    • Email
Need some Help with small Maps
« on: November 28, 2012, 03:17:27 AM »
Hey guys so I am trying to figure out a way to build pretty small maps, but still get some curves and pillars in them.

My level is basically 10x8 tiles with a tile border around it. I want an entrance on the left and an entrance on the right. A good example might be something similar to Zaga-33 levels. I have no problem building rooms that are all connected, but I dig them out similar to caves. My current Process is

1. Start with a map of walls
OOOOOOOOOO
OOOOOOOOOO
OOOOOOOOOO
OOOOOOOOOO
OOOOOOOOOO

2. Pick entrance and Exit
OOOOOOOOOO
OOOOOOOOO#
OOOOOOOOOO
#OOOOOOOOO
OOOOOOOOOO

3. Pick Center and connect there
OOOOOOOOOO
OOOOOO####
OOOOOO#OOO
#######OOO
OOOOOOOOOO

4. Dig out surrounding area
OOOOOOOOOO
OO#O#O####
OO######OO
#######OOO
OOOOOOOOOO

so this was the basic thing I used before and although it gives nice caves and always has connections, It doesnt have a lot of pillars which I was thinking might be nice for a more strategic combat. I am not a great programmer and I am using my usual Flash, so Any basic steps I could take to maybe fix this?

Maybe Locking certain Walls that are next to the original Path, so they can not be dug out?

kraflab

  • Rogueliker
  • ***
  • Posts: 454
  • Karma: +0/-0
    • View Profile
    • kraflab.com
Re: Need some Help with small Maps
« Reply #1 on: November 28, 2012, 03:52:44 AM »
Use cellular automata and make sure the end result is still connected.  I believe there is a descriptive article about it on the wiki.

Alex E

  • Rogueliker
  • ***
  • Posts: 118
  • Karma: +0/-0
    • View Profile
    • Email
Re: Need some Help with small Maps
« Reply #2 on: November 28, 2012, 06:27:34 AM »
For some simple, randomly placed pillars, I would probably search through all of the floor tiles in the map first. If it finds any floor tiles with 7 or 8 other adjacent floor tiles, it will make the middle floor tile a pillar.

For example....

OOOOOOOO
OO###OOO
OO######
#####OOO
OOOOOOOO

...will become...

OOOOOOOO
OO###OOO
OO#O####  <-the floor tile in the center of the 3x3 area of floor tiles becomes a wall/pillar.
#####OOO
OOOOOOOO

kraflab

  • Rogueliker
  • ***
  • Posts: 454
  • Karma: +0/-0
    • View Profile
    • kraflab.com
Re: Need some Help with small Maps
« Reply #3 on: November 28, 2012, 07:00:13 AM »
For some simple, randomly placed pillars, I would probably search through all of the floor tiles in the map first. If it finds any floor tiles with 7 or 8 other adjacent floor tiles, it will make the middle floor tile a pillar.

For example....

OOOOOOOO
OO###OOO
OO######
#####OOO
OOOOOOOO

...will become...

OOOOOOOO
OO###OOO
OO#O####  <-the floor tile in the center of the 3x3 area of floor tiles becomes a wall/pillar.
#####OOO
OOOOOOOO

Cellular Automata! ;)

jasonpickering

  • Rogueliker
  • ***
  • Posts: 274
  • Karma: +0/-0
    • View Profile
    • Email
Re: Need some Help with small Maps
« Reply #4 on: November 28, 2012, 03:39:34 PM »
thanks Mosenzov, that makes sense. sorry Kraflab I do not really understand Cellular Automata! you might as well just be saying MATH!. I don't really know what defines something as Cellular Automata. I think maybe one of these days I want to write an article about all those Dungeon generation techniques, but like an Idiots guide to them. Something to get people started when they are first trying their hand at Roguelikes.
« Last Edit: November 28, 2012, 03:53:10 PM by jasonpickering »

requerent

  • Rogueliker
  • ***
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: Need some Help with small Maps
« Reply #5 on: November 28, 2012, 05:10:25 PM »
You may want to check out Conyway's Game of Life if you're even just a little curious.

http://www.bitstorm.org/gameoflife/

It's a simple idea to grasp once you see what it does. Given some starting configuration of cells and a set of rules, you can simulate those rules as a function of discrete time (or not, I guess) until some desirable criteria is met.


Coming up with the functions/rules that govern your cells isn't a simple task, but you can get really beautiful and unexpected results.

If you get really interested in getting ants to build your maps, you can pseudo-randomly generate rules/starting configurations- simulate, and then have an evaluation function determine how desirable the map is. Then you could probably go the genetic route and have maps that score highly create new generations that are permutations of high-scoring rules (though you need to upcycle 'bad' rules to prevent reaching a plateau or equilibrium where there is no 'evolution').

Ultimately it just becomes fun to think about unless you're really passionate about the study, but knowing how it works can be very useful to solve a number of problems.

kraflab

  • Rogueliker
  • ***
  • Posts: 454
  • Karma: +0/-0
    • View Profile
    • kraflab.com
Re: Need some Help with small Maps
« Reply #6 on: November 28, 2012, 11:01:49 PM »
thanks Mosenzov, that makes sense. sorry Kraflab I do not really understand Cellular Automata! you might as well just be saying MATH!. I don't really know what defines something as Cellular Automata. I think maybe one of these days I want to write an article about all those Dungeon generation techniques, but like an Idiots guide to them. Something to get people started when they are first trying their hand at Roguelikes.

Basically, it is just a set of rules that decide how a tile changes during the build process.  So one cellular automata routine might be, as mosenzov said, flip any floor tile with 7 adjacent floor tiles to be a wall tile.  I strongly urge you to play around with it at some point, completely unrelated to a game even.  As requerent mentioned, there is a lot to enjoy in that field.

A set of rules and a number of steps (i.e. run the rule on the map 5 times) can create many many different types of dungeons.

Alex E

  • Rogueliker
  • ***
  • Posts: 118
  • Karma: +0/-0
    • View Profile
    • Email
Re: Need some Help with small Maps
« Reply #7 on: November 28, 2012, 11:36:44 PM »
Basically, it is just a set of rules that decide how a tile changes during the build process.  So one cellular automata routine might be, as mosenzov said, flip any floor tile with 7 adjacent floor tiles to be a wall tile.  I strongly urge you to play around with it at some point, completely unrelated to a game even.  As requerent mentioned, there is a lot to enjoy in that field.

A set of rules and a number of steps (i.e. run the rule on the map 5 times) can create many many different types of dungeons.

The first program I made using cellular automata was my own version of Conway's Game of Life. I still make maps using the same tiled method I used in that old program, which makes things much easier for me. So ya, it'd be good to try to make some sort of Game of Life game to learn how it's done.

Darren Grey

  • Rogueliker
  • ***
  • Posts: 2027
  • Karma: +0/-0
  • It is pitch black. You are likely to eat someone.
    • View Profile
    • Games of Grey
Re: Need some Help with small Maps
« Reply #8 on: November 29, 2012, 10:59:53 AM »
I gotta agree with the cellular automata advice - it's really fun and simple.  The Wikipedia article gives a good overview:

http://en.wikipedia.org/wiki/Cellular_automaton

Put simply it's a set of rules about how whether a square is empty or full based on its neighbours.  This basic ruleset can quickly create surprisingly complex and interesting structures.

The best part is it's easily customisable.  You can introduce random variations in the process, and or replace the on/off nature with a higher gradient of control, or choose how many turns to modify it over.  As well as just fiddling with the base values and watching all the results, which is cool in itself.

I'd recommend *not* starting with connecting the entrance/exit, as this encourages boring paths.  Instead check for connectivity at the end with a floodfill - if the floodfill fails either tweak the level with a forced path or just regenerate.

jasonpickering

  • Rogueliker
  • ***
  • Posts: 274
  • Karma: +0/-0
    • View Profile
    • Email
Re: Need some Help with small Maps
« Reply #9 on: December 02, 2012, 06:13:45 PM »
hey thanks guys this has been decently helpful. I am currently trying to figure out rules for building out the world now. Any rules you guys like to add to yours that give particularly good results. Right now I am using cardinal directions. I usually only do cardinal movement in my games so this is making calculations a little easier. I will post stuff when I get it somewhat working.

jasonpickering

  • Rogueliker
  • ***
  • Posts: 274
  • Karma: +0/-0
    • View Profile
    • Email
Re: Need some Help with small Maps
« Reply #10 on: December 02, 2012, 08:29:01 PM »
Okay. So I got this up and running. It looks pretty good. there are a few times when areas will be generated that you cant get to. I just need to run a Flood Fill to make sure all areas are connected, and then remove the spots you cant get to.

Try It!
( Space will generate a new Floor)

And here are my steps:
1. I started off with a full forest of small trees
2. I randomly cut down a bunch of the trees
3. I randomly choose an entrance and exit

4. Next I checked to see if there was a path from entrance to exit
5. I went through and started carving out sections based on Sides and a random chance. Chance being smaller for fewer Sides.
6. Added trees based in the larger open areas
7. Checked the path again. if no path went back to step 5.

8. Did Level Clean up, getting rid of any single spaces surrounded by trees and had a chance to turn 4 neighbor trees into one large one. Add grass and rock Ground Tiles

I think I need to change the tiles a little bit, with the pointy trees it can be hard to see the grid structure. which might cause problems with people moving.

Naburimannu

  • Newcomer
  • Posts: 10
  • Karma: +0/-0
    • View Profile
    • Email
Re: Need some Help with small Maps
« Reply #11 on: December 04, 2012, 02:56:13 PM »
Looks very nice!

guest509

  • Guest
Re: Need some Help with small Maps
« Reply #12 on: December 05, 2012, 02:17:58 AM »
  Looks good. Multiple lines of advance, good variety.