General Discussion - Wilderness Mapping

All and any discussion and development of the Mudlet Mapper.
Post Reply
TheUltimateMap
Posts: 10
Joined: Thu Jul 11, 2013 9:14 pm

General Discussion - Wilderness Mapping

Post by TheUltimateMap »

Six million rooms. That's the approximate size of the wilderness in this one particular MUD, and I'm aiming to map all of it and save it as a bmp file. :mrgreen:

This is why I picked up Mudlet. It appears to have the most powerful mapping system, and although this will be my first encounter with LUA, I have years of past experience with scripting in a language called AutoIt which should ease the difficulty.

As I understand it, wilderness mapping is pretty complex, and the documentation seems a bit limited so I opted to come chat with you fine folks and see what advice or links are out there, maybe even form a partnership or two. 8-)

It seems like with some decent experience, one could borrow a good script from a similar more popular MUD and adapt it to one's needs. While this is preferable in the interest of saving time, in my experience it's pretty difficult to do for your first rodeo with a particular language. This is where someone with more experience could really step in and help me bang this out. ;)

Here is an example of what your character sees in the wilderness.
~~
~~~~~~~~~~~~~~::^^
::::~~::~~~~~~~~~~~~::~~~~
::::::::~~~~~~~~~~~~~~~~~~~~~~
::::::~~::~~~~~~~~~~~~~~~~~~~~~~~~
++::::++~~~~~~~~~~~~~~~~~~tt~~~~~~~~~~
::::::++~~~~~~~~~~~~~~~~~~~~tt~~~~~~~~
~~::~~~~~~~~~~~~~~~~~~~~~~tt~~tt~~~~~~~~~~
~~~~~~~~~~~~~~~~~~tt~~~~~~tttt###:~~~~~~~~
~~~~~~~~~~~~~~~~~~~~tt~~~~tt::###:++~~++~~
~~~~~~~~~~~~~~~~tttttt~~::::::::::++++~~++
~~~~::~~~~~~~~~~~~~~ttt*~~~~::~~::++++~~++++~~
++::++~~~~~~~~~~tt#t::~~~~~~~~~~##++~~~~++
~~++~~~~~~~~~~++tttttt::~~~~~~~~++~~++~~~~
~~~~++~~~~~~~~~~tt~~tttt~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~tt~~tttt::~~~~~~~~~~~~~~~~
~~~~~~~~~~~~++++tttttt~~~~~~~~~~~~~~~~
~~~~~~~~~~~~++++++++tt~~~~~~~~~~~~~~~~
++~~~~~~~~~~++++~~tt~~~~~~~~~~~~~~
~~~~~~~~++~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~
~~

The asterisk in the center represents your avatar. It never moves from the center.

So far the way I envision the script working is roughly like this...

(Just to be clear, any time I use the word "character" here it is referring to a character on the keyboard, not my actual avatar in the world.)

1) I find an epicenter in the world, put my avatar there and create a new room with a coordinate of (0,0)
2) Henceforth all movements will create new rooms. If i move one square northeast, for example, the coordinate of that new room is (1,1)
3) In the game, each time you move a square, a new survey is created. So the script will look for each new instances of the asterisk, copy the entire survey, and remove the carriage returns and empty spaces so it's all one continuous line.
4) The line is divided up into "squares" (each "square" contains two identical characters in the survey) and each one assigned an ID. For instance, the first two characters in the line would be identified as the very farthest northern "square" my avatar can see
5) The script then "reads" the ASCII art for each "square", in our example, ~~ which is water, and assigns that as the value for the new room that's to be placed there
6) The script, having kept track of where I am in the world, "stamps" the rooms onto the grid where they belong with their assigned terrain values

As a final step, I will want to create a ..bmp file from the finished product. Unless someone knows otherwise, it appears as though there is no way to export a map from Mudlet. Even if I could export it as a spreadsheet, I'm sure there is some software out there could then translate it into an actual image. If this is not an option, I may have to take screenshots of the map in Mudlet, one slice at a time, and stitch them together in photoshop.

So that's the plan... just looking for any feedback or useful documentation that may be out there before I begin, including but not limited to personal advice, tutorials, preexisting scripts, or suggestions for various code syntax. Once I get going I can post my progress here as well as any stumbling blocks I'm facing, and together we can create a very useful thread for anyone seeking how to do this for themselves, as the documentation is a bit limited. :o

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: General Discussion - Wilderness Mapping

Post by Vadi »

