Skip to content

Commit 3f9018c

Browse files
committed
Revisions to draft ILP blog post
1 parent 6bacffa commit 3f9018c

File tree

1 file changed

+79
-39
lines changed

1 file changed

+79
-39
lines changed

docs/blog/review/optimizing-ffxiv-trust-exp-with-ilp.md

Lines changed: 79 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: An example of applying ILP to solve an optimization problem.
3-
date: 2024-07-07
3+
date: 2024-07-09
44

55
search:
66
exclude: true
@@ -9,20 +9,22 @@ hide: [navigation, toc]
99

1010
# Optimizing FFXIV Trust EXP with Integer Linear Programming
1111

12-
I've been a long time player of _Final Fantasy XIV_, and in the past weeks I've been playing its recently released expansion _Dawntrail_.
12+
I've been a long time player of _Final Fantasy XIV_, and in the past weeks I've
13+
been playing its recently released expansion _Dawntrail_.
1314
As is typical for expansions to massively-multiplayer online role-playing games,
1415
_Dawntrail_ raised the level cap--from level 90 to level 100.
1516
This also includes a corresponding increase to the level cap of the Trust
16-
system, a game mode where the player can form a party with three non-playable
17-
characters (NPCs) and take them into a dungeon.
17+
system, a game mode where the player can form a party with three AI-controlled
18+
non-playable characters (NPCs) and take them into a dungeon.
1819
Since each dungeon takes approximately 30 minutes to clear and there are 8 NPCs
1920
to level up in total, it would take quite a lot of time to get all NPCs to
2021
level 100.
2122

2223
This begs the question: what would be a strategy for minimizing the number of
2324
runs (i.e., time) required to get all NPCs to level 100?
2425
To get an answer, I ended up writing a calculator that can compute such a
25-
strategy, and I will be describing how it works in this article.
26+
strategy, and I will be describing how it works in this article--no background
27+
knowledge on FFXIV required.
2628
You can find the source code [here][calculator-sources].
2729

2830
<!-- more -->
@@ -34,48 +36,86 @@ You can find the source code [here][calculator-sources].
3436
If you are playing FFXIV but haven't started the story for _Dawntrail_,
3537
proceed at your own risk.
3638

37-
## The Optimization Problem in Detail
38-
39-
Before we think about a strategy, let's try to understand the problem more
40-
carefully.
39+
## A Problem of Trust
40+
41+
Before we think about a strategy, let's try to understand how Trusts work in
42+
detail.
43+
44+
In the Trust system, the player selects a _party_ consisting of exactly four
45+
characters, where one character takes on the role of a "tank", one character
46+
takes on the role of a "healer", and two characters take on the role of "DPS".
47+
The player chooses which role they want to play themself, and then they choose
48+
AI-controlled NPCs to fill the remaining roles.
49+
Each NPC has a different set of roles; for example, one of them can only take
50+
on the tank role, while another character can take on two different roles.
51+
52+
!!! example
53+
One possible Trust party is one where the player decides to play as a healer
54+
role, and then they choose the characters Thancred, Alphinaud, and Alisaie
55+
for the tank and two DPS roles, respectively.
56+
57+
Thancred and Alisaie each only have one role.
58+
However, Alphinaud may be chosen for either a healer or DPS role.
59+
60+
Once the player has formed a party, they can then play through a _dungeon_.
61+
Each playthrough, which I will refer to as a "dungeon run", takes approximately
62+
30 minutes to complete.
63+
64+
### Levels
65+
66+
Every character has two numerical quantities called _level_ and _experience_
67+
(typically shortened as "EXP").
68+
The level is a reflection of the progress or strength of the character, and it
69+
is a general goal of the game to increase the level to its maximum value
70+
possible (the "level cap", which is 100 for _Dawntrail_).
71+
In order to increase the level, the player must accumulate _experience points_
72+
by accomplishing tasks, such as completing a Trust dungeon.
73+
74+
Each dungeon has a minimum level requirement, such that a dungeon can only be
75+
run if all party members have a level exceeding that of the minimum.
76+
There are five _Dawntrail_ dungeons available with the Trust system, unlocked at
77+
levels 91, 93, 95, 97, and 99, respectively.
78+
For example, the level 95 dungeon can only be run by a party where all members
79+
are at least level 95.
80+
81+
Once a dungeon run is fully complete, a fixed amount of EXP will be awarded to
82+
all Trust NPCs that participated in that run.
83+
Higher level dungeons award more EXP.
84+
85+
For the dungeons from levels 91 to 100, the Trust system provides 8 NPCs that
86+
may be used in parties.
87+
The amount of EXP required to level an NPC up increases as the NPC's level
88+
increases;
89+
however, for each level, the amount of EXP required to level up is the same for
90+
all characters.
91+
92+
### Trust EXP
4193

