Skip to content

Commit

Permalink
README updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tylercamp committed May 6, 2024
1 parent 063bd72 commit 735ca3c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 28 deletions.
File renamed without changes.
46 changes: 18 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![Pal Calc Screenshot](./docres/palcalc-screenshot.jpg)

Pal Calc is Windows program for calculating the optimal steps to breed a specific pal with a specific set of traits:
Pal Calc is a Windows program for calculating the optimal steps to breed a specific pal with a specific set of traits:

- Can detect and read from your local game save files, based on [palworld-save-tools by cheahjs](https://github.com/cheahjs/palworld-save-tools)
- Supports local Steam saves and Xbox saves
Expand All @@ -18,57 +18,56 @@ Pal Calc is Windows program for calculating the optimal steps to breed a specifi
- Flexible search process
- Allows wild pals
- Set a max number of undesired traits if you're ok with imperfect pals
- Set limits on the number of breeding steps and time estimates
- Set limits on the number of breeding steps
- Choose which pals you want to include by filtering by guilds and players
- Efficient
- Low memory usage and fast load times
- Relatively fast path-solving process, searches take under a minute
- Distributes path-solving work across all available CPU cores

This can all probably be ported into a webpage, but I've put in enough effort with this first version. It would be great if someone else could work on that.

# Community Help

Pal Calc currently has some outstanding pieces that need more information to resolve. Most of these need some level of reverse engineering to resolve, but some can be figured out through experimentation and statistics. An issue has been created for each item, where more information can be found.
Pal Calc currently has some outstanding pieces that need more information to resolve. Some of these need some level of reverse engineering, but some can be figured out through experimentation and statistics. An [issue](https://github.com/tylercamp/palcalc/issues) has been created for each item, where more information can be found.

* Is there a formula for how long breeding takes? Or is it a constant five minutes?
* What's the probability of wild pals having a specific gender? (Namely for pals which are known to have different gender probabilities from breeding)
* What's the probability of wild pals having exactly N traits?
* Do child pals _always_ inherit at least one of the parent's traits?
* How is data mining performed to extract the pal stats necessary for breeding calculations?
* Has the trait inheritance calculation changed since /u/mgxts reverse engineered it? Was their reverse engineering accurate?
* Assuming the trait inheritance calculation is correct, is Pal Calc's implementation of those probabilities correct?
* How can we derive the map coordinates for a base from its world coordinates?
1. Is there a formula for how long breeding takes? Or is it a constant five minutes? [Issue](https://github.com/tylercamp/palcalc/issues/2)
2. What's the probability of wild pals having a specific gender? (Namely for pals which are known to have different gender probabilities from breeding) [Issue](https://github.com/tylercamp/palcalc/issues/3)
3. What's the probability of wild pals having exactly N traits? [Issue](https://github.com/tylercamp/palcalc/issues/4)
4. Do child pals _always_ inherit at least one of the parent's traits? [Issue](https://github.com/tylercamp/palcalc/issues/5)
5. How is data mining performed to extract the pal stats necessary for breeding calculations? [Issue](https://github.com/tylercamp/palcalc/issues/6)
6. Has the trait inheritance calculation changed since /u/mgxts reverse engineered it? Was their reverse engineering accurate? [Issue](https://github.com/tylercamp/palcalc/issues/7)
7. Assuming the trait inheritance calculation is correct, is Pal Calc's implementation of those probabilities correct? [Issue](https://github.com/tylercamp/palcalc/issues/8)
8. How can we derive the map coordinates for a base from its world coordinates? [Issue](https://github.com/tylercamp/palcalc/issues/9)
9. What's a good way to estimate time needed to capture a wild pal of a certain type? e.g. Chikipi would be much faster to find + catch than Paladius. [Issue](https://github.com/tylercamp/palcalc/issues/10)

# Development

Visual Studio Community 2022 is required. The `.CLI` projects act as test programs which can be ran without involving the whole Pal Calc UI.

## Palworld Database

The list of pals, traits, and stats are stored in a `db.json` file embedded in `PalCalc.Model`. This file is generated by the `PalCalc.GenDB` project. Running this project will update the `db.json` file in `PalCalc.Model` which will be used by the rest of the projects. The input files for this, stored under `PalCalc.GenDB/ref`, can be manually modified to include entries for new pals and stats if needed.
The list of pals, traits, and stats are stored in a `db.json` file embedded in `PalCalc.Model`. This file is generated by the [`PalCalc.GenDB`](./PalCalc.GenDB/) project. Running this project will update the `db.json` file in `PalCalc.Model` which will be used by the rest of the projects. The input files for this, stored under `PalCalc.GenDB/ref`, can be manually modified to include entries for new pals and stats if needed.

The `db.json` file should _not_ be modified manually. It should be modified by changing the contents of `PalCalc.GenDB` and re-running the program to regenerate it.

Pal icons are scraped using the `FetchIcons/fetch.js` program which can be ran using NodeJS. This will use https://palworld.gg to collect the high-resolution version of each pal icon as a separate file.

## Save File Support

Save file parsing is in `PalCalc.SaveReader`, which is a partial C# port of [palworld-save-tools](https://github.com/cheahjs/palworld-save-tools). By default this will not preserve the full parsed data of a save file, but this can be changed by adding the `ARCHIVE_PRESERVE` build flag. See the project's [README](PalCalc.SaveReader/README.md) for more information.
Save file parsing is in `PalCalc.SaveReader`, which is a partial C# port of [palworld-save-tools](https://github.com/cheahjs/palworld-save-tools). By default this will not preserve the full parsed data of a save file, but this can be changed by adding the `ARCHIVE_PRESERVE` build flag. See the project's [README](./PalCalc.SaveReader/) for more information.

## Data and Solver Model

Palworld data collected from Palworld or a save file are represented by types in `PalCalc.Model`. Instances of an owned pal within the game are represented by `PalInstance`.
Data collected from Palworld or a save file are represented by types in `PalCalc.Model`. Instances of an owned pal within the game are represented by `PalInstance`.

The solver logic in `PalCalc.Solver` wraps this type with `IPalReference` types, which can represent owned, wild, and bred pals. The `IPalReference` types are returned by `PalCalc.Solver.BreedingSolver`, but you can use `OwnedPalReference` results to fetch underlying owned instances.

## Pal Calc UI

The general structure of the `PalCalc.UI` project is somewhat messy. The application uses WPF and (weak) MVVM for handling its UI. MVVM was largely followed for convenience and it was not strictly adhered to. There are various hackfixes since many features were unplanned and added through the path of least resistance. Refactoring is planned and gladly accepted.

Entries the `Resource` folder are set to the `Resource` build action and embedded in the final program.
Entries in the `Resource` folder are set to the `Resource` build action and embedded in the final program.

The Community Toolkit library is used for the viewmodels, which provides the `ObservableObject`, `ObservableProperty`, and other utilities. These use code generation to automatically implement `private` fields as `public` properties with the appropriate `INotifyPropertyChanged` logic.
The Community Toolkit library is used for the viewmodels, which provides the `ObservableObject`, `ObservableProperty`, and other utilities. These use code generation to automatically implement `private` fields annotated with `[ObservableProperty]` as `public` properties with the appropriate `INotifyPropertyChanged` logic.

`GraphSharp`, a defunct library [preserved after the Codeplex shutdown](https://github.com/NinetailLabs/GraphSharp), does not have any documentation. It was added here by referencing [hollowdrutt's implementation](https://github.com/hollowdrutt/GraphSharpDemo) of a useful overview/walkthrough of its usage [by Sacha Barber](https://sachabarbs.wordpress.com/2010/08/31/pretty-cool-graphs-in-wpf/).

Expand All @@ -85,14 +84,6 @@ The Community Toolkit library is used for the viewmodels, which provides the `Ob
- Update PalDB reference data for recent game updates
- Figure out reliable process for updating DB.json with latest pal + trait info (where can I find a frequently-updated source of all required info?)
- General UI/UX improvements
- ~~Bugfix - Solver prefers breeding a pal to get an opposite gender instead of just using the existing pals~~\
- ~~Reduce memory usage~~
- ~~Separate "max irrelevant input traits" and "max irrelevant bred traits"~~
- ~~Optimize by mapping irrelevant traits to "random" for solver operations~~
- ~~Add "About" window for licenses + references~~
- ~~Gracefully handle missing references to pals, traits, and pal instances~~
- ~~Fix tree layout algorithm~~
- ~~Option to choose whether to include pals deployed to a base~~

## Maybe TODOs
- Automatically detect changes to save file + reload
Expand All @@ -101,5 +92,4 @@ The Community Toolkit library is used for the viewmodels, which provides the `Ob
- IV inheritance + solving
- Attack skill inheritance + solving
- Figure out how the data miners do their thing and read Pal DB info straight from game files?
- Allow solving for multiple pals at once
- ~~Support Xbox saves ([sample ref](https://github.com/Tom60chat/Xbox-Live-Save-Exporter/tree/main))~~
- Allow solving for multiple pals at once

0 comments on commit 735ca3c

Please sign in to comment.