Skip to main content

Mathematical Functions & Optimization Calculations for OSRS

Project description

The Mathematics and Optimization of OSRS

The purpose of this project is to accurately model Old School Runescape mechanics in order to optimize or analyze game play. This game is played over long periods of time (months or years) and so players are often seeking the most optimal route to their desired accomplishments. In particular, combat is a particularly rewarding application, as very complex problems that were previously unsolved for decades can now be.

If you're interested, you can join the discord to discuss anything!

There are three components to this project:

1. Applications

These application provide useful functionalities for end users. Once installed, they can be run using the command: python -m [Module Location].

Application Module Location Description
Optimize osrsmath.apps.optimize.main What is the most efficient equipment to wear when fighting a given opponent?

The optimize app.

2. Library

For developers, they can use the basic functionalities (like modeling combat or potion boosts) to build their own applications. The code is available on PyPi, and can be installed using pip3 install osrsmath. Within their own code the can import functionalities using import osrsmath.[module_of_interest]. Download the source, and check out the documentation for the modules at OSRSmath/osrsmath/docs/html/osrsmath/index.html to see what can be done.

3. Documentation

Coherent and comprehensive documentation doesn't really exist regarding the math behind osrs. This project provides a document that attempts to fill this gap. It also documents its source code, which can be viewed by downloading the source and navigating to osrsmath/docs/html/osrsmath/index.html. In future, it would be nice to host this online.



This application was written in the programming language Python, which has two major version. python3 is the version used here, more specifically any version greater than 3.6.3 should work (the latest is best).

  1. To install Python simply visit the download page.
  2. Once it is installed, open a terminal (MacOS/Linux) or command prompt (Windows).
  3. Type the command pip3 install --upgrade pip then pip3 install osrsmath to install this program.
  4. Then type python3 -m osrsmath.apps.[app_name].main to run an application. For example, replace [app_name] with optimize to run the optimize application.

You might also consider trying the executables directly, although there are currently installation issues, particularly on MacOS so this isn't currently recommended. To do this, navigate to GitHub releases and download the latest version (Asset) for your system. Unzip, and run!


  1. Open a terminal/command prompt.
  2. Make sure you have python3.6+ installed (type python --version)
  3. Make sure pip3 is installed (type pip3 --version).
  4. Update pip pip3 install --upgrade pip
  5. Update setuptools pip3 install --upgrade setuptools

To install the apps, or to use as a library:

  1. pip3 install osrsmath

To develop the code:

  1. Download the github source code, unzip it and place it anywhere.
  2. Open a terminal in that directory (which contains
  3. Run pip3 install -e .

Run the desired application with: python3 -m osrsmath.apps.[app_name].main. Linux may require sudo apt-get install python3-pyqt5

These installation methods have been tested on: Ubuntu 20.04 (using wsl1 on windows), MacOS (Catalina 15.15.5), and Windows 10 (v1909)



These are instructions for creating app executables:

  1. Type pip3 install PyInstaller
  2. On MacOS, python<=3.6.3 is required since PyInstaller on macos isn't supported after that. On Windows, the app store version of Python (3.8) doesn't work.
  3. Navigate to the Application folder of the app you want to create an executable for.
  4. Type python3
  5. Symbolic links should then be created to dist/main/main[.exe], the should be named osrsmath-[app_name].

On MacOS, the application has to be signed. I don't know the Mac ecosystem very well, however these websites helped me:


GUI Development:

These are instructions for creating & modifying the GUI design:

  1. Use QT designer.
  2. Create or modify a .ui file in QT designer.
  3. Run python -m osrsmath.apps.GUI.shared.util make to compile them.


To compile the latex documents a latex compiler needs to be installed. MiKTeX is a good cross-platform option. Alternatively, on linux you could simply type sudo apt-get install texlive-full.

The central document can be compiled with pdflatex main.tex. The html documentation uses pdoc3 which can be installed with pip3 install pdoc3. Then the documentation can be compiled by naviating to the top directory (containing and type:

pdoc --html osrsmath -o osrsmath/docs/html -c latex_math=True --force
python osrsmath/docs/


The unittest module is used for testing. Navigate to the tests directory and run the command python3 -m unittest


If you are interested in contributing, check out the issues section on GitHub.


This open-source project is licensed under the MIT License - see the LICENSE file for details.



  • osrsbox - Provides Data files
  • dijkstar - Implements the dijkstra Algorithm


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

osrsmath- (2.9 MB view hashes)

Uploaded source

Built Distribution

osrsmath- (3.0 MB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page