Project L: Mapping

by Unknown

Back to Project L.

Unknown2007-03-28 14:42:45
Here's my Lusternia version of Whyte's mapper. I included the full MudBot and the MMChat module, too, but removed the other Imperian-specific stuff. You'll need the MinGW compiler to make use of the code, of course.

I updated the TODO file with a few things I'd like to see in this LMapper code, like the ability to manually set the room terrain type or some form of scriptable room events. I'm also not sure what you guys did for the speedwalking around cows, sheep, etc, but I thought it would be silly of me to repeat something that's already been done, so I'll look at your code when it's posted and integrate that into my code.
Unknown2007-03-28 15:59:47
QUOTE(Zarquan @ Mar 28 2007, 04:42 PM) 394289
Here's my Lusternia version of Whyte's mapper. I included the full MudBot and the MMChat module, too, but removed the other Imperian-specific stuff. You'll need the MinGW compiler to make use of the code, of course.

I updated the TODO file with a few things I'd like to see in this LMapper code, like the ability to manually set the room terrain type or some form of scriptable room events. I'm also not sure what you guys did for the speedwalking around cows, sheep, etc, but I thought it would be silly of me to repeat something that's already been done, so I'll look at your code when it's posted and integrate that into my code.

You sure this code in parse_room() works? Might want to add a check to see if buf isn't allready a capital letter.
CODE
if (title_offset)
{
    buf = buf - 32;
}


In the block messages, add this:
CODE
"The hazy image of a white stag runs in front of you, bumping you back and ",
"There is a reinforced door in the way.",
"There is a steel door in the way.",
"There is an iron door in the way.",


After line 4953 (parse_follow()), add this:
CODE
if ( room >= 'a' && room <= 'z' )
    room += 'A' - 'a';


Also add some ..
CODE
&& ( l->line < '0' || l->line > '9' )
    return;

.. to enable numbers in room titles..

And, how about removing the pear defense referencies? I haven't seen something like that in Lusternia, nor do I feel it should be a part of a map-system.

Also, I've attached my current map of Lusternia. No environment type set at all, since I wanted to wait with that until I had a good way to fix the mess that the devs have created.. It does got all the cities, communes, highways and mountain chains in it. A good 2500+ rooms in there.

Finaly, because I'm curious, what happened with the code I sent you? Looks like you've reinvented the wheel by doing the same changes I did, minus some of my improvements that you left out. The only real difference I see is the new copyright message at the top.
Unknown2007-03-28 18:33:27
Thank you very much for the feedback.

I didn't end up using the code you sent me because I started from Whyte's base code to get a feel for how it worked as-is and doing diffs isn't my strong suit. I know I re-invented the wheel a bit, but I wanted to kinda code things myself and understand it all better. This is one of the problems with collaborating without having a central code repository, obviously.

The buf - 32 works because title_offset is non-zero only when the first letter is lowercase because the room title is prefaced with something like "Flying above "...

I didn't get around to removing the pear defense, though I was considering replacing it with waterbreathing (bit of a pain, maybe). For the short term, I'm not mapping underwater rooms and just making sure I always have waterbreathing and waterwalking. tongue.gif

The rest are very good changes, so I'll be sure to add those in!

Thanks again (and for the map, too).
Unknown2007-03-28 18:46:32
QUOTE(Zarquan @ Mar 28 2007, 08:33 PM) 394327
I didn't end up using the code you sent me because I started from Whyte's base code to get a feel for how it worked as-is and doing diffs isn't my strong suit. I know I re-invented the wheel a bit, but I wanted to kinda code things myself and understand it all better. This is one of the problems with collaborating without having a central code repository, obviously.

I see. I'd love to take a more active role in this fork though, seeing as how I got it started (or so I'd like to believe, heh). Perhaps we should set something up at sourceforge, where we'd have a central code repository? Anyway, congrats to pulling something off.

QUOTE(Zarquan @ Mar 28 2007, 08:33 PM) 394327
Thank you very much for the feedback.

Any time. I have some code for ability-parsers too that I could add, like deathsight, cosmic window, etc. I'll try to post it tomorrow when I come home.

Also, since I forgot to check, did you include the fix for Lusternian ATCP that I sent you? It's a lovely feature, especially with the ILua module.
Unknown2007-03-28 19:55:42
I did incorporate fixes for the ATCP, yes. It works fine for me. I don't use the ILua module yet, partially because I haven't had the time to look into it and partially because I'm already using Lua in MUSHclient for testing this stuff.

I already managed one SF project for several years. Feel free to take the lead on this one, if you want, and I'll get the files into CVS, no problem.
Unknown2007-03-31 17:38:49
QUOTE(Zarquan @ Mar 28 2007, 09:55 PM) 394336
I did incorporate fixes for the ATCP, yes. It works fine for me. I don't use the ILua module yet, partially because I haven't had the time to look into it and partially because I'm already using Lua in MUSHclient for testing this stuff.

