Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sun May 18, 2008 5:03 pm   

Fun stuff: A maze walker
 
So I've been working on a maze walker so I don't have to navigate mazes by myself. The big problem is, however, most of the exits will be random, so the best I can come up with is to walk in a random direction. But I need something more complex than that. Here is what I have so far. Following that will be the MUD output.

Code:
#TRIGGER {^ (%w)%s:} {#additem exits %1}
#TRIGGER {Mazewalking} {}
#COND {Mazewalking} {#EXEC {%item(@exits, %random(1, %numitems(@exits)))};exits="";exits}
#ALIAS mazewalk {#IF (@mwalk=1) {#T- {MazeWalker|MazeTrigs};#SEND {prompt [hp: %p mp: %P tnl: %X gold: %g room: %r align: %a qtime: %q]%c};#var mwalk 0} {#T+ {MazeWalker|MazeTrigs};mwalk=1;#SEND {prompt Mazewalking%c};exits}}


This would be the output from the MUD:
Code:
Obvious exits from [ In a maze ]:
 West           : In a maze 
 Down           : In a maze

Mazewalking

Obvious exits from [ In a maze ]:
 East           : In a maze 
 West           : In a maze


Now, it works... for the most part. The biggest problem I have is that since it IS so random, it'll sometimes go back and forth between two rooms. I know I could probably drop a gold piece here and there (if no one has picked it up and whatnot), but is there a better way to go about doing this? Any advice will be appreciated. Thanks!

Charneus
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Sun May 18, 2008 6:30 pm   Re: Fun stuff: A maze walker
 
You need to make up a heuristic to improve it. If the exits of a room don't change too often, then you can say that if the new room has exits in same directions as the last one then it is probably the same room. So if you went south to enter the room, you will try one of the other exits.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sun May 18, 2008 7:12 pm   
 
There's one problem, though. I could be in a room with four exits (NESW), move west, and be in a different room with the same 4 exits. Based on your suggestion, if the end of the maze was west from the second room, I'd never reach it.

Charneus
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Sun May 18, 2008 7:45 pm   
 
charneus wrote:
There's one problem, though. I could be in a room with four exits (NESW), move west, and be in a different room with the same 4 exits. Based on your suggestion, if the end of the maze was west from the second room, I'd never reach it.

Charneus

You can assign probabilities to the exits. So east would have higher probability and be more likely picked, but not necessarily.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sun May 18, 2008 11:46 pm   
 
The problem with that is our mazes are randomized every so often (I want to say every repop). So, while going west will be the solution one time, the next time, the answer could be going north. So I can't set a probability with that. Heh.

Charneus
Reply with quote
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: Tue May 20, 2008 1:08 am   
 
why not make a condition not to go back the direction you just did unless its the only one, or have it walk along one wall, like walking the maze keeping your hand on the right wall at all times. The only issue with that is sometimes that could loop, but you could just go a direction manually to knock it out of it.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Tue May 20, 2008 1:46 am   
 
You could make sure that you traverse the maze before repop and use scan to tag the room. This will probably be difficult to do in a maze with moving mobs since the scan info will become dated, but for a maze with a rooted population, it should do well.
_________________
Sic itur ad astra.
Reply with quote
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: Tue May 20, 2008 9:21 pm   
 
Another idea is to make a virtual map of the maze and just use cartesian values in a variable to keep your relative location as you transverse it. Doing this would allow you to keep it moving in unexplored places.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Wed May 21, 2008 6:27 pm   
 
Chris, it's not that easy. The maze isn't a maze like you're probably thinking. Yes, it may have only one path through it, but it doesn't have "walls" to guide along. There are no wrong exits, just wrong paths. You don't get blocked off for following an exit. To better illustrate what I mean, take a look:

Code:

[ ] [ ] [ ] [ ] [ ]
[ ] [ ] [ ] [ ] [ ]
[ ] [ ] [ ] [ ] [ ]
[ ] [ ] [ ] [ ] [ ]
[ ] [ ] [ ] [ ] [ ]
        [*]


The * represents the player. Now say that the correct path is north, north, east, north, west. However, I can north, any one of the directions, followed by any one of those directions, etc. The mazes usually loop back on them, too - meaning if I were to go to the extreme east, it'd go back to the west side. It's a bit hard to understand. :P If you want a more visual understanding, log onto Aardwolf, type recall, type "speedwalk lowlands" and type "run whatever the speedwalk is". Then go up from there, a few east, and south. You'll enter one of the mazes. :P

Charneus
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net