1. MaZe Techniques
- Posted by nieuwen at POP.XS4ALL.NL May 22, 1997
- 638 views
--Message-Boundary-542 Content-type: text/plain; charset=US-ASCII Content-description: Mail message body <..Maze Techniques..> Does anyone know any maze routines, cause i'll like to compare them to mine, I figured it all out myself and i think my engine is totally different than others i've seen. (Yes, i've seen them by they were as cryptic as mine will problely look to you!) It can't get more flexible than mine is, but i might get some new techniques so my mazer could maze things in the default style normally generated by most maze generators. Now it generates mazes as you'll find them in children's books. In a lot of different styles, but maybe not exactly the style the other do. I know mine is quicker, but theirs work too and i ask myself HOW?? SO it's just curiosity, not really a problem or so, just a request. If anyone wants to know what my MaZeR secret is read the TXT file attached to this mail. It will explain how to code it in pseudo-code. Has anyone tried my demonstration program??? (It's in the recent users contribution section) Did you like it or not?? Want thing to be added??? BTW If you, J. Lays (also known as the Reaper) would let me use your code (I already got it) to make SNAKERS 2, i will code SNAKERS 2 with the new improvements i suggested in my last mail. Just because SNAKERS was the first very cool game for Euphoria and i want to keep the tradition on. If you're not gonna code it, let me... --Message-Boundary-542 Content-type: text/plain; charset=US-ASCII Content-description: Text from file 'mazertut.txt' =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= =-= How the MaZeR works.... =-= Ralf Nieuwenhuijsen =-=-= =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= If you're interested in the secret of my MaZeR, you can read it's pseudo-code & technices right here. But please note that this technique has been developped by myself and is totally different than other MaZe Engines ever created. Simply because i didn't knew how they work and had to figure it out by myself. I think my engine is pretty fast comparing to a lot of other engines, however i do not know how they would run on Euphoria. If i would had understand their code, i would proplely created a engine like those, without brainstorming like i did now. Thank god i did, cause this engine is according to me one of the most powerfull engines, simple because you can easily change the complete style of the maze, which wasn't possible with those other engines, which always made a maze in their own style. The general idea.. ~~~~~~~~~~~~~~~~~~~~~ The general idea is very simple, just start a line somewhere and go draw through the whole field, going in any direction you like and turning around sometimes. The lines should be seen as wires that are cluttered up, a mess!! But when you draw a line, make sure you NEVER EVER hit any other line or border. Doing so makes sure that any point in your maze is reachable from any other point in the maze. You do have to use a point raster where a line jumps from one point in a raster to another. Also the line can only go 4 directions. That is UP/DOWN/LEFT/RIGHT Please have a look at this ascII maze: ; | | | | \---------\ /--------------------------\ /----------* | | | | | | | /-------* | | * /--------------* | | /--\ | | | | | | | | | | | | | | | | | \------------------/ | | | | | \------------/ | | | | | | | | \-----\ *------ \ * +---/ | | *---------------------/ | | | | | | /--\ | /--/ \------------/ | | *----------- \ | \----/ *---/ | | | | | \----------------*------*---------------------------------------/ NOTICE: Every line that starts and ends with an asterix (*) is drawn as an independant line and will not be allowed to hit an other line. It's THAT simple ~~~~~~~~~~~~~~~~ If you use the above technique you have a simple stupid maze engine, but it does create mazes. Before i am going to introduce you to which options to include to make it possible to create GOOD and ORGININAL, styled maze, i am going to talk about the program structure (layout).... The program structure ~~~~~~~~~~~~~~~~~~~~~ First i want you to know that this isn't the structure used for the MaZeR.E included in this package, developping that version i kind of found out that i could do it a lot handier, so don't go look at that!! This program structure is used for my new version of MaZeR, which is now bug free, but doesn't pull the edge to be a new release yet. It needs a lot of new options and improve some more techniques for speed. (It is about 80% faster, just by getting rid of all those functions and write 2 big functions and a small one! Using less routines in Euphoria is a real time saver!!) First know that [!] means the engine has to do something. [O] means the engine has to loop using a while/for. [*] means the engine has to randomly make a dissision. (How do you spell that word?) [!] Set the border of the maze field. (This shouldn't be too hard!) [O] Loop through the all the maze commands. (See note 1) | | [O] Calculate/Guess how quick the maze will be ready and | | loop through it. (Just calculate something thats | | sort of close to the needed value.) (See note 2) | | | | [*] ChoosePoint --> Either on the border or in the field. | | [*] Draw a the line not touching other lines. (see note 3) | + | | [!] Finish the maze by checking linear if there are any open | spaces and start to draw a weird line from that point. | (see note 4) + NOTE 1 ~~~~~~ The function should handle a mutiple list of options. The list contains a collection of the mazes options (INCLUDING the min. space allowed between lines!) This loop works through the list and makes a maze in the SAME field for each set of options. Why do we want this?? Well, an exemple.. .. if your first set of options only allows a high min. space between the lines and another allows a lower min. space the second set of options will draw a more narrow maze inside the wider maze. That is nice, cause it set's a maze to a new style and you can use different options (which gives a maze a certain style) at at a different dept. (The min. space allowed between lines) NOTE 2 ~~~~~~ You'll have to make some calculation that says how many times he must try (and might succeed at it) to draw a line. The best is to use a for-loop going from 1 to the maximal tries. OPTIONS --> Have an option which can effect the number of max. tries. Where 1 doesn't effect it at all and 2 makes it double it self. So you can specify how quick to maze should be ready. The maze will offcourse always be finished. (It will do a linear search for open spaces at the end, but some style options will then be ignored.) NOTE 3 ~~~~~~ How to write this piece of work.. (it's hard!) First choose a direction, try to draw a line from that direction. ? not possible ? --> choose another direction until all directions have been tried. If you have drawn a piece of line and you can't continue choose another direction, again until no direction is possible. If you can't draw any futher at any directions at that point your task has been done and you can continue like in the structure above. Have options how big the chance is the engine WANTS to continue in the same direction and how big the chance is the engine WANTS to choose a new direction and continue. If he doesn't want to, he won't have to. These options are very important, for an exemple try a 'DIE HARD' level in the demonstration program. (Hit ENTER a couple of times!) This maze style (of 'DIE HARD') is about always choosing a new direction after a tiny bit of a line is drawn. He also tries to make the weird line as long as possible until he can't go to any direction. Another option is how big the chance is it should point to the center or point away from the center. NOTE 4 ~~~~~~ At the last, you want to finish the maze, because chances are big it isn't totally filled with maze line yet. We simple do a linear search for open spaces and each time an open space occurs, go draw a weird line from the point left to it with an forced direction to the right. Why this is so, you'll notice when you coded it starting to draw a line from the open position. Remember the options you use to choose a point are not appropiate here and it will make a difference if they are use. ENDER ~~~~~ This is the first version of this tutorial and a lot of things will not be clear, so please if you have any question... ...mail me so i can clear up your mind and this tutorial. If you're on the Euphoria Mail Server do not post it personal, but on the mail server, so many other people see your request and my response. -=-=-=-=-=-=-=-=-=-= Ralf Nieuwenhuijsen nieuwen at xs4all.nl --Message-Boundary-542--
2. Re: MaZe Techniques
- Posted by The Reaper <reaper at LOKI.ATCON.COM> May 23, 1997
- 631 views
At 07:18 PM 5/22/97 +0000, you wrote: > > BTW If you, J. Lays (also known as the Reaper) would let me use your >code (I already got it) to make SNAKERS 2, i will code SNAKERS 2 with >the new improvements i suggested in my last mail. Just because SNAKERS >was the first very cool game for Euphoria and i want to keep the >tradition on. If you're not gonna code it, let me... Uh, well, I SUPPOSE snakers was put out into the public domain. But it's pretty old (and slow) compared to what it could be now. The only problem I find is that Snakers ISN'T a maze game. It's really an obstacle game. I won't have time to work on it at least until summer. Try playing around with it and I'll help however I can. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= The Reaper (J. Lays) http://www.geocities.com/TimesSquare/Alley/4444/ reaper at auracom.com Check out my Euphoria Games page at: -= http://www.geocities.com/TimesSquare/Alley/4444/eugames.html ........................ . .. -||..........__...... "There is a shadow that looms over life, . / ||......../-- \\.:::: Of knowledge that will never be found; . ..| ||...... / | |.::: You can guess or waste your life on it, .| _-||.......|| / /.:::: Or look beyond into what's next." ..| |..||...... -\_- \ |\-.::: .| |.[< \ .../ \.:: .||.|||\|\ | - - . \.:::: ...|.\|| | \ | | |.:::. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-