[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  Mapper DLL

Mapper DLL

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Pages: 1 2  

Posted by Kairuni   (8 posts)  [Biography] bio
Date Sun 01 Aug 2010 05:42 PM (UTC)

Amended on Sun 01 Aug 2010 11:16 PM (UTC) by Kairuni

Message
http://www.kairuni.com/Mapfile.png

Started working on this yesterday.

Not quite the same as Nick's mapper, as it stores room objects in a C++ vector with room coordinates, instead of drawing them one away from eachother.

The above map was drawn using SDL, and Achaea's map of Shallam.

Currently, it loads maps from a text file that takes about 600ms for 13000 rooms. It saves those rooms back to the database in about 200ms, as it doesn't have to parse the data.

The map above was generated in about one millisecond.

After I finish the DLL, I'll make an plugin that interfaces with it and uses all of the functions in the dll as an example. One with ATCP for the IRE MUDs, and one without, along with the source code.

I'm enjoying working on this =)

edit: More info.
[Go to top] top

Posted by Maxhrk   USA  (76 posts)  [Biography] bio
Date Reply #1 on Sun 01 Aug 2010 08:14 PM (UTC)
Message
In Russia, mapper DLL mapped me! IN any case, i am looking foward to watch your progress of your project. Good Luck!
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Sun 01 Aug 2010 08:54 PM (UTC)
Message

That image is:


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Kairuni   (8 posts)  [Biography] bio
Date Reply #3 on Wed 04 Aug 2010 12:15 AM (UTC)

Amended on Wed 04 Aug 2010 05:35 PM (UTC) by Kairuni

Message
Saving map and settings.
Saved 13482 in 0.22500000000001 seconds.

Loading map
Rooms loaded in 0.50999999999999 seconds.

Map drawn in the most dense area of Shallam
Map drawn in 0.010000000000105
10 milliseconds for a rather large number of rooms + the levels below + levels above. I suspect much of the time taken is from blitting the three surfaces together.

http://www.kairuni.com/Map_In_Client.png (Kinda big, thanks to my resolution.)

http://www.kairuni.com/mapper_update.png

Need to add a few more things to the plugin, and pathfinding, then I'll toss the source code up as well as the plugin :)

Non-ATCP plugin might be a bit, it's a small bit more difficult.
[Go to top] top

Posted by Tsunami   USA  (204 posts)  [Biography] bio
Date Reply #4 on Wed 04 Aug 2010 08:34 PM (UTC)
Message
Nice, I'll want to take a look at that. Does achaea now give you their own coordinates for every room? That would also eliminate the problem of identifying similar rooms.
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #5 on Wed 04 Aug 2010 08:57 PM (UTC)
Message
Tsunami said:
Does achaea now give you their own coordinates for every room? That would also eliminate the problem of identifying similar rooms.


Yep. However, Achaea also provides the Room.Num message which gives you Achaea's own internal room ID number, so you don't really need workarounds.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Kairuni   (8 posts)  [Biography] bio
Date Reply #6 on Thu 05 Aug 2010 12:16 AM (UTC)

Amended on Thu 05 Aug 2010 03:43 AM (UTC) by Nick Gammon

Message
Not for every room. They're what the Achaea mappers set for the rooms, so some of them look really bad when the areas are set to what they actually are (See: Cyrene, Shallam, Hashan, Ashtan, the various forests, savannah, etc)

Twisol, however, is correct :) It's one of bits of ATCP information that's sent.


Having a perhaps minor issue, however! Loading the plugin works fine in MUSHClient 4.54, however when I try in 4.55:


Run-time error
Plugin: Achaea_ATCP_Mapper (called from world: rwr)
Immediate execution
[string "Plugin"]:152: Function 'package.loadlib' disabled in Lua sandbox - see MUSHclient global preferences
stack traceback:
        [C]: in function 'error'
        [string "Sandbox"]:39: in function 'loadlib'
        [string "Plugin"]:152: in main chunk
Error context in script:
 152*: assert (package.loadlib ("mapper.dll", "mapper_open")) ()

