Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > f9cd280fd4519b5a7d09e5f3b0fbbc8d > files > 9

mmapper-2.1.0-2.fc14.x86_64.rpm

The path machine is the core of the auto-mapping algorithm. The name is composed of "path" and "state machine" and it might sound stupid. There are various parameters you can use to improve the quality of the generated map. To use them a general understanding of how the path machine works is required:

There are three states the path machine can take. Depending on it's state it will do different things. The current is always visible in the log window. I'll start with the most trivial state:

- Syncing: In this state the path machine doesn't have any indication of where the player is. This happens for example in the beginning after logging in or if the player fled in an unknown direction into a previously unmapped room. It will then compare every room description received to all rooms that already are in the map. The comparison isn't done one-by-one as this would be quite slow. Instead a tree searching algorithm is used here, like everywhere a room is to be searched by its description. If and only if exactly one matching room is found the "Approved" state is entered. 

- Approved: In this state the path machine knows the exact room the user is in. After you have mapped a large part of arda this will be the most common state to be in. In this state every movement (and the resulting room description) of the user is checked against the mapped area and as long as the user stays in that area and no room has changed since it was mapped the path machine will just stay in Approved. If the user walks out of the mapped area the path machine will start mapping the newly found rooms and enters "Experimenting".
In "Approved" the "matching tolerance" parameter is used. As we compare only one room per move here we can apply tolerant matching, which means that a certain percentage of the characters in a room description may differ from the mapped room. This happens when a typo was fixed for example. You can set the percentage with the "matching tolerance" parameter and if the tolerance was used the room will be automatically updated.


- Experimenting: In this state the path machine takes a few guesses of paths the user might have taken since the last "Approved" room. These guesses are rechecked after every movement and bad paths are thrown away. If there is only one path left or one path is considered overwhelmingly likely that path is accepted and the "Approved" state is entered. After each user movement, while in experimenting state, the path machine creates a new room for each path end, so that the paths can be properly extended. Each path is not only extended with its respective new room though, but also forked to all other rooms matching the room description that was received. When the "Experimenting" state is left all newly created rooms that are not on the accepted path are removed again.
The decision of how good or bad a path is is mainly based on the distance each step in the path takes. If the distance between two neighbouring rooms is far the path is considered unlikely, if it's near it's considered likely. Most of the parameters you can tune are about this decision:

- "accept best relative" determines by what relative factor a path has to be better than all others to be accepted. 
- "accept best absolute" determines by what absolute amount a path has to be better than all other to be accepted. This additional parameter is necessary because two paths can end in the same room and be extended with the same next room in every step, so that the relative difference won't change. On the other hand the previous parameter can't be dropped because the likelihood even of the best path can get very small if a lot of new rooms are created and then it would take very long to accept a path only by absolute amount even after known rooms have been passed.
- "new room penalty": The likelihood of a path passing a newly created room will be divided by this factor to decrease the chance of creating duplicate rooms. 
- "correct position bonus": Normally, when a path is extended, the likelihood is divided by the distance between the expected position (based on previous room on the path and direction of movement) and the actual position of the next room. If the next room is at the expected position this would be a division by zero. This parameter specifies a factor with which the likelihood is to be multiplied if the next room is at the correct position. Also the likelihood will be multiplied by this parameter if there already is a connection between the previous room and the next one, even if the next room is not in the correct position.
- "multiple connections penalty": This parameter is used to prevent the mapper from truncating all of Greenway into one room. The likelihood of a path is divided by this number if either the room the path is to be extended to is the same as the previous room on the path or the previous room already has a connection in the move direction, but to another room than the one the path is to be extended to. Setting this to high amounts prevents mapping of random areas correctly though.
- "max paths" finally is the maximum number of paths that should be kept around. In a second check after "accept best" all path likelihoods, multiplied with maxPaths and divided by the actual number of paths, are compared to the likelihood of the best path. If the likelihood of the best path is still greater the path is dropped. Like that creation of new paths is encouraged of few paths are around but growth is limited if there are many.