Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ VBscript ➜ Comprehensive Mud Mapping

Comprehensive Mud Mapping

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


Pages: 1 2  

Posted by Ashass   (50 posts)  Bio
Date Sat 04 Dec 2010 06:49 PM (UTC)

Amended on Sat 04 Dec 2010 06:51 PM (UTC) by Ashass

Message
I want to fully map a mud and display the data gathered in a meaningful way. I will have a jump start on things like directions, but I have a couple questions that I want to have answered before I undertake a long term project like this (and with the size of this mud, it really will be a long term project.)

Currently, I am using an MSSQL back end, and yes, I do have a reason for using it. Think of it as a supercharged MySQL or SQLlite database for the purposes of this project.

Needless to say, I'm also using VBScript

-------
Read questions below before looking at the last bit, it will help you see where I'm trying to go instead of what I've already done, in case there is a better method.


First question, is.. Other than the mapper tool built in to mush client, is there a more comprehensive tool, whether that's a plugin someone has already designed, or built in to mush client itself that I can build off of, or use to accomplish my goals, or will I need to design a system from scratch?

Next, is after I do have this data gathered is there a way to intelligently display the map? Preferably it would be grouped by area (so as you enter a new area, the map changes / redraws the mini window) - I've been experimenting a bit with mini windows, but I'm not really sure how I would draw a representation map of the area. I know how to easily show what room I'm actually in [from a database standpoint] and could spit out information about that, but to actually 'unroll' the map, and show it in that fashion... I have no idea.

Database example below
ID - room id, bigint
area - area you are in, nvarchar(50)
roomname - room in area you are in, nvarchar(50)
exits - NESWUD-NW-NE-SE-SW directions, nvarchar(50)
exitnorth - Name of room to north, nvarchar(50)
exitsouth - Name of room to south, nvarchar(50)
...east
...west
...up
...down
...nw
...ne
...se
...sw
roomdesc - description of room in area, text
notes - special notes about room in area, such as traps or requirements of things to do, eg: open door west, dig, etc