I already managed one SF project for several years. Feel free to take the lead on this one, if you want, and I'll get the files into CVS, no problem.

There was already one LMTS on SF but I have requested to take it over since it doesn't look active at all. You're still interested in continuing this though, right?

You really should take a look at ILua. Add in the lrex addon and there's no going back. wink.gif

Another minor thing I've added to my TODO is a filter for the ridiculously long area names for Mag and Celest, which also changes if I recall it correctly? Also, I have successfully converted the Voting module, so now you can just type "vote" and LMTS automaticly goes to TMS and votes. Great for the lazy of us. I'll include it in the CVS whenever I get access.
Unknown2007-04-01 00:28:30
Yup! I'm still interested, though the time I have to devote to it will be limited at times. Let me know if you get anywhere with the SF project.
Unknown2007-04-02 11:22:41
QUOTE(Zarquan @ Apr 1 2007, 02:28 AM) 394543
Yup! I'm still interested, though the time I have to devote to it will be limited at times. Let me know if you get anywhere with the SF project.

Now it says "APT Approved by SF.net" on my projects listing. It also says that it'll take 2-3 weeks to fully process a take over. I'll post a more extensive map before that though, hopefully when I get home from work today.

Have you written parsers for any scrying-like abilities, Zarquan?

And Jello, how did you fix the cow bump problem with the speedwalker? I thought perhaps matching the prompt before sending each new direction to walk in (which would also solve tranverse and similar in paths) but I haven't looked at how you do it yet.
Unknown2007-04-02 11:23:36
Damn these doubles..
Unknown2007-04-02 14:03:53
I've played around with parsers for the scry-like abilities, but haven't gotten one to work yet. I know the WHO parser won't work as-is for Lusternia because we can't WHO (person) the way they do in Imperian.

My guess is that Jello fixed the cow problem by just adding a new block message, but I haven't looked at his code yet.

Update:
Got the 'window' spell working for both short and long names.
CODE
void parse_window( char *line )
{
   char name;
  
   DEBUG( "parse_window" );

   if ( strncmp( line, "cosmic window, you see ", 23 ) != 0 && strncmp( line, "the cosmic window, you see ", 27) != 0 )
     return;

   get_string( line + 23, name, 256 );

   line = strstr( line, " at " );

   if ( !line )
     return;
  
   line += 4;

   locate_room( line, 1, name );
}
Unknown2007-04-02 15:09:02
QUOTE(Zarquan @ Apr 2 2007, 04:03 PM) 394943
I've played around with parsers for the scry-like abilities, but haven't gotten one to work yet. I know the WHO parser won't work as-is for Lusternia because we can't WHO (person) the way they do in Imperian.

My guess is that Jello fixed the cow problem by just adding a new block message, but I haven't looked at his code yet.

Shouldn't be too hard to modify the WHO parser, or what do you think? I haven't looked at it myself, mainly because I haven't even gotten thirdeye on my character yet. tongue.gif It's a really nice feature to have though. That and the ES parser.

Wouldn't such a fix just spam the direction command until it goes through? It'd work, I guess, but it wouldn't be very sexy.

Nice work with that parser, I'll check it out when I get home.
Unknown2007-04-02 16:28:58
Whyte's mapper already does just spam speedwalk moves, but it gags the messages for being too hasty. He handles some special cases like trying to open doors and then trying to unlock the locked ones, but it's still a brute force method to speedwalking. The nice thing about this method is that it scales well with your celerity-type movement bonuses and network latencies.
Unknown2007-04-02 16:58:40
Yeah, I didn't think of that. I'll add cows, sheeps and transverse as block messages then. Anything else you can think of?

That parser of yours worked like a charm. But only with rooms with short names. sad.gif And don't you believe it'd be best to initialize these kinds of functions, to take into consideration that first preceding line. Or else it could trigger off of something that's not a window message.

I was inspired by your code and made a parser for deathsight:
CODE
void parse_dsight( char *line ) {
    DEBUG( "parse_dsight" );

    if ( strncmp( line, "You see the death occur at ", 27 ) != 0 )
        return;

    line = strstr( line, " at " );

    if ( !line )
        return;

    line += 4;

    if ( line >= 'a' && line <= 'z' )
        line += 'A' - 'a';

    locate_room( line, 1, NULL );
}

QUOTE
Exoro has been cut down by a female aslaran.
You see the death occur at by a large fire. (3051)
From your knowledge, that room is in 'Grey Moors.'
Unknown2007-04-02 17:49:45
I wouldn't worry too much about these parsers matching on extra lines because the text has to come at the beginning of a line and has to have a person's name and location in it to fall all the way through the function.

I've noticed the problems with long room names, too, so I'm formulating a method to parse subsequent lines in such cases. It may end up being a bit of a hack, but half of Whyte's parsing is a sort of brute force hack and is fast mostly because it's in C and is separate from the game or the client.

