TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

Map format -> displaygrid_build

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Development
View previous topic :: View next topic  
Author Message
Brax



Joined: 13 Feb 2017
Posts: 5

PostPosted: Mon Feb 13, 2017 4:53 am    Post subject: Map format -> displaygrid_build Reply with quote

Hi all,
I'm trying to do a small side project to read/parse/display the tt map file. I'm using the source to pull bits out to convert it to a php function so I can use to display the map on website (Dynamically, I know I could just load and export the map anyway), and anyone else who would ever want such functionality.

I've got pretty much all of it done, If I manually populate map->grid I get a nice image out, the issue I am having is getting head around the logic used in displaygrid_build to construct the grid. (c isn't my native language).

any info would be greatly appreciated.

Thanks

ofc if I ever get it working, i'll post it here for any website owners who want to use (i'm using it to display maps of areas for drops)
Back to top
View user's profile Send private message
PowerGod



Joined: 04 Aug 2014
Posts: 352

PostPosted: Mon Feb 13, 2017 3:34 pm    Post subject: Reply with quote

The "bad" thing about tt++ mapper is that it's designed to show a dynamic representation of it from the point of view of the actual room you are in...

If a map is REALLY simple (no mazes, no hidden rooms, no up/down or strange recursions), then it could be draw without issues, but have a look at something like this:

room [a] is connected East with [b], while [b] is connected East to [a]

now, if you are in room [a], you will see this in the mapper
Code:

[a] -- [b]


while if you are in [b]
Code:

[b] -- [a]


so, that's the same map, but with 2 different visualizations... and this was even a "simple" case...

I think that the only way to make a really useful map out of it is to reinvent the thing... for example something like the ZMUD mapper graphically can do...

The previous example could be statically represented in a way similar to this:
Code:


[a] -- [b] --
  \          /
    --------
Back to top
View user's profile Send private message
Brax



Joined: 13 Feb 2017
Posts: 5

PostPosted: Tue Feb 14, 2017 7:59 am    Post subject: Reply with quote

Thanks for the reply.

The problem I was having was understanding how the function displaygrid_build() was actually constructing the map->grid structure. I couldn't see the Method(?) for better word, it was following to create the array.

I think I made some headway getting it into my head on how it works, which is giving me promising results on my sample map of around 4k rooms (each [ ] is hyperlinked to create a new vnum center point to navigate the map) and the page render times are around 0.1s to re-read the map file, rebuild the map structure and redisplay the map.

Much tinkering left to do. but thanks for the reply!
Back to top
View user's profile Send private message
Slysven



Joined: 10 Apr 2011
Posts: 375
Location: As "Jomin al'Bara" in WoTMUD or Wiltshire, UK

PostPosted: Sun Feb 19, 2017 12:45 pm    Post subject: Reply with quote

Yeah, TinTin++ is unusual amongst MUD clients in that it has a "dynamic" on-screen map representation - the position of neighbouring rooms is entirely dependent on the "starting" or "centre" room and everything is drawn relative to that room. In some situations it can help to use "void" rooms that merely provide a two-exit dummy room that can be put between actual rooms as a "spacer" in order to make them always line up the same manner even though their exits and other interconnecting rooms would not make this possible.

If your map is not "stable" in that rooms seem to jump around as you go to different rooms then it will be very hard to generate a map from the map file data which does NOT include any positional information for each room - precisely because the positions are not fixed and are entirely dependent on the room you start from.

Some time ago I did post a patch that reports where a room is located relative to the current room at the centre of the map which can be useful to gather position data but only if all the rooms are "stable". I haven't checked to see if the #map locate command ever made it into the released code base but if it did you might experiment with going to the first room (assume it is at 0,0,0) and then iterating through all the rest - determining the relative position of them and storing that coordinate data in each room for your external parser to use...
Back to top
View user's profile Send private message
Brax



Joined: 13 Feb 2017
Posts: 5

PostPosted: Sun Feb 19, 2017 4:38 pm    Post subject: Reply with quote

