# The Mathematics of Old School Runescape

#### Links:

- Interactive Quest Visualizer
- Mathematical Game Modeling and Optimization (PDF)
- Open-Source GitHub Repository

#### Reddit Posts:

- A Physicist's Guide to Re-balancing Combat - Damage Distributions (3.4k upvotes)
- I made a "Quest Tree" for OSRS (1.1k upvotes)
- Mathematical Model of Wintertodt & Time to 99 (450 upvotes)
- Mathematically Optimal Order to Train Melee Combat (350 upvotes)
- The Mathematics of OSRS Combat (50 upvotes)

#### Video Series:

- There is also a Video Series detailing these solutions:

The goal of this Open-Source Python Project is to model the game Old School Runescape for the purpose of exploring optimization and game theory. In this large online game millions of players collect items, fight monsters, and leveling up skills (among many other things) over months, years, and even decades. This means that even small improvements can save people significant huge amounts of time.

In addition to seeking out optimal player decisions, the elegance of the mathematical solutions is always surprising and results in really interesting graphs and visualizations that can provide useful insight.

For example, you can take a flattened list of quests in the game, and render them to show which quests are required to do which other quests. This creates a complex graph that describes the Runescape Universe. To obtain the Quest Cape, players need to complete every quest, essentially solving a difficult graph-theory problem. Players en-mass solve this problem heuristically and share results to prepare guides/routes for other players to do it more efficiently. Setting this up as a graph offers a new perspective / tool to tackle this problem for players.

The first problem I tackled was to figure out the optimal equipment for a player to wear to maximize their damage while fighting monsters. This required a model of the damage a player could do, which could then be optimized. There are an enormous amount of equipments available to the player and brute-force searching through all these combinations would be impossible! Instead we have to do what's called a search-space reduction which would eliminate redundant equipment choices. This reduced the number of considerations from 10^18 to about 250-500 choices, making this a brute force approach now feasible! Since this problem is such a common decision for players, I created a user interface in python (using PySide2) for it, as you can see below. Now players can easily determine what their (mathematically exact) best equipment choices are.