There is a way to export a map! If you save it all as one area (you'd want this), there is an exportAreaImage(areaid) function which will save this for you as a .png :)

I believe Omit made his mapping script parse wilderness into the mapper, and Tirac in Achaea parses the wilderness output into Mudlet as well with this sea mapping script.

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: General Discussion - Wilderness Mapping

Post by Heiko »

TheUltimateMap wrote:Six million rooms. That's the approximate size of the wilderness in this one particular MUD, and I'm aiming to map all of it and save it as a bmp file. :mrgreen:

This is why I picked up Mudlet. It appears to have the most powerful mapping system, and although this will be my first encounter with LUA, I have years of past experience with scripting in a language called AutoIt which should ease the difficulty.

As I understand it, wilderness mapping is pretty complex, and the documentation seems a bit limited so I opted to come chat with you fine folks and see what advice or links are out there, maybe even form a partnership or two. 8-)
http://wiki.mudlet.org/w/Manual:Technical_Manual#Mapper
read this entire basic mapping thread: http://forums.mudlet.org/viewtopic.php?f=9&t=2730
It seems like with some decent experience, one could borrow a good script from a similar more popular MUD and adapt it to one's needs. While this is preferable in the interest of saving time, in my experience it's pretty difficult to do for your first rodeo with a particular language. This is where someone with more experience could really step in and help me bang this out. ;)

Here is an example of what your character sees in the wilderness.
~~
~~~~~~~~~~~~~~::^^
::::~~::~~~~~~~~~~~~::~~~~
::::::::~~~~~~~~~~~~~~~~~~~~~~
::::::~~::~~~~~~~~~~~~~~~~~~~~~~~~
++::::++~~~~~~~~~~~~~~~~~~tt~~~~~~~~~~
::::::++~~~~~~~~~~~~~~~~~~~~tt~~~~~~~~
~~::~~~~~~~~~~~~~~~~~~~~~~tt~~tt~~~~~~~~~~
~~~~~~~~~~~~~~~~~~tt~~~~~~tttt###:~~~~~~~~
~~~~~~~~~~~~~~~~~~~~tt~~~~tt::###:++~~++~~
~~~~~~~~~~~~~~~~tttttt~~::::::::::++++~~++
~~~~::~~~~~~~~~~~~~~ttt*~~~~::~~::++++~~++++~~
++::++~~~~~~~~~~tt#t::~~~~~~~~~~##++~~~~++
~~++~~~~~~~~~~++tttttt::~~~~~~~~++~~++~~~~
~~~~++~~~~~~~~~~tt~~tttt~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~tt~~tttt::~~~~~~~~~~~~~~~~
~~~~~~~~~~~~++++tttttt~~~~~~~~~~~~~~~~
~~~~~~~~~~~~++++++++tt~~~~~~~~~~~~~~~~
++~~~~~~~~~~++++~~tt~~~~~~~~~~~~~~
~~~~~~~~++~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~
~~

The asterisk in the center represents your avatar. It never moves from the center.

So far the way I envision the script working is roughly like this...

(Just to be clear, any time I use the word "character" here it is referring to a character on the keyboard, not my actual avatar in the world.)

