dMZX Forums: Randomly Generated Maps - dMZX Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Randomly Generated Maps How would I do this?

#1 User is offline   Old-Sckool 

  • megazeux breaker
  • PipPipPipPip
  • Group: Members
  • Posts: 649
  • Joined: 07-June 05
  • Gender:Male

Post icon  Posted 09 July 2007 - 04:40 AM

I wish to build a randomly generated map engine, but I'm not sure how to go about it.

What I have in mind is something that builds a maze on a grid sorta, where point A (the starting point) will always have a path in each cardinal direction and point B. Point B will always have a minimum distance. A min distance of Two would mean..
  B       AND      B--       NOT      B-
  |                   |                 |
  |                   |                 A
  A                   A

On top of that, I want to incorperate a complexity counter. Since I want the engine to put customblocks(floors) on the board to represent the paths on the map and use that mini-map for reference when the engine draws it, this counter would both give a set number for chars placed and the set maximum distance a maze segment can be from point A. I would also like a counter that places a set number of dead ends if possible to stick goodies in with my draw engine

The big issue I have though is how to go about the randomness part.
<Nadir> mzxers don't make GAMES, usually
<phthalocyanine> they make experiences.
<Nadir> demos, more like
<Nadir> a glimpse into what could have been if mzx wasn't such a bore to work with
<Nadir> actually, i'm being unfair
<Nadir> i would have made mzx games if it was capable of running on more than 20 computers worldwide in 1998
<Nadir> >:D

<%Alice> functor
<%nooodl> i hear C++ has a thing called functors and they're completely different from Haskell functors...
<rorirover> the result is the most horrid thing in C++, it's basically black magic and it transforms any code you're writing into some eldritch monstrosity
0

#2 User is offline   LogiCow 

  • Holiday cow
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,671
  • Joined: 18-July 02
  • Gender:Male
  • Location:Quebec

Posted 09 July 2007 - 11:50 AM

Set "thisvalueisarandomvalue" between "min" to "max"
0

#3 User is offline   Val 

  • ring ring zap
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,233
  • Joined: 19-February 04
  • Gender:Female
  • Location:Bartholomew

Posted 09 July 2007 - 06:36 PM

LogiCow, on Jul 9 2007, 07:50 AM, said:

Set "thisvalueisarandomvalue" between "min" to "max"

Actually, that's wrong, Logicow. You have to write:

Set "thisvalueisarandomvalue" random "min" to "max"
0

#4 User is offline   Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,895
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 09 July 2007 - 06:59 PM

Guy, on Jul 9 2007, 11:36 AM, said:

LogiCow, on Jul 9 2007, 07:50 AM, said:

Set "thisvalueisarandomvalue" between "min" to "max"

Actually, that's wrong, Logicow. You have to write:

Set "thisvalueisarandomvalue" random "min" to "max"