Nice job on the deathsight mod.


Update:

I modified the parse_window function to make it work for really long room names. Basically, it grabs the first part and remembers it for the next pass. I first created a pair of variables for remembering the person's name and the chunk of the room name that was found.
CODE
char locate_room_name = { 0 };
char locate_pers_name = { 0 };


Then, I re-wrote the entire logic of the parse_window function to handle the special cases (and fixed the bug with long/short player names in the process).
CODE
void parse_window( char *line )
{
    int name_offset = 0;
    DEBUG( "parse_window" );

    if ( !strncmp( line, "cosmic window, you see ", 23 ) )
        name_offset = 23;
    if ( !strncmp( line, "the cosmic window, you see ", 27) )
        name_offset = 27;

    if ( !name_offset )
    {
        if ( locate_room_name )
            strcat( locate_room_name, line );
        else
            return;
    }
    else
    {
        get_string( line + name_offset, locate_pers_name, 20 );

        line = strstr( line, " at " );

        if ( !line )
            return;

        line += 4;
        if ( line >= 'a' && line <= 'z' )
            line -= 32;

        strcpy( locate_room_name, line );

        if ( line != '.' )
        {
            if ( locate_room_name != ' ' )
                locate_room_name = ' ';

            return;
        }
    }

    locate_room( locate_room_name, 1, locate_pers_name );

    memset( locate_room_name, 0, sizeof( locate_room_name ) );
    memset( locate_pers_name, 0, sizeof( locate_pers_name ) );
}


This new function works in my limited tests, so I hope it's good enough to serve as a model for a few other functions like it.


Another Update:

When I added a function to parse Scent, I found that I needed to know which parse function was supposed to handle the remainder of the room name. I could generalize it and let a single "secondary" parse function handle the room name leftovers and then locate the room, but that might not work for all locating abilities, so I'm just going to track which function was the last to look at the room title and all others will ignore the next line. In other words, this function got a little more complex but not too much.
Unknown2007-04-02 20:26:41
Nice, now it works like a charm. I have a question though - why does the following code work?
CODE
if ( line >= 'a' && line <= 'z' )
            line -= 32;

To me it looks like you're telling it to lowercase it if it's lowercase, which would convert it to some funky char. But since it's working I'm obviously missing something. tongue.gif

Here's my current map and the Voter module, modified for Lusternia. You load it (`load voter.dll) and then just type "vote" and it'll do the rest.
Unknown2007-04-02 20:31:50
That code works because it's just written differently from the same thing you use. You add -32 to yours and I subtract 32 from mine. 'A' is 32 less than 'a' on the ASCII code chart.

I've modified my mapper now to open doors and go through them, no matter the type of door. Also, I believe I've just found the proper place to add the cow/sheep code, so I'll probably get to that next.
Unknown2007-04-03 14:15:45
Ahh, I thought it was the other way around with 'a' coming before 'A'.

Anyone competent up for mapping the Inner Sea? I think I just broke a brain synapse trying to make something. Between the tumbling waves and identical room names, you also have the irrational room connections. Tell me if you're interested in giving it a shot and I'll send you my latest map, so that I dont map anything in vain.
Unknown2007-04-03 17:13:38
I mapped the Inner Sea surface, nothing underwater yet. I could send you just that part, but you'd have to connect the rooms by hand, which is a bit of a pain. Flying over the Inner Sea with a Brooch of the Tempest is the best way to do it, so long as you have my updated LMapper with the room titles fix. smile.gif
Unknown2007-04-03 19:38:57
QUOTE(Zarquan @ Apr 3 2007, 07:13 PM) 395188
I mapped the Inner Sea surface, nothing underwater yet. I could send you just that part, but you'd have to connect the rooms by hand, which is a bit of a pain. Flying over the Inner Sea with a Brooch of the Tempest is the best way to do it, so long as you have my updated LMapper with the room titles fix. smile.gif

Heh, it was one of my first fixes. I do lack, however, a brooch. :/

Could you please send me that area or anything to show me how you've done with the northeastern part of the Inner Sea? I can't get it to look good without using "exit stop" and that's cheating. tongue.gif
Unknown2007-04-03 20:36:41
My northeastern side that connects to the tidal flats is still a bit of a mess. I'll clean it up by in the text file, as I find that easier for things like that.

I've got another little fix for you today. I noticed that the 'area off' wasn't really turning off areas. They were disabled, but nothing in the pathfinder was set to ignore the disabled areas. I coded this little fix such that if you're in the disabled area you can still speedwalk out of it, but if you're outside the area it won't speedwalk through it. I turned off the Inner Sea right off the bat and tested this fix in and out of it. Works like a charm, so I hope it's just this simple.

In the add_openlist function, put this right at the top:
CODE
// Don't consider rooms that are disabled for speedwalking unless we're already in the area
    if (dest->area->disabled && dest->area != current_area)
        return;