MUD-Dev
mailing list archive
[ Other Periods
| Other mailing lists
| Search
]
Date:
[ Previous
| Next
]
Thread:
[ Previous
| Next
]
Index:
[ Author
| Date
| Thread
]
[MUD-Dev] Re: AFAP: As fast as possible, non linear...
quzah [softhome] wrote:
>
> Hiya all.
>
> I'm finishing up a tiny maze generator, and all I need is a
> tad bit of a speed gain. (Or more than a tad. :) I'm using
> a 10x10x10 cube, generated a plane at a time (10x10). I am
> linking them through one exit per plane (up/down), with the
> bottom level's exit leading "out". Here's the basic rundown:
>
> void mazePunch( char startX, char startY, char startZ, bool nuke){
> static char path[100];
> static char used;
>
> /* if nuke, zero the path, simple linear for() loop */
> /* then trash 'used' */
>
> /*
> startX and startY determine this planes 'current' location.
> {
> If any neighbor is zero (unused), note it (valid).
> Pick from the list of valid neighbors at random to use.
> Knock out the wall, them to us.
> Increment 'used'.
> If current == 0, increment 'used'.
> Knock out the wall, us to them.
> }
> {
> If no neighbors were zero, and we are zero, punch a hole
> from us to any valid neighbor (valid this time being an
> in bounds coord.) Increment 'used' since we are no longer
> zero.
> }
> if( used < 100 )
> recursive call with new coords for x and y.
> else return
> */
> }
>
> That about does it. The only thing I don't like about it is that
> that I have a crappy way of getting the new coords for the next
> recursive call. I'm currently using:
>
> mazePunch( number_range(0,9), number_range(0,9), FALSE );
Thinking about it, I'm not convinced that your algorythm will always
generate a solvable maze. Condiser:
A-O-O-O O-O
| | | | |
O-O-O O-O
| |
O-O O-O-O
| | | | |
O-O O-O-O-B
I think this would meet your loop exit crietria (used = 100), but it is
not possible to get from A to B. This could pose something of a problem
for your players...
Mik
--
http://www.geocities.com/SoHo/Cafe/2260
- Thread context:
- [MUD-Dev] Re: AFAP: As fast as possible, non linear..., (continued)
- [MUD-Dev] Re: AFAP: As fast as possible, non linear...,
Mik Clarke mikclrk#ibm,net, Tue 15 Dec 1998, 04:05 GMT
- [MUD-Dev] Re: AFAP: As fast as possible, non linear...,
Dan Shiovitz dbs#cs,wisc.edu, Tue 15 Dec 1998, 06:18 GMT
- [MUD-Dev] Re: AFAP: As fast as possible, non linear...,
Jon Leonard jleonard#divcom,slimy.com, Tue 15 Dec 1998, 07:27 GMT
- [MUD-Dev] Re: AFAP: As fast as possible, non linear...,
Mik Clarke mikclrk#ibm,net, Tue 15 Dec 1998, 23:36 GMT
- [MUD-Dev] small dev-mud invite,
Chris Gray cg#ami-cg,GraySage.Edmonton.AB.CA, Sun 13 Dec 1998, 23:28 GMT
- [MUD-Dev] Re: Hex grids.,
quzah [softhome] quzah#softhome,net, Sat 12 Dec 1998, 18:58 GMT
- [MUD-Dev] Re: MUD Design doc (long),
Benjamin D. Wiechel strycher#toast,net, Fri 11 Dec 1998, 18:36 GMT
[ Other Periods
| Other mailing lists
| Search
]