Map example below
map 30
        @ @%@    @ @          
      @ @ @@   @@@@@          
     @ @@@@@@@@""@@@          
      @@@@@  @ @@@@@          
      #@@@@@   %@@@@          
      @@@@@ @   "^@@          
     @@@@@@@    ^^^@          
      @@@@@#   %^^@@          
          %@    ^^@@          
      @   @%@  %^^@@          
      @@@@@@####^"@@          
       @    %%@"""@@          
      @@      @"%"%@          
      @     % @"####%         
  @@@ @@@@@@@@"# %%#"         
    @@@ @ @ @ @*####"#        
    @ @@@ @@@@%%%%##"#        
   @@@@@@  @@@@#%%%###        
@@@@@@@ @ %@@"@#%%%#%#   #    
   @@@ @@   @@@############   
   ~~%         "%#%#%#   #    
    %%%        # # # #   #    
     ^         ############   
                     #        


Each of those symbols is colored, the * represents where you are currently are - in game, this is red, I've bolded it for the purposes of being on a forum.


Room example below

look
By the Temple Altar
  You are by the temple altar in the northern end of the Temple of the
Gods.  A huge altar made from white polished marble is standing in front of
you and behind it is a ten foot tall sitting statue of Austinian, the King
of the Gods of Good.  The back of the altar opens into a beautiful atrium,
above which can be seen a rainbow.  Stairs lead up to a platform where an
old wise man sits with young pupils.  

 [Exits: north south up  ]
     A pit for sacrifices is in front of the altar.
(White Aura) A cleric of Siccara is here, selling spells.

<1068/1068hp, 358/358m, 310/310mv, (By the Temple Altar)[NSU]> 3:30am. 
You are in excellent condition.


For the purposes of mapping, this would be broken up in to three segments, first is after you 'look' the first line is the room name (Notice that it matches the name in (...) in the last line of prompt) - I figure something triggers off of 'look', using the prompt does a multi line match from the room name to [Exits: *] and stores the data as a description of the room, stores the room name (from the prompt) and exits

I'd also like to include the exit information
exit
To the north is The High Priests of Althainia's Chamber.
To the south is The Temple Of The Gods.
Upwards from here is Training and Practice Platform.


So that in the database, something like exitnorth would be populated with 'The High Priests of Althania's Chamber.'
Top

Posted by Nick Gammon   Australia  (23,070 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 04 Dec 2010 08:36 PM (UTC)

Amended on Sat 04 Dec 2010 08:37 PM (UTC) by Nick Gammon

Message
Er, have you seen this?

Template:post=10138 Please see the forum thread: http://gammon.com.au/forum/?id=10138.


That basically does what you describe, unless I misunderstand what you are saying.

Ashass said:

Needless to say, I'm also using VBScript


Well you will have to rewrite it totally then. The version presented there is in Lua. However if you insist on using VBscript you could use it as a guide for the general techniques.

Ashass said:

Database example below

ID - room id, bigint
area - area you are in, nvarchar(50)
roomname - room in area you are in, nvarchar(50)
exits - NESWUD-NW-NE-SE-SW directions, nvarchar(50)
exitnorth - Name of room to north, nvarchar(50)
exitsouth - Name of room to south, nvarchar(50)
...east
...west
...up
...down
...nw
...ne
...se
...sw


Really, this is not good database design. For one thing, in SQL you shouldn't have repeated things (in this case multiple exits) in a table - they should be in a separate table. The example GMCP mapper I did uses a database, and has exits in a separate table.

Template:post=10132 Please see the forum thread: http://gammon.com.au/forum/?id=10132.


For another thing, in a single entry you will have duplicated information. Namely the name of the current room, and then for each exit, the names of the rooms they lead to.

So if you need to change a room name, then not only does the current room need to be changed, but every other room that happens to lead to it needs changing as well.

A better SQL layout is:


  • Room table:

    • Room ID (room number)
    • Room area
    • Room name
    • Room description
    • Notes


  • Exit table:

    • Exit ID (assigned as some autoincrement number)
    • Which room it belongs to (parent) - ID in room table
    • Which way it leads (eg. n, s, e, w)
    • Which room it leads to


  • Area table:

    • Area ID
    • Area description
    • Area notes (eg. terrain)
    • Area low-level range
    • Area high-level range




So to find a room's exits you simply do a simple query that returns all exits whose room ID matches the current room ID.

Then, for each exit you find the room name. In fact a "join" query would return all exits, and their associated "to" room names, in one query.

I did another version of the mapper for a non GMCP MUD (Materia Magica) here:

Template:post=10667 Please see the forum thread: http://gammon.com.au/forum/?id=10667.


That (from memory) does what you describe, in that it matches exit lines and tries to work out which exits a room has, at least.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Ashass   (50 posts)  Bio
Date Reply #2 on Sat 04 Dec 2010 08:57 PM (UTC)
Message
Actually, You're absolutely right for the database tables. The layout I showed was what I cobbled together last night while tired, and once starting to implement I'd probably have smacked that right in the face.

No, I hadn't seen your first link, but I'll use it as a reference for sure, thanks! It's pretty much exactly what that portion of the project involved.

The second link is pretty awesome too, I'll look in to that, using it for collaborative updates between multiple people using the script would be pretty awesome, and could hook that up to a web server and have several people run it at once, it would fill in gaps fairly rapidly.
Top

Posted by Nick Gammon   Australia  (23,070 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 04 Dec 2010 09:26 PM (UTC)

Amended on Mon 25 Nov 2013 08:37 PM (UTC) by Nick Gammon

Message
Ashass said:

Currently, I am using an MSSQL back end, and yes, I do have a reason for using it. Think of it as a supercharged MySQL or SQLlite database for the purposes of this project.

...

The layout I showed was what I cobbled together last night while tired ...


Well since you don't actually have the database yet, perhaps I can steer you towards Lua? That way the mapper is already written. The database is already designed. I am finding that for mapping SQLite3 is quite fast enough. My mapper caches rooms in a Lua table once read from disk, so it switches from disk access (fast enough anyway) to memory access. Even drawing hundreds of rooms, it is getting the data into memory quickly.

This video here shows it in action, for example:

http://www.youtube.com/watch?v=kKro-Y68VOk

Also this one:




That is drawing a screen-full of rooms, no noticeable delay in accessing the database.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #4 on Sat 04 Dec 2010 10:16 PM (UTC)
Message
Nick Gammon said:
I am finding that for mapping SQLite3 is quite fast enough.

Yes... I would be absolutely shocked if you needed enterprise-level high-performance databases designed to handle thousands of queries a second in order to implement a MUD mapper. :-) SQLite should be more than sufficient.

What were your reasons for wanting to use MS SQL?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Ashass   (50 posts)  Bio
Date Reply #5 on Sun 05 Dec 2010 12:06 AM (UTC)
Message
Enterprise level database is for the larger project that this is just one piece of =P

And no, lua! Bad bad! No like. I did that mess for quite some time, and finally said nuffs nuff! and converted everything to vbscript.

It would be nice if you could declare scripting language per specific script though, like 'Default script language = LUA' - loaded script file has definitions like #language = vbscript and when you're done something like #endlanguage

or, you know,

<script='javascript'> </script>

Then I wouldn't be forced to choose one language over another, and I could use the best of both languages!
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #6 on Sun 05 Dec 2010 12:28 AM (UTC)
Message
Ashass said:
or, you know,

<script='javascript'> </script>

Then I wouldn't be forced to choose one language over another, and I could use the best of both languages!

You'd also be left with the mess of interoperating between these different languages.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #7 on Sun 05 Dec 2010 12:38 AM (UTC)
Message
Well, it seems that the project is secret to some extent and you can't give the reasons for why you need MS SQL. If you don't want to give away the project details, that's fine, but I would urge you nonetheless to carefully consider whether you're prematurely optimizing, or if you have empirical measurements establishing that you truly need such a complicated solution. (Enterprise-level performance is great but comes at the cost of complexity. SQLite3 databases are easy; "proper" databases are always more complex and harder to deploy.)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Nick Gammon   Australia  (23,070 posts)  Bio   Forum Administrator
Date Reply #8 on Sun 05 Dec 2010 02:01 AM (UTC)
Message
Ashass said:

It would be nice if you could declare scripting language per specific script though, like 'Default script language = LUA' - loaded script file has definitions like #language = vbscript and when you're done something like #endlanguage


Each plugin can have a different script language, and you can have multiple plugins. I don't quite see how you could usefully switch language mid-plugin.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,070 posts)  Bio   Forum Administrator
Date Reply #9 on Sun 05 Dec 2010 03:36 AM (UTC)

Amended on Sun 05 Dec 2010 03:37 AM (UTC) by Nick Gammon

Message
Ashass said:

And no, lua! Bad bad! No like. I did that mess for quite some time, and finally said nuffs nuff! and converted everything to vbscript.


I had the opposite experience, but I guess we all have to walk down our own path.

I just found Lua fast and easy to use. You can assign functions as they are first-class values (so they can be in tables, for example). Tables themselves are easy to use, search, set up. Tables can be nested. It has inbuilt regular expression matching, which can be very handy for decoding MUD text, or doing quick substitutions.

Some speed comparisons:

Nested loops:

http://dada.perl.it/shootout/nestedloop.html

Lua: 3.78 seconds. VBscript: 182.28 seconds.

Fibonacci Numbers:

http://dada.perl.it/shootout/fibo.html

Lua: 5.66 seconds. VBscript: 51.61 seconds.


If you are using MSSQL for speed, well you have thrown that advantage away by combining it with VBscript.

I can understand wanting to use a server-based SQL if you need to share an active database between users, perhaps over a network. Certainly it makes sense then.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #10 on Sun 05 Dec 2010 05:43 AM (UTC)
Message
Had it just been with respect to SQLite I would have understood the networking requirement. But MS SQL was given as a supercharged version of MySQL as well as SQLite, which is also server-based. Now admittedly the MySQL server is not as powerful as MS SQL, but it's not clear if the choice was driven by speed (in which case VBScript cancels any gain indeed) or for some other reason.

MySQL is also free, unlike MS SQL which costs a fair amount -- at least for the features which make MS SQL interesting in the first place. Its Express version is missing a lot of the secret sauce that makes the Enterprise version so nifty.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Ashass   (50 posts)  Bio
Date Reply #11 on Sun 05 Dec 2010 06:39 AM (UTC)
Message
It's not a secret, it's just a pain in the ass to type out everything I'm trying to accomplish.

And no, I'm not choosing vbscript for speed, I'm choosing it because it can (in some incarnation) interact with -everything-

It interacts beautifully <relatively speaking to lua, anyway> with asp .net programs, with mush, mssql, mysql, jet engine (access databases, excel, etc) and more programs then I'm going to list here

The mud itself is running on asp / mssql so if I design a very good component that the mud owner wants to use, his porting would be slim to none.

MSSQL is MUCH more powerful in reporting than pretty much any database short of oracle, not just in speed, but in what kind of reports it can pull, how it joins table data, subselects, etc.

I realize LUA is faster for a lot of things, but it's also much more restricted as far as a lot of things go.

However Nick, I wasn't aware you could use multiple languages via different plugins, I was operating under the assumption you only got to pick one script type under the triggers/alias menu (scripts->lua/vbscript etc) and what you picked is what you got.

So now I'm going to start investigating your plugin system more seriously, because if what you say is true, I don't *need* to do vbscript for the mapping portion, since that will have already been accomplished. As long as LUA can interract with the MSSQL database to write as back end data, I can have whatever I want access it [vbscript, mssql reporting software, asp web pages, php, whatever.] without affecting the larger population of my triggers.
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #12 on Sun 05 Dec 2010 08:10 AM (UTC)

Amended on Sun 05 Dec 2010 08:11 AM (UTC) by Twisol

Message
If you use LuaCOM, you can interact with COM objects just like VBscript can. LuaCOM's been included with MUSHclient since v4.60.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #13 on Sun 05 Dec 2010 08:28 AM (UTC)
Message
Lua has libraries for a lot of stuff, too... For starters, for SQL, you might want to check out: http://www.keplerproject.org/luasql/

As Nick said everybody walks their own road, but personally, having walked down the VBscript road for long enough, I would much rather have to deal with finding Lua libraries than ever touch VBscript again. :-P

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #14 on Sun 05 Dec 2010 08:59 AM (UTC)
Message
David Haley said:
As Nick said everybody walks their own road, but personally, having walked down the VBscript road for long enough, I would much rather have to deal with finding Lua libraries than ever touch VBscript again. :-P

That reminds me: someone actually wrote a VBscript interpreter in Ruby. Two things that should not have been mixed... :|

https://github.com/matthewd/rasp/

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
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.


68,641 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 page

Go to topic:           Search the forum


[Go to top] top

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