1) I find an epicenter in the world, put my avatar there and create a new room with a coordinate of (0,0)
2) Henceforth all movements will create new rooms. If i move one square northeast, for example, the coordinate of that new room is (1,1)
3) In the game, each time you move a square, a new survey is created. So the script will look for each new instances of the asterisk, copy the entire survey, and remove the carriage returns and empty spaces so it's all one continuous line.
4) The line is divided up into "squares" (each "square" contains two identical characters in the survey) and each one assigned an ID. For instance, the first two characters in the line would be identified as the very farthest northern "square" my avatar can see
5) The script then "reads" the ASCII art for each "square", in our example, ~~ which is water, and assigns that as the value for the new room that's to be placed there
6) The script, having kept track of where I am in the world, "stamps" the rooms onto the grid where they belong with their assigned terrain values
Yes, exactly. Create a named area for your map and add all rooms to this area otherwise they won't be displayed. Set this area to grid mode. When the map is complete you can use the exportAreaImage() function to export a png image file of the area.
Create a temporay timer that autowalks consecutively over the entire map from top left to bottom right (->tempTimer()). When entering a new room, you create a new room object and set its room ID with: newRoomID = previousRoomID+1 (don't use the createRoomID() function as this needlessly slows things down in this particular case). Set the area ID and room coordinates. Parse the current room properties such as foreground and background color and ASCII character. Set the ASCII character and room colors. To parse the current room attributes, you only need a trivial regex trigger that looks for an asterisk and captures the preceding character which will then be used as the ASCII character of the room and for room colors.

Subsequently, you set the room exits. Note that it's usually best to only set the last used room exit instead of directly setting all possible room exits unless you know that they really exist and work (e.g. via GMCP game data), because usually there are a ton of one way only exits or locked exits on wilderness maps at least on the games that I know.

Lastly, you create a new temp timer to walk to the next room. Note that tempTimers are single shot objects so you need to recreate them after you've parsed the current room data. You need to walk using timers because Mudlet would otherwise block and couldn't process any data from the server.

As a final step, I will want to create a ..bmp file from the finished product. Unless someone knows otherwise, it appears as though there is no way to export a map from Mudlet. Even if I could export it as a spreadsheet, I'm sure there is some software out there could then translate it into an actual image. If this is not an option, I may have to take screenshots of the map in Mudlet, one slice at a time, and stitch them together in photoshop.

So that's the plan... just looking for any feedback or useful documentation that may be out there before I begin, including but not limited to personal advice, tutorials, preexisting scripts, or suggestions for various code syntax. Once I get going I can post my progress here as well as any stumbling blocks I'm facing, and together we can create a very useful thread for anyone seeking how to do this for themselves, as the documentation is a bit limited. :o
Mudlet as a function to export a png image of your map (area).

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: General Discussion - Wilderness Mapping

Post by Heiko »

Addendum: Note the above will give you a nice PNG image of your map, but not a "playable" map because the set exits are one way only exits!). If you'd like to use the pathfinding functions of the mapper you'll need to walk the map in all possible directions etc..

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: General Discussion - Wilderness Mapping

Post by chris »

Or use exit stubs and just autoconnect them all at the end.

TheUltimateMap
Posts: 10
Joined: Thu Jul 11, 2013 9:14 pm

Re: General Discussion - Wilderness Mapping

Post by TheUltimateMap »

Holy cow! Thanks for the great response, guys. :o That was indeed quite helpful.

I'm off to a pretty rockin' start. Turns out there was a lot more documentation than I originally thought, and once I managed to visualize the mechanics behind it all it was just a matter of determining if the engine’s capabilities would cover the task.

Here is an outline for an end-to-end solution that I believe should work. It is more descriptive than syntax-heavy, but should still be pretty comprehensive.

I know the MUD to be a 2500x2500 grid, so what I plan to do to start with is create a function that will add rooms to all those coordinates at once in an area that’s in grid mode. There is no impassable wilderness terrain in this particular MUD, but I’ve included the autowalker itself as a functional part of the mapping process, so exits will need to be added ahead of time. Having another function add exit stubs to all the rooms and autoconnecting them as Chris suggested should do the job.

Once a blank canvas of navigable rooms is in place, I envision the completed script working in the following manner:

1. Every time I load up the map to work on it, I set the autowalker to the desired starting coordinates and make sure my character is at that EXACT location in the MUD, otherwise big big problems.

2. An alias initiates the first survey capture. After each capture, triggers will subsequently autowalk in a diagonal direction into the next room, where upon arrival a fresh centerview is called and the next capture automatically fires.

3. The MUD generates a new land survey automatically each time a new wilderness tile is entered, which is seen as 23 lines of text. Each survey contains 377 wilderness tiles comprised of two ASCII characters representing terrain, as seen in the first post.

4. Now the tricky part... for each new survey, a multiline Perl Regex fires which returns 377 matches of two ASCII characters. It is designed so that each consecutive match is always found in the same position within the survey, but the string that’s causing it to fire varies depending on the terrain that’s there at the time.

5. With every survey, the terrain captured by each match must consistently get passed onto a certain room within my character’s field of view. So, some math is done on the autowalker’s coordinates to pinpoint the rooms where the data is going. The first match of the Perl Regex is always produced by the northernmost visible tile, therefore (+0,+11) will be added to my character’s present coordinates to determine which room corresponds to that particular match. The second match comes at the beginning of the next line, which is the furthest visible NNW tile, so the value of that match will be affecting the room that is (-4,+10) in that direction. The third match will apply to next tile over, (-3,+10), and so on and so forth.

6. The math takes place in a few simple "if/else/then" statements which highlight the rooms with a color based on the value (the two ASCII characters) returned from each match. That’s it!

As my character runs through the wilderness, of course, most of the tiles in each new survey will have shown up in the previous few and already been mapped, until they are no longer in view. The terrain derived however should be exactly the same if everything is working correctly, so I will opt to let the color properties overwrite themselves in case my character ever becomes unsynchronized from where he should be, which would result in areas needing to be remapped.

What do you guys think?

Post Reply