Global exits

keevitaja
Posts: 21
Joined: Mon Aug 31, 2015 12:29 am

Global exits

Post by keevitaja »

Hello,

Does Mudlet mapper have global exits? Like recall or a hand held portal alias?

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

Re: Global exits

Post by SlySven »

Do you mean that in a range (or maybe all) of rooms you type a command and it moves you to a specific room? If so, the answer is not explicitly - I guess you could have an alias that when you typed (what I presume is the same) exit name in any of the relevant rooms it takes you to the specific destination. That would not show up in the map and would not be used by the speed-walk code. The alternative is to enter a Special Exit to the destination location in every room - which would work with the route finding code but would be a pain to do manually - but you could automate it if you have a script that you use to create a new room, e.g. something like:
Code: [show] | [select all] lua
function createNewRoom( name, areaId, x, y, z )
    local newRoomId = createRoomID()
    local ok = false
    local errMsg
    ok = addRoom( newRoomId )
    if ok then
        ok = setRoomCoordinates( newRoomId, x, y, z )
    else
        echo("\ncreateNewRoom(\""..name.."\",  "..areaId..", ("..x..","..y..","..z..") Failed, unable to \"addRoom("..newRoomId..")\"\n")
        return -1
    end
    if ok then
        ok, errMsg = setRoomArea( newRoomId, areaId )
    else
        deleteRoom( newRoomId )
        echo("\ncreateNewRoom(\""..name.."\",  "..areaId..", ("..x..","..y..","..z..") Failed, unable to \"setRoomCoordinates("..newRoomId..", ...)\"\n")
        return -1
    end
    if ok then
        addSpecialExit( newRoomId, limboRoomId, "limbo" )
    else
        deleteRoom( newRoomId )
        echo("\ncreateNewRoom(\""..name.."\",  "..areaId..", ("..x..","..y..","..z..") Failed, unable to \"addSpecialExit("..newRoomId..", ...)\"\n")
        return -1
   end
   return newRoomId
end
In the above code every room that is created will gain an exit called "limbo" that goes to the room whose Id has been stored in the previously defined limboRoomId.

Special Exits do not show up on the map displays (unless you add a custom line on the 2D one) but do in the control that shows/modifies the exits on the 2D Mapper.

keevitaja
Posts: 21
Joined: Mon Aug 31, 2015 12:29 am

Re: Global exits

Post by keevitaja »

Yes, but i want the mapper to use it.

Lets say i have a hand held portal which takes me to Room A in City A. In City A there is also Room B among others.

I do not yet exactly know, how the mapper works, but when i order the mapper to go to Room B i would like the mapper to use this hand help portal which first takes me to Room A and from there walks to Room B.
Of course for the portal i would have an alias. So i will map the portal alias.

Is this how the mapper works?

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

Re: Global exits

Post by SlySven »

It does sound like the use case I offer above, I take it that the hand-held portal works everywhere so you'll need a special exit as I described in every room where it works - and for those times where the hand-held portal needs "recharging" and can't be used you would have a script that would go through all the rooms and lock that special exit (and unlock it when it is ready again)...

I think that is one way to code the portal into the route finding code built in to Mudlet - I am much more familiar with how the C++ Application that is Mudlet would then insert the "portal" command into the list of steps that a "speedwalk" or route that it finds through the map {into the Lua glabal tables speedWalkPath and speedWalkDir and the, very recently added to GitHub 3.0.0 source but not yet into a "preview" version: speedWalkWeight} than I am with the other part that you may need to tweak: the speedwalk(dirString, backwards, delay) function in the Other.lua lua file that accompanies the application...

keevitaja
Posts: 21
Joined: Mon Aug 31, 2015 12:29 am

Re: Global exits

Post by keevitaja »

If it helps, AardMush (Mushclient fork for aardwolf) has this type of hand held portals enabled. And there are no portal recharging time. This is what i am trying to recreate on Mudlet as i am a Linux user.

Without the portals in mapper Mudlet is not very suitable for Aardwolf.

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

Re: Global exits

Post by SlySven »

keevitaja wrote:Without the portals in mapper Mudlet is not very suitable for Aardwolf.
It probably isn't quite that bad - I'm not speaking from experience of Aardwolf, but I am aware that we do have code in place for another Aardwolf feature (Telnet Suboption 102) so someone has worked with supporting that MUD in the past - can anyone who DOES play speak up!

keevitaja
Posts: 21
Joined: Mon Aug 31, 2015 12:29 am

Re: Global exits

Post by keevitaja »

If i had to design a mapper, i would first check the global exits, get the destination if there is any, and then work with mapper nodes. Otherwise it will be a mess.

And now when i think about this, perhaps i will try to write one in lua :P

illusaen
Posts: 3
Joined: Thu Sep 05, 2013 3:52 pm

Re: Global exits

Post by illusaen »

If you were to add special exits for every portal (for example, around 200 portals), would that lag the mapper badly?

Fiendish
Posts: 2
Joined: Mon Mar 28, 2016 2:41 am

Re: Global exits

Post by Fiendish »

Hi All. Just poking around the forum today and saw this.
It probably isn't quite that bad - I'm not speaking from experience of Aardwolf, but I am aware that we do have code in place for another Aardwolf feature (Telnet Suboption 102) so someone has worked with supporting that MUD in the past - can anyone who DOES play speak up!
It might be that bad. With 274 people on right now, 1 is using Mudlet, 185 are using identifiable versions of MUSHclient. That's definitely my fault.
The rest are using other clients like zMUD/CMUD/Tintin/TF/etc. Anyway...
I take it that the hand-held portal works everywhere so you'll need a special exit as I described in every room where it works
This is a data management badness. 100 handheld portal exits added to and subtracted from 32000 rooms? That's a ton of new exits added to a ton of rooms. I think it's a bad idea to create 3099900 unused static linkages to support 100 mobile connections.
If i had to design a mapper, i would first check the global exits, get the destination if there is any, and then work with mapper nodes. Otherwise it will be a mess.
I think you're saying that you would pathfind 100 times if you have 100 portals? If I understood you right, this is algorithmically very bad. What if your first 99 portal exit points are very far away from your destination? Obviously you waste a lot of time searching down those paths.

I think you have only one option if you don't want to change the mapper code itself:
You have to temporarily add exits from your current room to each of your portal destination rooms before pathfinding, and then remove the exits after pathfinding.
This is kinda bad-ish though, because what you're doing is creating a very large up-front branching factor for your search space. Maybe it works out OK because Mudlet is forcing every room to have coordinates somehow and then uses a euclidean heuristic A* based on coordinates instead of a guided BFS even though Aardwolf's terrain isn't actually euclidean. But anyway, I think it's better when doing this to actually change the mapper to pathfind in reverse, starting from the destination and working backwards. That eliminates up-front high branch factor caused by this.

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

Re: Global exits

Post by Vadi »

Apologies for not weighing in on this already - global portals are feasible and efficient Mudlet already and are used in the IRE mapping scripts. What I do there is create a temporary special exit in the room you start speedwalking in (if you can create a portal there) and let Mudlet compute the path (if it's efficient to use the portal, it will). Sometimes a portal is only available in a certain room or a certain environment - for that, the room movement event is listened to and the portal is created just then. After the pathfinding operation, the portal is removed.

I most certainly don't recommend creating a ton of portals. See https://github.com/vadi2/ire-mapping-sc ... .xml#L4759 for an example where it adds a special exit, uses getPath to compute a path, and then clears the exit with mmp.clearspecials. This has been very performant and used for a couple of years.

Post Reply