Mudlet Map Explorer

Share your scripts and packages with other Mudlet users.
User avatar
demonnic
Posts: 884
Joined: Sat Dec 05, 2009 3:19 pm

Mudlet Map Explorer

Post by demonnic »

Thanks to one of the users at Arkadia there is now a handy tool for perusing your Mudlet map in a web browser!

I translated it from Polish and wrapped it in a standard Mudlet mpackage rather than the plugin system they're using for stuff over at that game. You can download it HERE and install it either via the Package Manage or by dragging and dropping the mpackage onto Mudlet's main screen.

It works best with Google Chrome from what I've been told and experience in my testing, as this will allow you to copy the image to you clipboard. It works rather well in Firefox as well, though you lose copy to clipboard functionality you can still browse the map and save the file to disk.

Here is a shot of what the map looks like:
ExplorerInAction.png

In order to use it, all you have to do is enter the "/explore-map" alias on the command line, and it will export your map information and open the page in your web browser using openURL().
If you just want to export the map data (for instance if you've bookmarked the file in your web browser and just need to update the map information) then you can use the alias "/export-map".
If you want to print a clickable link to the map explorer in your main Mudlet window, you can user the alias "/link-map"

It must be noted that maps which have been imported from an XML file supplied by the MUD may have embedded environment color information which, at least at the moment, cannot be read via the Lua API. This means some maps are colored wildly differently in Mudlet than the web browser, but there's nothing I can do about it for the moment. For everything else, it uses the default colors for environment 1-255 except as overridden by values retrieved via getCustomEnvColorTable().

Mudlet:
Selection_048.png
Selection_048.png (19.44 KiB) Viewed 9538 times
Browser:
Selection_049.png
Selection_049.png (8.05 KiB) Viewed 9538 times

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

Re: Mudlet Map Explorer

Post by Vadi »

It would be handy to print the location of the generated file, because for me VS Code (??) opened the result for some reason.

It also doesn't seem to handle the 1-16 special room environment colors - which I think are available as color_table["ansi_#"].

User avatar
demonnic
Posts: 884
Joined: Sat Dec 05, 2009 3:19 pm

Re: Mudlet Map Explorer

Post by demonnic »

I'll take a look at it. 1.0 was a direct port of the stuff from Arkadia, I've only just started looking at making modifications late last night/this morning.

Also, it uses openURL I'm pretty sure, slightly surprised it opened in VSCode. Did it get associated with html files maybe? But I can add an echo as well for sure.

Will look at that after I get user data displaying for the rooms you click on. =)

User avatar
demonnic
Posts: 884
Joined: Sat Dec 05, 2009 3:19 pm

Re: Mudlet Map Explorer

Post by demonnic »

Hmm, how do those room colors map to the actual environment IDs? environment 1 is not ansi_001, at least not judging by the export of my Starmourn map where I found some environments in use which were not in the table returned by getCustomEnvColorTable().

This is what it looks like in my Mudlet mapper:
Selection_048.png
Selection_048.png (19.44 KiB) Viewed 9572 times
And this is what env1 = ansi_001 and so on looks like:
Selection_049.png
Selection_049.png (8.05 KiB) Viewed 9572 times

User avatar
demonnic
Posts: 884
Joined: Sat Dec 05, 2009 3:19 pm

Re: Mudlet Map Explorer

Post by demonnic »

Hmmm, I think I found the spot in the cpp where it calculates the environment colors for environments 0-256 if not set in the custom env table, so will work on replicating that. But curiously environment ID 12 in that starmourn map is showing up as green, despite envID 12 not being set in the customEnvColorTable.

I may need to find a map to work on from scratch using the generic mapper to see if there's something else funky going on with the starmourn one.

User avatar
demonnic
Posts: 884
Joined: Sat Dec 05, 2009 3:19 pm

Re: Mudlet Map Explorer

Post by demonnic »

aaaaand it's just using up to ansi256, my mapper colors aren't set custom in my starmourn profile. I'm not sure why the colors in the mudlet mapper are not matching up to the colors I would expect. getCustomEnvColorTable() is not returning values for environments in the 001-255 range in that profile. Is it possible that because it's the crowdmap the .dat file has someone's custom env colors embedded, but it's not registered with getCustomEnvColorTable? I'm not even sure how or why that would work but I replicated the calculations being used in T2DMap.cpp around line 750 in lua and the numbers all match with the color_table.ansi_XXX colors.

The only thing that doesn't seem to match up is what is actually being shown in the map in Mudlet itself. That being the case I'm going to move forward with just reading the first 256 ansi colors into the color data in use for the map browser (though black is envID 8 and lightblack is envID 16, the rest of the ansi colors seem right and I've adjusted for that)

User avatar
SlySven
Posts: 1019
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Mudlet Map Explorer

Post by SlySven »

That is because when an XML map is imported it sets up a mapping via the user inaccessable (QMap<int, int> TMap::envColors) of IRE map colour code to Mudlet colour code. Further more, at least ONE of the IRE Muds (either Aetiolia or Achaea - I think the former though) has Environment data that maps similar environments to one of a range of just 16 ANSI colours via a "color" attribute but also provides for an "htmlcolor" attribute that provides a finer distinction between different types of those similar environments - i.e. all the water ones get mapped to ANSI blue but different types of water get mapped to different 24-bit colours (via #rrggbb codes).

Ideally we'd extend our code to have a separate environment class where we could encode a 24-bit colour, a name, and for some MUDS possibly a default room weight. Though how to insert that into the current system without breakage could be tricky...

User avatar
demonnic
Posts: 884
Joined: Sat Dec 05, 2009 3:19 pm

Re: Mudlet Map Explorer

Post by demonnic »

Ahh. So then there's actually no way to reproduce the maps the color is actually using. I'll add a disclaimer to the original post that IRE maps may look ugly because they hack the colors in ways Mudlet won't let me get at.

User avatar
demonnic
Posts: 884
Joined: Sat Dec 05, 2009 3:19 pm

Re: Mudlet Map Explorer

Post by demonnic »

For that matter, if you modify the map ansi colors in settings is that represented anywhere in getCustomEnvColorTable()? Or anywhere accessible by lua API?

I'll just use whatever the ansi colors from the color table are for now so it at least does color the various environments based on what Mudlet's defaults would be.

User avatar
SlySven
Posts: 1019
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Mudlet Map Explorer

Post by SlySven »

Well it ought to be possible to add a getter and setter for that table but TBH it is just going to confuse the hell out of people unless we expand Mudlet to offer an "environment" type setting - and show how (or even make) it differ from just setting a colour for a room...

Post Reply