Jump to content

world map links


fuzzie

Recommended Posts

I can't find the workings of the World Map documented much anywhere else, so here's my ramblings, would appreciate corrections/confirmations (although GemRB already matches this behaviour which is a good sign):

 

When an actual area movement is done using a world map link, the *first* world map link matching the destination area seems to be the one used. For instance, if there are both 'North' and 'South' links to a target area with different flags/encounters, the North encounters are the ones used and the North encounter probability is the one modified if necessary, no matter whether you actually use the north or south link.

 

In fact, the link direction grouping seems to only be used for working out whether a link exists at all to a certain destination, presumably only in order to set 'Reachable' on areas marked 'Visible from adjacent'. Once Reachable is set then the destination always appears reachable on the world map no matter which edge of the start area you leave from, although you can't actually travel without at least one link existing, clicking just does nothing. (Am I missing something here, or can you really travel to any area marked Reachable from any other area? It seems like a lot of links would be missing - never mind, I guess this is done by joining links together until we find a path to the destination?)

 

IESDP's interpretation of the direction flags ('default entry location') when no entrance is specified seems correct (you're randomly dumped in the middle of the edge specified by the flag, I didn't check what happens if there's an entrance present for that edge, like in AR1100 to AR1404). If I set the flag to 5 then it always dumps me at the north edge (1) and if set to 6 then it always dumps me at the south edge (4), so it looks like it's just checking the bits one-by-one rather than doing any randomisation magic.

Link to comment

I think link fields are labeled in one of the ToB 2DAs. That should be everything in the structure that does something.

 

Actual world map pathfinding is largely unknown, but I suspect heavy consultation with Satan at several points along the way. The code to figure out which links you take (it should be hopping from nearest link to nearest link, not in one solitary jump?) is fairly hefty IIRC; I don't know the logic behind it. Taimon probably would.

 

All but two or three BG2 areas specify entrance coordinates and orientation in the ARE, with the world map links connected to the various entry points by name. You shouldn't ever get dumped out in random locations unless you're changing the choice of links? Certainly, I don't remember the flags doing anything noticeable (other than crashing when 0)...

Link to comment
All but two or three BG2 areas specify entrance coordinates and orientation in the ARE, with the world map links connected to the various entry points by name. You shouldn't ever get dumped out in random locations unless you're changing the choice of links? Certainly, I don't remember the flags doing anything noticeable (other than crashing when 0)...

 

If you look at the unpatched (some patch/fixpack fixes it) AR1100 (Umar Hills) to AR1404 (first Temple Ruins) link, there's no entrance specified for any of the links but you end up in the right place anyway (this is why I started looking at this). There *is* an entrance on the west side of AR1404 (ExitE) that has about the same coordinates, but if you change the flags of the link (8 by default) then the engine will happily dump you out at another edge without an entrance being anywhere near, so I doubt it's using it.

Link to comment
I don't know the logic behind it. Taimon probably would.

Please stop teasing me like that. ;)

There are others (you and Avenger in particular) who have a much better understanding of how the IE works.

 

I can confirm most of the stuff that was discussed here.

Link direction is only used for determining visibility/reachability.

 

The routing algorithm is standard Dijkstra (shortest path). However, I think the implementation is buggy.

The algorithm correctly considers all links between two points, when calculating the shortest path. But when it finally creates the linked list of travel links, it always takes the first link between to points. The links are checked in this order: north, south, west, east.

So if you have multiple links (with different travel time) between two points, you may get non-optimal results.

 

Default entrance bits are check in the same order as the links above. One of it must be set.

 

By the way, bntychnc.2da is referenced in the random encounter section of the code. It looks like the 2da defines an extra probability for a specific reputation. The random encounter area resref is modified when it matches. (Last two chars are replaced by "10". So AR0500 would get modified to AR0510.)

However, the result seems to be unused, so you can ignore it. :)

Link to comment

It's used in BG/TotSC. Rows are reputation value; column is probability in dumping out to a bounty variant iff a random encounter is normally triggered. I believe it does the correct thing with the probability for the real link encounter (probability > 100 = trigger encounter; subtract 100 and save result) even though you're hitting a bounty area, but it's been years since I looked.

 

As you note, the code consulting bntychnc is still there in BG2, but it isn't used for anything.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...