Randomizer - hzla/Pokeweb-Live GitHub Wiki
Smart Randomizer Functions (experimental)
Assumes fairy implemented on base rom, and BW2. Use localhost:4567/patcher for fairy patcher on a clean rom or use a rom with fairy already implemented. Change "fairy": false to true in session_settings.json if you are editing the rom. Included in Pokeweb/Reference_Files is also a xdelta of a clean black2 rom with fairy type added and pokemon center encounters that can be used as a base rom for randomization.
How to randomize
DEMO Note: demo video speeds up the trainer randomization process to save time. Actual randomization takes 4-5 minutes.
Step 1: Load rom into pokweb.
Step 2 (Optional if vanilla rom): Enter the base rom's gym/elite 4 level caps into pokeweb/randomizer/base_rom_level_caps.json. This defaults to vanilla B/W2 values.
**Step 3 (Optional if vanilla rom):**Enter the target gym/elite 4 level caps and target BST ranges into pokeweb/randomizer/gym_viabilities.json. Enter trainer_ids of gym leaders and gym trainers if those have been changed from vanilla. Default difficulty values follow roughly Emerald Kaizo bsts/level ranges.
Step 4 (Optional): Customize pokedex.json, move_viabilities.json. More explained below.
Step 5: Click "Randomize" on the webapp header. Wait 4-5 minutes. The screen will say "Randomization Successful" when done. You can view progress in your terminal/cmd.
Step 6: Click export on the webapp header. You can find the rom in pokeweb/exports. You can also export a custom showdown calculator and view other changes on the other tabs of pokeweb.
How to Customize
Randomized rom settings are in Pokeweb/randomizer
pokedex.json
This file lists every pokemon/alt form in the game. Each pokemon has an entry like so
{
"name": "BULBASAUR",
"via_player": 1.0,
"via_ai": 1.0
}
The important variables are "via_player" and "via_ai".
Every pokemon has a modified_bst value that is how the randomizer determines how strong a pokemon is. The modified_bst formula is the same as regular bst with the weaker offensive stat subtracted/averaged depending on how close in values they are. Defensive stats are slightly deprioritized, and speed is given a slightly more weight to the value. For reference, cleffa sits at around 176 and mewtwo at 570. Modified_bst values can be viewed in randomizer/pok_viabilities.json
Via_player is multiplied with modified_bst when the randomizer is deciding whether or not to allow the pokemon into an encounter pool. This variable is meant to be modified by the user and allows a user to adjust the at what stage of the game a certain pokemon will appear depending on how strong the user thinks it is. Lowering it to 0 will cause it to never appear and is the default value of certain entries such as the pokestudios mons and bad eggs.
Via_ai is multiplied with modified_bst when the randomizer is deciding whether or not to allow the pokemon into an a trainer's team of possible pokemon. Raising or lowering the value with cause the randomizer to see the pokemon as stronger or weaker. Lowering to 0 will cause the pokemon to never show up.
Only pokedex.json is meant to be edited by the user, not pok_viabilities.json
In essence, via_player and via_ai gives the randomizer user the ability to customize how strong a pokemon should be viewed relative to their raw stats.
All other variables in this file should not be touched.
move_viabilities.json
This is a list of moves, the only variable that should be adjusted is "viability". Currently the only function supported is setting a variable to 0. At viability 0, trainer teams will never have the move in their movesets.
A list of banned moves for the ai is in randomizer/ai_move_banlist.txt. To add to the list, add a new line with the move_id as the first entry followed by a space. Everything after the space is optional and can be used for notes.
gym_viabilities.json
This file container 9 entries, 1 for each gym, and 1 for the elite 4
{
"range": [240, 400],
"lvl": 15,
"tr_id": [156, 764],
"gym_tr_ids": [171,172]
}
{
"range": [450, 600],
"lvl": 100,
"tr_id": [],
"gym_tr_ids": [],
"e1": [38,143,772,777],
"e2": [39,144,774, 779],
"e3": [40,145, 773,778],
"e4": [41,146,775,780],
"champ": [341,536,776,781,345]
}
range modifies the high and low end of modified_bst pokemon that a gym leader can use. Trainers in between gyms will use values that scale up to the next gym range.
lvl is the level cap for the gym. Encounter levels will also scale off this value.
tr_id is a list of trainer_ids that are used by the gym leader
gym_tr_ids is a list of trainer_ids of the gym trainers.
e1 to e4 and champ are the trainer_ids for the elite 4 members and the champion.
The ids are needed so that the randomizer will know they should use their assigned gym type.
base_rom_level_caps.json
Set the level caps for the base rom you are trying to randomize here so that the randomizer can properly group trainers and encounters into each gym split.
Other info
The team generator will randomly choose pokemon1, then choose pokemon2 based on typing that is supereffective against mons that are supereffective against pokemon1 and so forth until the team is filled.
Gyms and gym trainers will only use certain types unless the given settings are too narrow.
Battle types are unchanged. Singles will still be singles and so on. Note changing single battles to doubles in pokeweb will not work unless the overworld npc is given a partner, or unless the partner check in the global trainer script is removed.
The moveset generator will first determine how powerful moves generally should be by looking at the level and bst specified. It will then generally try to find stab moves, then sometimes status moves. Then fill the rest with coverage moves (moves that are supereffective against types that are supereffective against itself). Only status moves are limited to the pokemon's learnset. Some trainer pokemon are forced to use their weaker offensive stat as a way of balancing. A special/physical set will be prohibited from using stat boosting moves for the wrong stat.
Held items have a percent chance to chosen from smogon usage data, and a default pool of items.
Abilities are randomly chosen.
Each encounter is made from a pool of pokemon slightly weaker than the next gym leader's pool. Evolutions are taken into account, so a Charmander in a pool of lvl 30 pokemon will be seen as a Charmeleon. Pokecenter encounters are monotype according to their gymleader. Flocessy Town pokemon center will always have a type that is super effective against gym 1.
Randomizer algorithms are in Pokeweb/models/randomizer.rb. This is where adjustments to the team/encounter/move generator algs can be made. For example, modifying the modified_bst formula, % chance of coverage moves etc. Requires programming knowledge.
The application of the randomizer algorithms are in Pokeweb/models/action.rb. This is where adjustments to how and where the randomizations are applied can be made. For example forcing certain encounters to be of a certain type. Requires programming knowledge.
To be implemented:
Ability viabilities, gym specific viabilities per pokemon, typing viabilities. Restricting movesets based on held item. Auto remove evs. Auto remove setup moves. Auto adjust overworld trainers to unavoidable locations.