4294
The problem, which I will call the "Trust EXP Problem", consists of coming up
4395
with a list of parties (duplicates allowed) that can be be used in Trust dungeon
4496
runs, such that the NPCs can be levelled up from level 91 to level 100.
45-
46-
* In the Trust system, each party consists of exactly four characters, where one
47-
character takes on the role of a "tank", one character takes on the role of a
48-
"healer", and two characters take on the role of "DPS".
49-
The player chooses which role they want to take on, and then they choose NPCs
50-
to fill the remaining roles.
51-
* From levels 91 to 100, the Trust system provides 8 NPCs to play with.
52-
* The amount of EXP required to level an NPC up increases as the NPC's level
53-
increases;
54-
however, for each level, the amount of EXP to level up is the same for all
55-
characters.
56-
* Each NPC has a different set of roles; for example, one of them can only take
57-
on the tank role, while another character can take on two different roles.
58-
* There are dungeons unlocked at levels 91, 93, 95, 97, and 99.
59-
A dungeon can only be run if all party members have a level exceeding that of
60-
the dungeon's.
61-
For example, the level 95 dungeon can only be run by a party where all members
62-
are at least level 95.
63-
* Once a dungeon run is fully complete, a fixed amount of EXP will be awarded to
64-
all Trust NPCs that participated in that run.
65-
Higher level dungeons award more EXP.
66-
67-
While the EXP considerations are significant, it is the number of runs that are
68-
the most important for this problem.
69-
For example, the level 91 dungeon awards about 5.8 million EXP, but leveling up
70-
from 91 to 92 requires 13 million EXP.
71-
It will therefore take 3 dungeon runs to level up from 91 to 92.
97+
Specifically, we would like to minimize the total number of dungeon runs that
98+
must be performed so-as to save time.
7299

73100
I'll use the term "strategy" to refer to a solution to the problem.
74101
For example, a strategy for leveling all eight NPCs from level 91 to 92 could be
75102
to run the dungeon three times with the first three NPCs, run the dungeon three
76103
times with the next three NPCs, and then run the dungeon three more times with
77104
any party that contains the last two NPCs.
78105

106+
!!! note
107+
EXP considerations are somewhat secondary here as they are a somewhat
108+
continuous measurement of the progress towards leveling up.
109+
One issue is that EXP is awarded in discrete, not continuous chunks.
110+
For example, the level 91 dungeon awards about 5.8 million EXP, but leveling up
111+
from 91 to 92 requires 13 million EXP.
112+
It will therefore take 3 dungeon runs to level up from 91 to 92.
113+
However, those 3 runs will award more EXP than is required to level up.
114+
115+
We will focus on the number of runs initially.
116+
Later, we will see that EXP needs to be factored in to construct a better
117+
strategy.
118+
79119
## Formulating the Trust EXP Problem as an ILP problem
80120

81121
A solution to this problem will be lower-bounded by $M$, while the objective
@@ -673,7 +713,7 @@ Excluding the healer role excludes a larger number of better strategies, though
673713
I understand why someone might not be interested in playing as a healer in
674714
Trust dungeons...
675715

676-
## Was this worth it?
716+
## Was this worth the time?
677717

678718
In total, I spent around an afternoon writing the calculator and had a lot of
679719
fun in the process (more than I did playing the game).
@@ -686,8 +726,8 @@ You can find my email address on the home page.)
686726

687727
Would it be worth spending 31 hours trying to level up all Trust NPCs from 91 to
688728
100?
689-
That's something you'll have to ask yourself.
690-
Personally, I'm not sure if I want to.
729+
It might be a nice side goal if you primarily play DPS roles and you don't want
730+
to bother with long matchmaking queues.
691731

692732
In any case, you can find the source code for the calculator
693733
[here][calculator-sources].

0 commit comments

Comments
 (0)