Documentation
¶
Overview ¶
Package route plans an efficient order for a character's quest stops: pick-ups, objectives and turn-ins, with map coordinates. The order comes from a deterministic optimiser (Held-Karp up to ExactMax stops, then nearest-neighbour improved by order-respecting 2-opt and or-opt), never from a language model. The rules are in docs/plan-format.md.
Index ¶
Constants ¶
const ( MaxSteps = 20 // stops on the route; the rest go to "later" MaxLater = 30 // stops listed in "later" LevelMargin = 1 // a quest above the player's level + this goes to "later" MergeRadius = 3.0 // objective stops this close (map percent) on one map are one stop ClusterSize = 8.0 // spawns this close (map percent) are one cluster )
Limits.
const ( KindPickup = "pickup" KindObjective = "objective" KindTurnIn = "turnin" KindTravel = "travel" )
Stop kinds.
const ExactMax = 12
ExactMax is the most stops solved exactly; larger routes use the heuristic.
const File = "Plan.lua"
File is the file name, next to Digest.lua.
const Schema = "1.0"
Schema is the Plan.lua format version (docs/plan-format.md).
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FindStop ¶ added in v0.7.0
type FindStop struct {
N int `json:"n"`
QuestID int `json:"quest_id,omitempty"`
Quest string `json:"quest,omitempty"`
Label string `json:"label"`
}
FindStop is an objective the planner could not place on the map: something to find, with no x or y.
type Plan ¶
type Plan struct {
Character string `json:"character"`
Zone string `json:"zone,omitempty"`
Start *Point `json:"start,omitempty"`
Steps []Stop `json:"steps"`
Later []Stop `json:"later,omitempty"`
Find []FindStop `json:"find,omitempty"` // objectives with no known location; not on the route
Distance float64 `json:"distance"` // route length in map percent
Naive float64 `json:"naive_distance"` // the quest-by-quest order's length, for comparison
Total int `json:"total"` // stops on the route, a travel stop included
Notes []string `json:"notes,omitempty"`
}
Plan is the ordered route for one character.
type Problem ¶
type Problem struct {
Nodes []Node
Start *[2]float64
// Scale multiplies a distance (map percent to yards, say); 0 means 1. It does not change the order
// on a single map, only the reported length.
Scale float64
}
Problem is an open path from Start (nil: free start) through every node, respecting Pred.
type Stop ¶
type Stop struct {
N int `json:"n"`
Kind string `json:"kind"`
QuestID int `json:"quest_id,omitempty"`
Quest string `json:"quest,omitempty"`
Label string `json:"label"`
Map int `json:"map"`
X float64 `json:"x"`
Y float64 `json:"y"`
Done bool `json:"done"`
}
Stop is one place on the route.