Thank you all for the replies...

What I was basically Trying to do was recreate "#map map" in a browser, so I can link an sql item database of loot/drops to a location..

I couldn't for the life of me see the logical methodology behind displaygrid_build() function. So I wrote my own (It is probably far less efficent as php isn't my native language, but it works). I now call the page mapper.php?vnum=xx and it basically does the same as #map map focused around the start-room (dynamic rebuild of map). Because I'm parsing all the exit/room flags i'm already taking into account void/hidden rooms/exits..

I am running into an issue with larger maps, with the rooms overwriting themselves, but i think thats part of my rewrite of the grid-build logic (as i didnt understand the origional anyway Big Smile)

I appreciate the replys a lot thanks!. I'll post the php if it's anything anyone would be interested in once I tidy it up and fix the large map issue (32k rooms seems to cause an issue on an old converted map).

Ta again!
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3842

PostPosted: Sun Mar 04, 2018 10:07 am    Post subject: Reply with quote

Slysven wrote:
I haven't checked to see if the #map locate command ever made it into the released code base but if it did you might experiment with going to the first room (assume it is at 0,0,0) and then iterating through all the rest - determining the relative position of them and storing that coordinate data in each room for your external parser to use...

It's still on my todo list, and I'll probably implement it slightly differently.

Brax wrote:
I couldn't for the life of me see the logical methodology behind displaygrid_build() function. So I wrote my own (It is probably far less efficent as php isn't my native language, but it works).


I have the same problem, often I have to stare at my old code for a while before it starts to make sense again. I'm not even sure if adding comments would be helpful.

Brax wrote:

I am running into an issue with larger maps, with the rooms overwriting themselves, but i think thats part of my rewrite of the grid-build logic (as i didnt understand the origional anyway Big Smile)

TinTin++ uses breadth first. It starts out at the center, then it maps the rooms with a distance of 1, then it maps the rooms with a distance of 2, then rooms with a distance of 3, etc.

What I assume you are doing is mapping the first exit, then the first exit's first exist, then the first exit's first exit's exit, etc. This only gives good results if the map is layed out properly.

If you are using breadth first, maybe you're allowing more distant rooms to overwrite more nearby rooms.

Brax wrote:

I appreciate the replys a lot thanks!. I'll post the php if it's anything anyone would be interested in once I tidy it up and fix the large map issue (32k rooms seems to cause an issue on an old converted map).

It could be interesting to look at, especially if there is some way for people to easily run the code themselves.

Currently there's no agreed upon system for using room data to create informative html maps. The room note could be shown when hoovering the mouse over the room, but the room data can contain a table, so that'd be more suitable to list mobs and loot.
Back to top
View user's profile Send private message Send e-mail
Slysven



Joined: 10 Apr 2011
Posts: 375
Location: As "Jomin al'Bara" in WoTMUD or Wiltshire, UK

PostPosted: Sun Mar 04, 2018 8:35 pm    Post subject: Reply with quote

Many moons ago I did experiment and had something that did manage to do that - it was also using a custom font with some Private Use characters to draw a 5x3 room symbol in the same manner as the detailed ASCII map style, I had put together a way to - with the use of an embedded java script library to get hovering over rooms to bring up the room number/description and notes. Also the cursor would change over an up/down or out of area exit so clicking on them would jump to the "page" for that Z coordinate or - if it was an exit to another map - to the corresponding exit in the other file after asking whether it was okay.

Ir did need me to make some pretty Frankensteinian additions to the map code to do this and it is so long ago that I am not certain that there was not unstomped on bugs.

I'd attach some sample (incomplete but proof of concept) HTML here but it looks like attachments aren't allowed - (I'd forgotten that about the TinTin++ forums) - but I have just put them up on the just created Wik page on my TinTin++ GitHub repository (which is also some years out of date...
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3842

PostPosted: Mon Mar 05, 2018 6:03 pm    Post subject: Reply with quote

Very cool stuff. Ecstatic
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Development All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group