# Challenges Faced

## UI issues on different devices

Initially, when we started the project, we positioned the UI elements in terms of pixels in our application. \
We soon realized that positioning them in terms of pixels was a bad idea when we found differences in the UI in our respective devices/emulators (Frederick handles the Android UI while Kim Lai handles the iOS UI).&#x20;

Some elements would be overlapping each other, or texts might be too big for certain buttons causing them to be cut off.&#x20;

The solution we found is to use a percentage instead of pixels. This will ensure the same UI throughout all screen sizes.&#x20;

## Route generation

Originally, we wanted to use MapBox instead of Google Directions as the API to generate routes for us. However, there were difficulties with integrating MapBox into the app's MapView component. Luckily for us, there were no issues when we used Google.&#x20;

For the actual algorithm, we initially wanted to have all 3 points (2 random points + origin) on the perimeter of the imaginary circle. However, we could not find a way to do it ourselves nor a module to help us achieve this, instead, we found a module that takes in a point (origin) and a radius (input distance) to produce a random point on the imaginary circle.&#x20;

## Background and Foreground States

There is 3 different App States: Active, Inactive, Background.&#x20;

When we first started programming the app's logic flow on how it should behave during active and background states. We started with only handling when the app state changes from "Active" to "Background" and all seems to work on Android platform. \
However, when testing on iOS platform, it appears to not be working properly. This is due to the iOS platform having a transitioning state "Inactive" between "Active" to "Background" states.&#x20;

Therefore, we have to separate the logic for each platform in order for our app to properly detect a change in state.&#x20;

To put it simply,&#x20;

| Platform | Locking device / From App to Home Screen | Resuming App         |
| -------- | ---------------------------------------- | -------------------- |
| iOS      | Active -> Inactive -> Background         | Background -> Active |
| Android  | Active -> Background                     | Background -> Active |

## Character Stats

Balancing the stats of avatars to make our PVP system fairer proved to be quite a challenge.&#x20;

All users' stats start off at 100/10/10/10/10 initially, with only male or female avatars (no jobs). \
Then when we thought of implementing the job system, we found that it would be better to have variations to the stats in accordance to the job. For example, a mage should have a higher MAGIC stat than the other 2 jobs.

While trying to balance the stats with the 100/10/10/10/10, we found the figures too hard to play around with. So we decided to scale it up and came up with a base stat of 200/30/30/10/10, and each stat point is worth 10 HP and 2 ATK/MAGIC/DEF/MR. Therefore, the base stat is worth 60 stat points.

To give the 3 jobs a difference, we gave 15 bonus stat points to each job.&#x20;

| Stat            | Base | Warrior  | Mage     | Archer   |
| --------------- | ---- | -------- | -------- | -------- |
| HP (1pt = 10)   | 200  | 250 (+5) | 200      | 200      |
| ATK (1pt = 2)   | 30   | 30       | 30       | 60 (+15) |
| MAGIC (1pt = 2) | 30   | 30       | 60 (+15) | 30       |
| DEF (1pt = 2)   | 10   | 20 (+5)  | 10       | 10       |
| MR (1pt = 2)    | 10   | 20 (+5)  | 10       | 10       |

We felt this was adequate for our simple PVP system.&#x20;

## Coming up with a PVP system

This was actually the last feature implemented and was the hardest part to think of... \
Throughout the whole project, from acquiring new knowledge to ideation to UI design to writing the algorithm to Firebase usage, we were totally lost on the game aspect and have nothing planned.&#x20;

We just knew we wanted turn-based combat, something like Pokemon's combat system where each player takes turns hitting each other. We even explored a "race with your friend" kind of gamification but ultimately decided against it.

As we were thinking of how we can add our own spin on turn-based combat, we saw an upcoming game (Monster Hunter Stories 2) and got a little inspiration and got reminded of the Final Fantasy series. That is when we decided to include some sort of "Rock-Scissors-Paper" style of combat, with some way to mitigate damage and outplay opponents.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://run-mania.gitbook.io/run-mania/things-we-learnt-closing-thoughts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
