18 Apr, 2009, JohnnyStarr wrote in the 1st comment:
Votes: 0
I need an auto mapper for my Ruby project. I'm trying to think of a way to implement one similar to SMAUG's but cant figure out how it really works. My C skills aren't the greatest, especially with doing something this complicated.

I know that it uses a hash as a x, y grid and that i would want to start with a 'point of origin', namely the user's room, branch out, and figure out whats in the rooms around the player, then assign an ascii character for that room, create a grid and print it out. That's about all i know, now how that works beats me.

Doe's anyone know of any resources other than the raw code that i can use to figure out how to do this?
18 Apr, 2009, Chris Bailey wrote in the 2nd comment:
Votes: 0
I've written a few different overland mapping systems in Ruby but none of them work the way you are suggesting. I started with the mapping system before adding in anything else to handle rooms/zones/etc and built everything on top of it. Do you already have some sort of navigation system in place? Are you using any particular codebase? I'd be more than happy to help you out if you can provide some more information.
18 Apr, 2009, David Haley wrote in the 3rd comment:
Votes: 0
If you make the assumption that the world is 100% "sane", i.e. going north then east then south then west always brings you back to the same spot, this is relatively easy. You would do some kind of depth-limited breadth- or depth-first expansion of rooms starting from the room of origin. Create your X by Y array and fill it as you go, starting from the center point. For example, if you show the 5x5 area around the player, you would start by populating square 3x3, and then just start going through exits but no more than four manhattan distance units away from the center. Then printing the grid is easy. You can optionally made the printed grid contain exit information, in which case you wouldn't make it 5x5 but 9x9.
18 Apr, 2009, JohnnyStarr wrote in the 4th comment:
Votes: 0
Thanks for the replies, first of all to chris:

The codebase is my own custom one built from the ground up, with a little help of Tyche's RocketMud. I made the rooms and exits first class objects, so each room object has an Array collection of exits.

to David:

yes, the world is perfectly 'sane' as you put it. so i see where you are going, but the hard part is to make a map that dosn't look crummy i would first need to collect all my data right? example:

*
|
*-#-* <- the hex is the player symbol, the asterisks are rooms
|
*


in the above we have the perspective of the current room, this is extreemly easy, because our map is just displaying a graphical
version of the current rooms exit data, data that each room has implicitly. but say we want to see a larger scope:
* *-*-*
| |
*-#-*-*
|
*


to draw out my map with the right spaces and everything, i would have to figure everything out first.
Sorry if i'm not asking the right questions, but how can this be done? am i overthinking the problem?

EDIT: After reading your last post more carefully i realize what you are saying, do you mind providing a quick example or perhaps just expounding on your point a bit? :biggrin: I'm just trying to wrap my brain around it :stare:
19 Apr, 2009, Tyche wrote in the 5th comment:
Votes: 0
I wrote half a tutorial over in this discussion:
http://www.mudconnect.com/discuss/discus...
19 Apr, 2009, Davion wrote in the 6th comment:
Votes: 0
Having written a few mappers, I think you have the right idea. The first step is to populate some form of a container, either 2d or 3d. I would use BFS algorithm to populate it. It seems to make the best looking maps on a irrational world layout. Once that's done, you then print the array as a grid. The trick to this is you aren't starting at the root position when you start printing this array, you always start in the upper left hand corner, and print line by line. I always separate the populating of the array and the printing of the array into different functions, that way, should you want to have multiple layouts for the map (ie. one for in room descriptions, and a larger one for a separate command), you don't have to write a new populator ™. Always have a rough estimate of what you want your map to look like before you start doing it. I've only really seen three different styles. One is like the one mentioned previously in this thread, the other is a 3x3 block of a room (which also has the ability to show up/down directons) and the other is similar to the first, but it has a character for all the exits on each room (so there's two characters between each room instead of one.)

To get a better idea on how you want it to look… I'd say go look at the raw code we have on this site. I know there's a few different mappers around and they could at least give you a starting point on how to start printing your array.
0.0/6