He meant it as a sentence, not actual code :(
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository
0

#5 User is offline   CJA 

  • «≡larch bucket≡»
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 3,262
  • Joined: 23-June 05
  • Gender:Male
  • Location:......@.c....

Posted 09 July 2007 - 07:05 PM

I think Logicow has good enough grammar to have written it like this

Set "thisvalueisarandomvalue" between "min" AND "max"

if it were a sentence.
Need a dispenser here.
0

#6 User is offline   LogiCow 

  • Holiday cow
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,671
  • Joined: 18-July 02
  • Gender:Male
  • Location:Quebec

Posted 09 July 2007 - 10:38 PM

I ment it in actual code and made a mistake.
0

#7 User is offline   Old-Sckool 

  • megazeux breaker
  • PipPipPipPip
  • Group: Members
  • Posts: 649
  • Joined: 07-June 05
  • Gender:Male

Posted 10 July 2007 - 01:16 AM

This isn't helping.
The what the problem is is that I don't know how to randomly build a maze that doesn't have straightforward paths.
<Nadir> mzxers don't make GAMES, usually
<phthalocyanine> they make experiences.
<Nadir> demos, more like
<Nadir> a glimpse into what could have been if mzx wasn't such a bore to work with
<Nadir> actually, i'm being unfair
<Nadir> i would have made mzx games if it was capable of running on more than 20 computers worldwide in 1998
<Nadir> >:D

<%Alice> functor
<%nooodl> i hear C++ has a thing called functors and they're completely different from Haskell functors...
<rorirover> the result is the most horrid thing in C++, it's basically black magic and it transforms any code you're writing into some eldritch monstrosity
0

#8 User is offline   Risu2112 

  • I can't get the top off this bottle
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,864
  • Joined: 12-August 01
  • Gender:Male

Posted 10 July 2007 - 01:48 AM

Old-Sckool, on Jul 9 2007, 06:16 PM, said:

This isn't helping.
The what the problem is is that I don't know how to randomly build a maze that doesn't have straightforward paths.

Your question is pretty broad, and the description you're giving for the specific results you want is a little vague, provide a little more info on what results you want from said engine ^^
Respond! Vibrate! Feed back! Resonate!
<Cybersilver> "All my sugestions are for FUTER VERSIONS. Say it with me Fu-ter futer. Yep..."
9-21-2009, SFMZX game play video: HERE
Risu2112
0

#9 User is offline   Elig 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 382
  • Joined: 21-March 02
  • Gender:Not Telling

Posted 12 July 2007 - 07:02 AM

Here's the SECKRET to random maps, they're all based on random maze algorithms. Except the fractal ones. And, mazes are really, really simple. The definition of a maze is that there is only a single route between any two points on a some sort of map. And we dont even need to abide by that for random map generation. Anyway, the simplest algorithm to implement is hunt and kill. It works through a grid, you start out with a single square being "In," and you randomly choose a square adjascent to an In square, and make it In too. Remembering ofcourse to record which square we decided to connect to. This generates a nice maze, which you can use for pretty much any type of map you want. Beyond this, you probably DONT want your map to be a maze. After all, how fun is it to walk around inside a giagantic MAZE.

Anyway, just my thoughts. There are some more "organic" algorithms, but they're much more complex. Although I admit, a recursive backtracker for those who know is technically simpler than this implementation, but it also produces hideous results for video games. Hunt and Kill keeps things simple.
<Lancy-Rexxy> Hey, Elig. Any GUI progress ?
<Mooseka> YES LANCER <b>TALK DIRTY TO ME</b>
<GMCBay> When creating a game, the first thing I do is design the box cover for the special edition collectors DVD. The second thing I do is begin thinking about what will be in the sequel.
<Koji> SOYLENT MILK IS COWS!! D:
<Jotz> you guys have such a mindless disdain for a delicious mint julep! that you're making it not work by thinking that it won't.
<Jotz> Sorry, but I don't think this project is going to succeed like a delicious mint julep! did.
<xicloid> Isn't there anything like "return null"in C?
0

#10 User is offline   Val 

  • ring ring zap
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,233
  • Joined: 19-February 04
  • Gender:Female
  • Location:Bartholomew

Posted 12 July 2007 - 07:36 AM

Here's your solution: http://en.wikipedia....ation_algorithm

Referring to the "recursive division" one. It's the simplest and most efficient!
0

#11 User is offline   Old-Sckool 

  • megazeux breaker
  • PipPipPipPip
  • Group: Members
  • Posts: 649
  • Joined: 07-June 05
  • Gender:Male

Posted 15 July 2007 - 08:31 PM

I've finished.
Posted Image
What I did was I wrote an engine that simply draws random paths. It randomly picks a direction, then checks if there's an open space ahead. If it happens to turn on itself, it makes a three way intersection, then rides on the maze until it finds an open space. It never makes a 4-way intersection. It continues until a local counter hits 0. When that happens, it checks to see if B is too close. As you can see, I didn't set it high enough. It will also have that complexity counter put in soon.
<Nadir> mzxers don't make GAMES, usually
<phthalocyanine> they make experiences.
<Nadir> demos, more like
<Nadir> a glimpse into what could have been if mzx wasn't such a bore to work with
<Nadir> actually, i'm being unfair
<Nadir> i would have made mzx games if it was capable of running on more than 20 computers worldwide in 1998
<Nadir> >:D

<%Alice> functor
<%nooodl> i hear C++ has a thing called functors and they're completely different from Haskell functors...
<rorirover> the result is the most horrid thing in C++, it's basically black magic and it transforms any code you're writing into some eldritch monstrosity
0

#12 User is offline   Koji 

  • End
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 6,644
  • Joined: 15-November 01
  • Gender:Not Telling
  • Location:US, NC

Posted 16 July 2007 - 06:20 AM

Huh. Interesting algorithm.

Granted the mazes it makes are evil, but nifty algorithm.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

7 User(s) are reading this topic
0 members, 7 guests, 0 anonymous users