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: 339

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: 365
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
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