Mapping variable room sizes

Post Reply
davidwiththenicehat
Posts: 23
Joined: Tue Jul 02, 2019 4:29 pm

Mapping variable room sizes

Post by davidwiththenicehat »

Hello

Wondering if anyone has worked with mudlet's mapper and a game that has room sizes that vary.
I have access to near by rooms xposition, yposition and size. I know if rooms connect because I have connection points that appear on a map.
I am running into graphing issues.
For example I know the position and sizes of room in reference to the player's current room. I don't know which of these is the one directly to the east.
Sometimes I will get data for 80 or so nearby rooms. All in reference to how they should appear on a graph where you are standing. The center of the players room is 0,0 on the graph.

I have loads of data. I even know how to graph. I've already made it so these rooms draw on a simple map to show nearby rooms
I don't know how to do things like determine if two rooms are side by side.

In short does anyone know where I go to learn about this? Is there an API for these things?
Thanks for your time and knowledge!

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Mapping variable room sizes

Post by Vadi »

Wouldn't different exit lengths accomplish what you're looking for?

davidwiththenicehat
Posts: 23
Joined: Tue Jul 02, 2019 4:29 pm

Re: Mapping variable room sizes

Post by davidwiththenicehat »

With certainty it is not anything the mapper is failing to do or offer.
The exit node setup works over the span of 8 rooms with no issues. 8 is the max room size. Those rooms have been connecting without issues.
So the problem comes when I attempt to make room of different sizes. For example, this message:

Code: Select all

SKOOT 6 0,0,10,#ff0000,3.276,0,-10,10,#00ff00,2.548,10,0,10,#ffffff,15.728,-20,0,20,#ffffff,5.096,0,10,10,#00ff00,2.548,20,0,20,#ffffff,17.548,-20,-20,20,#ffffff,5.824,20,-20,20,#ffffff,17.912,40,0,10,#ffffff,15.728,20,20,20,#ffffff,17.912,-10,-30,10,#ffffff,5.824,20,-30,10,#ffffff,5.46,40,10,10,#ffffff,16.82,0,40,40,#ffffff,5.46,-20,-30,10,#ffffff,5.096,0,-30,10,#ffffff,5.46,10,-30,10,#ffffff,5.096,40,40,40,#ffffff,5.096,-40,40,40,#ffffff,5.096,-30,-30,10,#ffffff,5.46,-80,40,40,#ffffff,5.824,-80,0,40,#ffffff,5.46
Tells me to draw rooms in this image: Image
Were the pattern for the SKOOT 6 image is --SKOOT 6 x, y, size, color, lighting
The red room is always first and is the room the player is in. Green rooms are just rooms that share a type. Nothing useful for mapping.
Exits are done with a different message.

Becuase I don't know how to graph properly I had thought that when I moved I could accurately map with

Code: Select all

if dir == "north" then
    y = y+(1*((room.size)+(previousRoom.size)))
  elseif dir == "northeast" then
    y = y+(1*((room.size)+(previousRoom.size)))
    x = x+(1*((room.size)+(previousRoom.size)))
  elseif dir == "east" then
    x = x+(1*((room.size)+(previousRoom.size)))
  elseif dir == "southeast" then
    y = y-(1*((room.size)+(previousRoom.size)))
    x = x+(1*((room.size)+(previousRoom.size)))
  elseif dir == "south" then
    y = y-(1*((room.size)+(previousRoom.size)))
  elseif dir == "southwest" then
    y = y-(1*((room.size)+(previousRoom.size)))
    x = x-(1*((room.size)+(previousRoom.size)))
  elseif dir == "west" then
    x = x-(1*((room.size)+(previousRoom.size)))
  elseif dir == "northwest" then
    y = y+(1*((room.size)+(previousRoom.size)))
    x = x-(1*((room.size)+(previousRoom.size)))
  elseif dir == "u" or dir == "up" then
    z = z + 1
  elseif dir == "down" or dir == "d" then
    z = z - 1
  end --if dir ==
In reality what happens is that does not provide the accurate x and y position of the room I am walking to.
For example, my code sees this space: Image
As: Image
When I am done I have the data to make the mudlet map above look like: Image
Where it knows how to link rooms as a move. Than more importantly, it knows where rooms should be positioned. Areas with more rooms get completely mangled.

Though I do have the position of adjacent rooms available in that SKOOT message. I need to learn to do things like, tell room that is in position 0,-1 with a size of 1 is the room that shares a border with the players current room than what direction that room is in.
Once I figure that out I can use the data provided to draw the exits to figure out if these two rooms connect. I do get a handy message telling me in what directions exits are available.
There are other details I would need to address. All of which become a lot easier once I understand how to track this all properly.

User avatar
SlySven
Posts: 1019
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Mapping variable room sizes

Post by SlySven »

The rooms in Mudlet are all the same size and the coordinates for them are integers and mark the centre of the room in the map display. Therefore you have to ignore the sizes. However you can draw rectangular coloured labels either on top or beneath the rooms so it ought to be possible to draw such things underneath the rooms themselves and to make them represent the actual size of the room that you want. Do you get fixed numbers to represent each room and is each room always in the same place and the same size that you encounter it?

What IS this Mud BTW?

davidwiththenicehat
Posts: 23
Joined: Tue Jul 02, 2019 4:29 pm

Re: Mapping variable room sizes

Post by davidwiththenicehat »

The game is The Eternal City.
For us we receive these "SKOOT" messages like mentioned in my third post. I use that to draw the local area, it appears as that image in the post.

For us and I am guessing for any game with variable sizes you have to get the x-y adjustment of the room you moved from and than moved into. You would not need this if a game had a set location for each room. Unlikely though, because why else would a game have variable room sizes...

In shoot I use that SKOOT 6 message. That tells me the x, y and size of the room.
There is another SKOOT message 10, that tells me where to draw the exits.

So I say, this exit at the top of the current room is drawn vertical. It is a north exit. Than I find what room intersects that exit. I then sort that room data into a table for that exit.

When the player moves I essentially do exit[direction].room.x and then y to change where the room is on the mudlet map.
So instead of having the

Code: Select all

if dir == "north" then
elseif series I have

Code: Select all

y = y + -(parthiaMap.previousRoom.confirmedExits[dir].room.ypos) - roomSizeAdjustment --use the location of the current room in reference to the previous room to decide the players coordinates
          x = x + parthiaMap.previousRoom.confirmedExits[dir].room.xpos + roomSizeAdjustment ----use the location of the current room in reference to the previous room to decide the players coordinates
Just to provide a really broad reference for someone stuck mapping variable room sizes in the future.
If anyone is looking for a frame a reference: https://github.com/TheEternalCitizens/m ... its/master
PRs that are from branches that start with "MudletMapper" Example PR: https://github.com/TheEternalCitizens/m ... n/pull/103

Turned out to be a LOT of fun to do. I thought I needed to figure room area to a table. Then compare. I realized you can do it with just basic graphing math.

Post Reply