[WARNING] D:\MUSHClientT\worlds\plugins\Keegan_DLL\ach_atcp_mapper_.xml
Line   64: Error parsing script (Cannot load)


I checked 'Allow DLLs to be loaded', and restarted MUSH a few times. :(

Does work if I comment out the lines that disable loadlib, but.. D:
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Thu 05 Aug 2010 03:53 AM (UTC)
Message
That message is not caused by the "allow DLLs to be loaded" checkbox. It is generated in the sandbox itself:


function MakeSandbox ()

  local function ReportDisabled (pkg, func)
     return function ()
       error (string.format (
        "Function '%s.%s' disabled in Lua sandbox - see MUSHclient global preferences",
        pkg, func), 2)
       end -- function
  end -- ReportDisabled 
...


Maybe you changed the first few lines to not trust worlds?


trust_all_worlds = false    -- change to true to trust all the worlds
trust_all_plugins = false   -- change to true to trust all the plugins
warn_if_not_trusted = false -- change to true to show warnings


Maybe you ran from a different directory, got the default global prefs, and that caused this? Check the Lua sandbox.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Tsunami   USA  (204 posts)  [Biography] bio
Date Reply #8 on Thu 05 Aug 2010 07:46 PM (UTC)

Amended on Thu 05 Aug 2010 07:51 PM (UTC) by Tsunami

Message
Kairuni said:

Not for every room. They're what the Achaea mappers set for the rooms, so some of them look really bad when the areas are set to what they actually are (See: Cyrene, Shallam, Hashan, Ashtan, the various forests, savannah, etc)


Could you clarify? What do you mean by not every room? Do some rooms not send coordinate information? If not, for which rooms and why not? Also, when you say Achaea mappers, I assume you mean the builders, not the players? Does this mean coordinates are not guaranteed to be unique, but are likely assigned automatically? Also, do coordinates operate on a per area basis?

I'm not sure what you mean by some areas looking bad? In the pictures above, there are no unintended overlaps or edge crossings that I see. Things are a bit crowded, but thats an artifact of drawing, rather than the layout. Also, these is an extremely good initial layout for passing into the layout program I wrote a while ago (I think you saw the link from that thread on the Achaean forums?)

For a game I haven't played in years now, Achaea still presents me some interesting programming problems, heh.
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #9 on Thu 05 Aug 2010 08:28 PM (UTC)
Message
Tsunami said:
Could you clarify?
Yes.

What do you mean by not every room? Do some rooms not send coordinate information?
Correct.

If not, for which rooms and why not?
The rooms where there is no MAP command output. The coordinates are used to draw the MAP; AFAIK there is no other use for them, and Achaean areas don't need to be Euclidian, as I can attest as I used to draw my own maps in Notepad.

Also, when you say Achaea mappers, I assume you mean the builders, not the players?
Yes.

Does this mean coordinates are not guaranteed to be unique, but are likely assigned automatically? Also, do coordinates operate on a per area basis?
They're assigned manually unless I'm quite mistaken; I've pointed out some issues in the distances between rooms in a few areas which were fixed promptly. Coordinates are pretty reliably unique per area however.

Answers in bold.

Tsunami said:
I'm not sure what you mean by some areas looking bad? In the pictures above, there are no unintended overlaps or edge crossings that I see. Things are a bit crowded, but thats an artifact of drawing, rather than the layout. Also, these is an extremely good initial layout for passing into the layout program I wrote a while ago (I think you saw the link from that thread on the Achaean forums?)

Whichever Immortal does the mapmaking seems to be unable to fit everything onto one "plane", so they move sections out of the way. It usually keeps things small, but it's also annoyingly ugly from a birds-eye view. The MAP has a fixed radius, so it's okay for that, but for birds-eye maps like the ones I made and for automappers, it's just not good.

It's definitely a good place to start, though.

Tsunami said:
For a game I haven't played in years now, Achaea still presents me some interesting programming problems, heh.

Hahah, I know what you mean :D

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Kairuni   (8 posts)  [Biography] bio
Date Reply #10 on Thu 05 Aug 2010 09:01 PM (UTC)
Message
Nick Gammon said:

That message is not caused by the "allow DLLs to be loaded" checkbox. It is generated in the sandbox itself:


function MakeSandbox ()

  local function ReportDisabled (pkg, func)
     return function ()
       error (string.format (
        "Function '%s.%s' disabled in Lua sandbox - see MUSHclient global preferences",
        pkg, func), 2)
       end -- function
  end -- ReportDisabled 
...


Maybe you changed the first few lines to not trust worlds?


trust_all_worlds = false    -- change to true to trust all the worlds
trust_all_plugins = false   -- change to true to trust all the plugins
warn_if_not_trusted = false -- change to true to show warnings


Maybe you ran from a different directory, got the default global prefs, and that caused this? Check the Lua sandbox.


Installing 4.55 over the 4.54 install seems to have fixed the issue, though a friend of mine's still having it while testing this with me. I'll pester him to check if he has MUSH installed anywhere else?
Didn't edit the sandbox at all, though.
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #11 on Thu 05 Aug 2010 09:10 PM (UTC)
Message
The sandbox starts out with those three lines false, anyways. You'll want to either change the first two to true, or manually add the world and plugin IDs to the lists lower down.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #12 on Sat 07 Aug 2010 06:34 AM (UTC)

Amended on Sat 07 Aug 2010 06:37 AM (UTC) by Nick Gammon

Message
Quote:

Function 'package.loadlib' disabled in Lua sandbox - see MUSHclient global preferences

...

I checked 'Allow DLLs to be loaded', and restarted MUSH a few times.


There are a couple of issues here. Many people will recall that Microsoft have come in for quite a bit of sledging because their operating systems are perceived as having security flaws. Unfortunately, good security and ease-of-use are quite often opposing design goals.

Earlier versions of Windows tried to make things easy for the end-user, but in the process arguably introduced potential security problems. More recently things have been tightened up, but you now have the counter problem that if people get used to hundreds of security warnings (and clicking on "OK - get on with it") then the usefulness of the warnings tends to go away too.

In the case of MUSHclient, I didn't want to get into the minefield of releasing software that could be easily used to compromise the end-user's PC, so in the case of Lua (over which I had some control), there were two levels of security introduced:


  • The "sandbox" in its default configuration disabled various functions (such as os.remove) which could potentially cause a lot of havoc. This sandbox was designed so that individual plugins (and world files) could be "trusted" so that, if necessary, they could do things like open and write files.

  • The second problem was loading DLLs. A DLL (dynamic link library) by its very nature can execute anything at all (like, scanning all your directories, finding interesting files, and uploading them to some server). Thus the checkbox "Allow DLLs to be loaded" was introduced, so that if unchecked, no DLLs could be loaded. However if checked, then you still have the fallback of needing to trust the plugin.


The function package.loadlib (which loads DLLs) was one of the things sandboxed for an untrusted world or plugin.

So basically to load DLLs you need to do two things - allow DLLs to be loaded (the checkbox) and also to either trust that specific plugin, or all plugins (assuming the loading is done by a plugin).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #13 on Sat 07 Aug 2010 06:46 AM (UTC)
Message
In my experience you also need to trust the world that the plugin will run in.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Kairuni   (8 posts)  [Biography] bio
Date Reply #14 on Thu 09 Sep 2010 11:26 AM (UTC)

Amended on Thu 09 Sep 2010 11:47 AM (UTC) by Kairuni

Message
Twisol said:

In my experience you also need to trust the world that the plugin will run in.


Aye, apparently need to trust the world, too.

Almost time for me to leave, ATCP mapper's rather functional, but I didn't make a non-ATCP plugin due to a lack of time. Will be releasing the plugin + source code later today (Though it's not terribly impressive, I don't think! Could use a few optimizations as well.)

Is there an easy way to get the world's unique ID? I just have it set to trust all worlds at the moment.
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


49,184 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]