Resource Questions about how Random Battles formats work? Read here!

Status
Not open for further replies.

A Cake Wearing A Hat

moist and crusty
is a Community Leaderis a Community Contributoris a Top Contributoris a Smogon Media Contributoris a Dedicated Tournament Hostis a Battle Simulator Moderatoris a Site Content Manager Alumnusis a Top Social Media Contributor Alumnus
Random Battle Lead
Post Index:
#1: Gen 9 Random Battle/Gen 9 Random Doubles Battle - Roles and what they do
#2: Gen 9 Random Battle/Gen 9 Random Doubles Battle - How does Random Battles work exactly? Code explanation post
#3: Old Gens Random Battles - Role system differences
#4: Set Development Policy, Principles, Process, and Guidelines

Random Battles Changelog
How does Level Balancing work? How are levels decided in Random Battles?
Gen 9 Random Battles Set Suggestions

If you have any questions on any of the information in this thread, feel free to ask in the Simple Questions, Simple Answers thread, or ask me personally!

If you haven't played Random Battles for a while, the set generation may look a bit different from what you may be used to, and you'll be seeing some things in the /randbats command that might stand out to you. If you're new to Random Battles entirely, you might notice some various words that you don't know what they mean. That's because Random Battles now uses (for mostly technical purposes) a role system! A basic explanation of what this means, and a list of each role and what they mean, can be found below. Keep in mind, though, you DO NOT need to know this to enjoy Random Battles, it's just supplemental information if you're curious.

What are roles?
In Gen 9 Random Battle and Gen 9 Random Doubles Battle, each Pokemon has between one and three roles that it can fulfill; each role comes with its own movepool, which means that Pokemon in both formats can have multiple separate movepools! Outside of being a handy way to keep conflicting sets on a single Pokemon apart from each other, roles also determine which kinds of moves always generate (or which moves are forced, in other words) on the Pokemon and which items the Pokemon will get. That's almost everything they do! Functionally, you don't need to worry about it unless you're trying to deduce what your opponent's set is from what they've revealed so far.

What do the different roles do?
There are ten roles in total in each format, each with their own rules. Keep in mind, the roles are not always accurate to what the Pokemon actually does, it's just what fits best for the generator. We try, on average, to keep it as accurate as we can, though. Also, if a Pokemon can't possibly fulfill a certain condition, that condition is just ignored. (for example, if the role forces a recovery move, but it doesn't have one in its pool, it's not a problem!)

  • Fast Attacker: This is the most common role. Essentially, these Pokemon are on the offensive; they get a Life Orb as their default item if they don't have anything better (like Boots or a Choice item), they always have a move matching their Tera type if one exists, and they'll always have two attacking moves at minimum.
  • Setup Sweeper: Pokemon with this role will always come with a setup move of some sort, on every set that generates! They also get a Life Orb as their default item, have a Tera-typed attack when possible, and have a minimum of two attacking moves.
  • Wallbreaker: Mostly identical to Fast Attackers in function, Wallbreakers stand out in one particular fashion: They cannot get a Choice Scarf. If they're Choiced, it'll always be Band or Specs. Many Wallbreakers will typically also be on the slower side, and can't really be described as "fast" in good faith. Also, newly, Wallbreaker role forces a STAB Priority move if available on the set.
  • Tera Blast user: This role is unique—there can only be one Tera Blast user on a team maximum. You aren't guaranteed one, and Pokemon that can be Tera Blast users don't always have to be Tera Blast users (tera blast users will always have another, non tera blast option). These Pokemon always come with setup if it exists in their movepool, have two attacks at minimum, have Life Orb by default, and always run Tera Blast. Again, it's important to note: Some Pokemon, like Regieleki, are Tera Blast users but do not run setup moves. This is on purpose.
  • Bulky Attacker: This role forgoes Life Orb in favor of having Leftovers as the default item. They also always run any recovery or STAB priority moves they have. Not all of them have those as options, though. Other than that, they have the usual: two attacks minimum and a Tera-typed attack. Assault Vest can appear on this role with four mixed attacks.
  • Bulky Setup: The bulky counterpart to Setup Sweeper, it is identical to Bulky Attacker but with setup moves forced on it. The definition of "setup" for these Pokemon can be relatively lax—some Bulky Setup users will opt for Iron Defense + Body Press, some will have more standard setup options, and there's also Oinkologne with Stuff Cheeks Salac Berry.
  • Fast Bulky Setup: Surprisingly a distinction that needs to be made, Fast Bulky Setup is the kind of thing CM + Stored Power Espathra or Substitute + Bulk Up Annihilape would be described as. Fast Bulky Setup Pokemon have setup forced, have Life Orb by default with three attacks, have Leftovers by default with two attacks, and have the usual Tera-attack and two minimum attacks.
  • Bulky Support: The fat role. These Pokemon do not have a minimum number of attacks to be valid, don't need a Tera-typed attack, and have Leftovers by default. They also require recovery, if it exists. Assault Vest can appear on this role with four mixed attacks, although this is pretty rare. This role also enforces Defog and Rapid Spin if the team doesn't have it yet and the move can be rolled.
  • Fast Support: Fast Support Pokemon have probably the most conditions. To start, they require a Tera attack, but NOT a two-attack minimum. They get Life Orb by default with three attacks, Leftovers by default with two or fewer attacks, Heavy-Duty Boots by default with hazard removal or a pivoting move (unless they're ungrounded), and Focus Sash by default in the lead slot (unless Focus Sash is objectively bad on it). Assault Vest can appear on this role with four mixed attacks. Yes, this means you'll occasionally see AV Electrode. Enjoy!
  • AV Pivot: Pokemon with this role always get Assault Vest, and always have a Tera-attack when possible. Really, that's it.

    So, to put it into other terms:
    Two-attack minimum, if two attacks exist: Every role except Fast Support and Bulky Support
    Always have an attack of the Pokemon's Tera Type, if it exists: Every role except Bulky Support
    Always have setup, if it exists: Setup Sweeper, Bulky Setup, Fast Bulky Setup, Tera Blast user
    Always have recovery, if it exists: Bulky Attacker, Bulky Setup, Bulky Support
    Always have hazard removal, if it exists and the team doesn't already have it: Bulky Support
    Life Orb by default unconditionally: Fast Attacker, Setup Sweeper, Wallbreaker, Tera Blast user
    Leftovers by default unconditionally: Bulky Attacker, Bulky Setup, Bulky Support
    Life Orb/Leftovers depending on # of attacks: Fast Support, Fast Bulky Setup
    Can generate Assault Vest: Bulky Attacker, Bulky Support, AV Pivot (always)
    Can generate Focus Sash: Fast Support, and ONLY Fast Support


  • Doubles Fast Attacker: Essentially, these Pokemon are on the offensive; they get a Life Orb as their default item if they don't have anything better, they always have a move matching their Tera type if one exists, and they'll always have two attacking moves at minimum. Note that in Doubles, most Pokemon do not get Choice items with 4 attacks; the only ways this role can get a Choice item are with Trick/Switcheroo/U-turn/Volt Switch.
  • Doubles Setup Sweeper: Pokemon with this role will always come with a setup move of some sort, on every set that generates! They also get a Life Orb as their default item, have a Tera-typed attack when possible, and have a minimum of two attacking moves.
  • Doubles Wallbreaker: This role is drastically different from in Singles. These Pokemon have Life Orb as their default item; however, they are able to get Choice items with 4 Physical or 4 Special attacks. If they're Choiced, it'll always be Band or Specs. These Pokemon also always have Trick Room and STAB Priority attacks if their movepool contains them. Additionally, they can uniquely get a Life Orb with Fake Out.
  • Doubles Bulky Attacker: This role forgoes Life Orb in favor of having Sitrus Berry as the default item. Other than that, they have the usual: two attacks minimum and a Tera-typed attack. Assault Vest can appear on this role with four attacks.
  • Doubles Bulky Setup: The bulky counterpart to Setup Sweeper, it is identical to Bulky Attacker but with setup moves forced on it. The definition of "setup" for these Pokemon can be relatively lax—some Bulky Setup users will opt for Iron Defense + Body Press, and some will have more standard setup options.
  • Tera Blast user: This role is unique—there can only be one Tera Blast user on a team maximum. You aren't guaranteed one, and Pokemon that can be Tera Blast users don't always have to be Tera Blast users (tera blast users will always have another, non tera blast option). These Pokemon always come with setup if it exists in their movepool, have two attacks at minimum, and always run Tera Blast. Items for this work strangely. If the Pokemon is at or above 80 base Speed or has Trick Room, it gets Life Orb as their default item, similar to Fast Attacker. If they are slower than 80 base Speed, they can get Sitrus Berry or Assault Vest. Again, it's important to note: Some Pokemon, like Regieleki and Dragonite, are Tera Blast users but do not run setup moves. This is on purpose.
  • Offensive Protect: These Pokemon are Fast Attackers with Protect enforced. To review, they have a Tera-typed attack when possible, have two attacks at minimum, and have Life Orb as their default item.
  • Bulky Protect: These Pokemon similarly have Protect enforced. They also always have a Tera-typed attack when possible. However, they can run one attack and be fine. These Pokemon get Leftovers if they are running a setup move, and Sitrus Berry otherwise.
  • Doubles Support: The passive role. These Pokemon can run only one attack and be valid, don't need a Tera-typed attack, and have Sitrus Berry by default. They also require Fake Out and redirect moves, if they exist. Assault Vest can appear on this role with four attacks, although this is pretty rare.
  • Choice Item user: Pokemon with this role always get a Choice item, and always have a Tera-attack when possible. Really, that's it.
So, to put it into other terms:
Two-attack minimum, if two attacks exist: Every role except Bulky Protect and Doubles Support
Always have an attack of the Pokemon's Tera Type, if it exists: Every role except Doubles Support
Always have setup, if it exists: Doubles Setup Sweeper, Doubles Bulky Setup, and Tera Blast user
Always have recovery, if it exists: Nothing.
Always have Protect, if it exists: Offensive Protect, Bulky Protect
Always have Fake Out or redirect moves, if they exist: Doubles Support
Always have STAB priority or Trick Room, if they exist: Doubles Wallbreaker
Generate Life Orb by default: Doubles Fast Attacker, Doubles Setup Sweeper, Doubles Wallbreaker, Offensive Protect; Tera Blast users at or above base 80 Speed or with Trick Room
Generate Sitrus Berry by default: Doubles Bulky Attacker, Doubles Bulky Setup, Bulky Protect, Doubles Support; Tera Blast users below base 80 Speed without Trick Room
Generate Life Orb, even with Fake Out: Doubles Wallbreaker
Can generate Assault Vest: Doubles Bulky Attacker, Doubles Support; Tera Blast users below base 80 Speed without Trick Room
Can generate Choice items with U-turn, Trick, Switcheroo, and Volt Switch: Anything except the Protect roles
Can generate Choice items with 4 attacks and none of the above: Choice Item user, Doubles Wallbreaker
Can generate Focus Sash: Nothing, yet.



And that's a crash course on the new role system! Again, unless you're into predicting your opponent's sets with partial information or wish to get invested in helping with sets yourself, this really isn't going to be more than a curiosity piece for you.
 
Last edited:

A Cake Wearing A Hat

moist and crusty
is a Community Leaderis a Community Contributoris a Top Contributoris a Smogon Media Contributoris a Dedicated Tournament Hostis a Battle Simulator Moderatoris a Site Content Manager Alumnusis a Top Social Media Contributor Alumnus
Random Battle Lead
How does Random Battles work, exactly?
Good question. One that will take a lot of text to answer. This post will contain technical information that may be difficult to understand; however, I will do my best to explain it in terms anyone can get. If you can get through this post and fully understand it, you will be able to truly understand what changes are and are not possible in Gen 9 Random Battle and the consequences of the changes that can be made. Singles and Doubles use the same generator. You can tell in the code what's for Doubles or not when you see "isDoubles"!
random-teams.ts - location of the process itself
random-sets.json - location of movepools, roles, levels, and Tera types
abilities.ts - location of ability ratings


! means "Not", take the inverse of what the thing following it is saying.
".includes" means "does this pokemon have the ability to obtain this?"
".has" means "does this pokemon so far already have this thing in this specific random battle set?"
"===" means "is"
"counter.get" means we're keeping track of whether this Pokemon has this thing or not, and in what quantity.
"&&" means "and"
"||" means "or"
"isDoubles" means the code is specific to Gen 9 Random Doubles generation. "!isDoubles" means it's specific to singles. Otherwise, it's shared between both.

Overview: The Flow Of Set Generation
Random Battles set generation follows a very specific series of steps. Each step informs the decisions of the steps afterwards, but the later steps have no say in the earlier steps' decisions. These steps cannot go out of order or in reverse at all whatsoever. Any suggestion that would require these steps to go in any direction other than forwards is not possible. Each step listed below will be expanded upon in a hide-box later in this post. The steps are:

Generate First Pokemon Species -> Choose Role -> Choose Tera Type -> Choose Moves -> Choose Ability -> Choose Item -> Adjust EVs/IVs if needed -> Generate Pokemon 2's Species -> etc.

This step chooses a number of random team members (from existing tiers and Unreleased) equal to the current maxTeamSize (default: 6). Pokemon with a number of formes, such as Rotom or Zamazenta, have the chance for that Pokemon to generate split between the formes. So, for example, you are half as likely to see a Zamazenta-Crowned as you are to see a Toedscruel. Levels are applied to the Pokemon as they are generated, using level data from random-sets.json.

While this step occurs, it is possible for the slot being chosen to be rejected and other random Pokemon to be rolled instead if the original Pokemon does not meet certain conditions. Team generation currently uses this feature to prevent teams from having more than 3 Pokemon weak to any given typing, more than 2 pokemon of any given type. In Monotype, the latter of these is waived entirely for obvious reasons.

Additionally, Zoroark formes cannot generate in Slot 6, and Intrepid Sword, Dauntless Shield, and Iron Boulder cannot generate in Slot 1.


The Role-choosing step is relatively simple; each Pokemon has one to three "Roles" to choose from in random-sets.json (please see Post #1 for details). Roles are largely decided completely randomly, although if there is already a Pokemon with the role of Tera Blast user (or Ogerpon or Terapagos) on the team, any future Tera Blast user roles (as well as Ogerpon or Terapagos, entirely) will be excluded from the running. This step informs many future steps, but most importantly chooses which movepool to pick moves from in random-sets.json. Please brush up on all of the roles in Post #1 for details!

The Tera Type step is even more simple. random-sets.json contains a list of potential Tera types for each Pokemon, separated by role. A random Tera Type is then chosen from the Tera Type pool for the selected set.


This is a big one.

First, please understand the difference between the "movepool" and the "moveset". The movepool is the set of move options for a given set, as visible in random-sets.json as "movePool". The "moveset" is the set of four moves that you see in battle.

Moves are, one by one, moved from the movepool to the moveset. Initially, this is done less randomly: there are many conditions for move enforcement. Once all move enforcement conditions are fulfilled, then moves are selected randomly from the remaining movepool until the user reaches a set of four moves. Additionally, after each move added to the moveset, the remaining movepool is checked for move incompatibilities. Anything incompatible with the selected move is removed from the movepool and can no longer be generated on the set.

Move Enforcement: (Visible on lines ~150-200, ~300-400 of random-teams.ts)
A list of move enforcement conditions exists; if any of these conditions for "enforcement" are met, an applicable move is added to the moveset. Pokemon are at minimum forced to have at least one STAB move not found on the "noStab" list on line 88 of random-teams.ts. Most typings also have specific rules for enforcement, visible on lines 150-200. Certain roles force certain sets of moves; "bulky" roles typically force recovery moves when available, "setup" roles force a setup move, "bulky attacker" forces STAB priority when possible, roles not called "support" force the set to contain at least two attacks minimum, and most roles also force an attack matching the Pokemon's Tera Type. Additionally, Facade is forced if the user's potential abilities include Guts, and a small list of Pokemon have forced priority moves instead of forced non-priority STAB moves. Certain moves (WishTect, LeechTect, Screens) are paired together; the other must be forced if one is generated. Once no more "enforcement" conditions are applicable, moves are selected randomly.


Move Incompatibilities: (Visible on lines ~420-520 of random-teams.ts)
After each move is added to the moveset, a short list of move incompatibilities is run through and anything deemed incompatible will be removed from the broader movepool. Most of the incompatibilities in random-teams.ts are easily readable by people who do not know Typescript. For example, one cannot have both setup and hazards in the same moveset, so if a setup move is rolled, all hazards will be removed from the movepool, and vice versa. In addition, there are some team-based move rejections: there cannot be more than one Stealth Rock user, more than one Sticky Web user, or more than one hazard remover under most circumstances. If rejecting a move from the movepool would cause there to not be enough moves remaining to create a set of four, this step is waived. This means that Pokemon with only four moves in their movepool can still get Stealth Rock if another team member already has Stealth Rock, for example.

In older generations than 9, the Moves section is significantly messier; moves are brought from the movepool to the moveset, and then moves are rejected based on rejection conditions and rerolled until all rejection conditions are satisfied. Enforcement was just fancy rejection, rejecting random moves until the Pokemon gets what it's forced to. This could often result in heavy weighting towards specific moves compared to others, and could also regularly result in erroneous, unintended sets.


Another big one.

Abilities are largely decided by ability ratings. Ability ratings go from -1 (detrimental) to 5 (super duper great) and are visible in abilities.ts. Abilities, like moves, have conditions to be forced. They also can be rejected under certain conditions. These, alongside the process of selecting an ability itself, will all be covered below.

Ability Enforcement: (Visible on lines ~950-980 of random-teams.ts)
A small list of conditions exists for which a valid ability is directly applied to the applicable Pokemon and the rest of the ability phase is skipped. The most prominent example of this is forcing Guts when the move Facade exists in the moveset. Many of the others are pokemon-specific.

Ability Selection: (Visible directly after Ability Enforcement)
First, the highest rated ability is determined; for example, let us say "Pokemon A" has a 4-rated ability, a 3.5-rated ability, and a 3-rated ability. The Pokemon's highest-rated ability will be 4. Then, a list of all available abilities within 0.5 of that rating are pulled. For Pokemon A's case the 4-rated ability and the 3.5-rated ability would both be pulled. A random ability is then selected between those possibilities; 2:1 weight is given to higher-rated abilities, while equally rated abilities have an equal chance to be generated. For example, in Pokemon A's case, the 4-rated ability would have a 66% chance to be generated, while the 3.5-rated ability would have a 33% chance to be generated. Please note that, outside of special circumstances, abilities rated 0.5 or below will not ever be in the running.

Ability Rejection: (Visible in the "shouldCullAbility" section, ~line 824, random-teams.ts)
Abilities can be rejected based on certain conditions. If any "case" line in the shouldCullAbility section outputs as "true", the ability is rejected. For example, Chlorophyll is rejected if the Pokemon is Lilligant or the team does not have a method to create sun. Abilities 0.5-rated or below are rejected by default, as are a small list of abilities found on (at the time of writing), lines 838-839. If the highest-rated ability is rejected, the new highest possible rating will instead be used to pull potential abilities. For example, in Pokemon A's case, if the 4-rated ability is rejected, it would instead choose randomly between the 3.5 and 3 rated abilities, with 2:1 weighting for the 3.5-rated ability. If all possible abilities are rejected, it simply performs the Ability Selection step without caring about any of these rejections. These are the situations where 0.5-rated abilities can be generated, and also why Glaceon gets Snow Cloak, for example.


Item selection is a relatively simple, but long process. A descending list of "if" conditions begins on line ~1010 of random-teams.ts and ends around line 1230. The first condition in this list to be met gives the Pokemon its item. The higher-priority conditions, listed first, are often Pokemon-specific; Pikachu gets Light Ball, Ditto gets Choice scarf, and so on. As the list goes on, the conditions become more generalized. For example, a condition exists where "If you have no status moves and are neither a Fast Attacker nor a Wallbreaker, you get an Assault Vest". This condition would give everything with no status moves an AV in a vacuum; however, it is prioritized below Choice items and several other relevant item possibilities, so in practice it primarily appears on mixed attackers. If no conditions are met at all, we give the Pokemon Leftovers and call it a day. There is not enough space on this post to give every item condition a thorough explanation; i recommend reading it yourself and using some common sense!


EVs will always be 85 and IVs will always be 31 with a neutral nature in the vast majority of situations. However, a few conditions can change that. If the Pokemon has no physical attacks, its Attack EVs and IVs are set to 0, but everything else remains the same. If the Pokemon has Trick Room or Gyro Ball, its Speed EVs and IVs are set to 0, but everything else remains the same. In past gens, EVs for certain stats were lowered slightly to give Nihilego and Celesteela better use of Beast Boost. Such a feature is possible in Gen 9 as well, but it is not currently in use.


If you got through all that, good for you, you're now an expert in Random Battles set generation! Put that on your resume, you've earned it. If you have any questions, feel free to ask me personally! Just be sure you've read everything carefully.
 
Last edited:

A Cake Wearing A Hat

moist and crusty
is a Community Leaderis a Community Contributoris a Top Contributoris a Smogon Media Contributoris a Dedicated Tournament Hostis a Battle Simulator Moderatoris a Site Content Manager Alumnusis a Top Social Media Contributor Alumnus
Random Battle Lead
What's different about these revamped old gens?
Gens 3, 4, 5, 6, and 7 of Random Battles also now run under the same system you can learn about above, with a couple changes! I'll run these changes down for you here. There aren't many. Gens 2 and 8 are planned to be revamped as well, but currently run an older, harder to explain system not covered in these posts.

Preferred Type has all the technical specifications of Tera Type but without the actual functionality of Tera. In other words, if a Pokemon has a Preferred Type listed when you type the /randbats command, or if you see a Preferred Type in /data/gen7/random-sets.json, that means the Pokemon will always get a move of that type. Not all Pokemon have a Preferred Type; it's mainly for things like Nidoking, which always want a specific move but don't have it enforced in any other way.

Preferred Type is also used to select the Z-Crystal chosen for Z-Move users. Unless the Pokemon has a species-specific Z-Crystal, the Z-Crystal will match the Preferred Type of the Pokemon. For example, Z-Conversion Porygon-Z is Preferred Type Normal, and gets Normalium Z.

If there are multiple Preferred Types listed on a Pokemon's set, it rolls randomly between them and picks one preferred type for the set in question. For example, Z-Move user Cobalion has both Steel and Fighting preferred types, so it will get Steelium Z or Fightinium Z at random.


The Z-Move user role replaces the Tera Blast user role in a lot of ways. There can only be one Z-Move user on the team. However, it differs from Tera Blast user in one major way: Z-Move user will always be chosen over the "Setup Sweeper" and "Bulky Setup" roles of the same Pokemon, unless there is already another Z-Move user. For example, if you roll a Gyarados and the team does not yet have a Z-Move user, that Gyarados will always be its Z-Move user set, because its only other set is Setup Sweeper.

Also, certain Pokemon (looking at you, Spinda and Castform), only have a Z-Move user set. If the team already has a Z-Move user, these Pokemon will not generate at all. We don't like doing this, but it's necessary.


Because of the sheer amount of Toxic in Gen 7, we needed a new role to fit it. Gen 7, therefore, completely removes the "Fast Bulky Setup" role, and instead adds Staller. Pokemon with the Staller role have the following things enforced, if they are available in the movepool:
-Recovery moves
-Protect moves
-Toxic
-one STAB move, minimum.

Stallers will ALWAYS get Leftovers, unless they have an ability like Harvest that would require something different.


The Wallbreaker role does not force STAB Priority when available, in older generations. That's the only difference.


This one's kind of technical. Basically, teams generate in reverse, from Slot 6 to Slot 1, instead of front-to-back like Gen 9. This happens because Mega Pokemon will always generate over the regular species if available, and we don't want your Mega to be leading half the time. That's pretty much the only reason. It also helps not reveal Z-Move users as often, coincidentally.


The Spinner role is exclusive to pre-Defog-removing-hazards gens of Random Battle, especially Gen 5. It's functionally identical to Bulky Support, in that Rapid Spin and recovery moves are forced on it and it gets Leftovers by default. However, the Spinner role will always be given over other roles a Pokemon has in its pool, unless the team has hazard removal. Yes, this means you'll never get Bulky Attacker Armaldo, the one with Swords Dance, unless you have hazard removal already. It's unfortunate, but we need to do whatever we can in these generations.


https://github.com/smogon/pokemon-showdown/blob/master/data/mods/gen7/random-sets.json - All of the sets for Gen 7 Rands

https://github.com/smogon/pokemon-showdown/blob/master/data/mods/gen7/random-teams.ts - All of the code for the actual set generator for Gen 7 Rands

You may also view the same for other old generations by changing the number in the hyperlink.


Gen 3 has a lot of differences due to not having Assault Vest, Life Orb, or various other tools. As such, the default item is always Leftovers, and a couple roles are changed:

Generalist has absolutely no effect on the Pokemon and merely generates the Pokemon normally.

Berry Sweeper is a new role that forces Substitute/Endure and grants Salac/Petaya type pinch berries.
 
Last edited:

A Cake Wearing A Hat

moist and crusty
is a Community Leaderis a Community Contributoris a Top Contributoris a Smogon Media Contributoris a Dedicated Tournament Hostis a Battle Simulator Moderatoris a Site Content Manager Alumnusis a Top Social Media Contributor Alumnus
Random Battle Lead
Set Development - Policy, Principles, Process, and Guidelines

If you've read the above posts, you may now know how the technical side of Random Battles works. But how do the sets get decided, and what standards do we have? First, let's start with our principles:

Random Battles Development Principles
These rules are subject to change. If you have any questions or concerns, please check out the Simple Questions, Simple Answers thread, or ask me personally!
1. Pokemon will have 85 EVs in every stat with a neutral nature. The main exceptions to this are special attackers (who have 0 attack EVs, 0 attack IVs, and still a neutral nature), and Gyro Ball/Trick Room users (who have 0 Speed EVs, 0 Speed IVs, and still a neutral nature). Being above 85 EVs in any given stat, or having a non-neutral nature, will never be considered in Random Battles development. Beast Boost users may also have their stats adjusted minorly to support better boosts, but this currently only applies to Nihilego. In cases where EVs are reduced, they are not redistributed among the other stats. They're just left blank.

2. Pikachu and every fully evolved Pokemon in the game's data must be included in Random Battles. I'm sorry. We can't remove Unown. It's gotta stay, we're under orders from administration. This includes unreleased Pokemon in the code like Ursaluna in Gen 9 or Eternal Floette in Gen 6. Some NFE Pokemon may also be included in Random Battles if they are both unique enough from their evolution and functional in a Random Battles setting. These are included on a case-by-case basis; if a NFE pokemon is bad enough, it can be removed from the format.
3. Every Pokemon will have their optimal set(s). This is determined by the staff, suggestions in the Set Discussion threads, and comments in the PS! room. We will never intentionally make a set worse than it could be in a Random Battles setting. Note that this does not mean that we copypaste sets from OU; sometimes, sets that work in tiers don't work as well in Random Battles, and vice versa.

3a. Sometimes, elements of a Pokemon will be removed by council vote, like Moody and Last Respects. Elements are only removed in order to make Pokemon more consistently able to put in work in a game; often, the removal of these elements comes with a hefty level buff that helps the Pokemon leverage their stats better to consistently do something in battle, rather than just winning half the time and doing nothing the other half. In other words, we don't remove things for being too good, we remove them for being too inconsistent.

4. Pokemon will, when possible, have a variety of viable sets. We try to avoid having Pokemon fixed at only one set of four moves when possible. This isn't always feasible, but if a Pokemon has other options aside from the Set Everyone Talks About, these additional sets will be included when possible. An example of this is Lumina Crash Espathra. Keep in mind, though, that these sets need to at least be close in power level so that they can function at the same level as the other sets; Shift Gear Cyclizar would be horrible at its current level, for example. And that leads us to...

5. Every month, levels are balanced for each Pokemon via objective win rate statistics. This currently applies to gens 3-9 of Random Battles. You can view objective win rates via the "/rwr [format]" command on PS! Pokemon still only have one level for all of their sets combined, so all of their sets must be of relatively (but not exactly) equal power level. Because we aim for all Pokemon to have roughly equal win rate, the relative tiers of Pokemon do not matter. Ubers are generally not inherently more powerful than other Pokemon in Random Battles, because they are often significantly lower level.
You can check this post about the statistical principles behind level balancing.

6. We ignore move compatibility errors and don't have Team Preview, but otherwise adhere to legality. For example, Gen 6 Clefable can have Soft-Boiled with Unaware, but we won't give a Zamazenta Body Press in Gen 8. The reason for this is due to ease of coding. We will not give Toxic to Pokemon that do not currently learn it in Gen 9, for example. Team Preview doesn't exist in Random Battles to give players another avenue of skill expression: knowing when to withhold information from the opponent to gain an advantage in an otherwise disadvantageous situation!

7. We try to keep the code concise when possible. Even if it may theoretically make a Pokemon better to give it complicated rules to its set generation, like specifically making Unaware variants of Clefable run Heavy-Duty Boots, doing so would not be feasible from a code standpoint while maintaining readability. Such things are called "hardcodes", as they are individual, inflexible pieces of code tacked onto the algorithm that only interact with one thing and do nothing else. Often, instead of these "hardcodes", we keep with simple solutions, or try to install new generalized rules instead, like our Roles system in Gen 9. More of these "hardcodes" also artificially raises the skill level required to play Random Battles optimally, because you need to memorize countless Pokemon-specific rules instead of a smaller set of general rules. This point may be difficult to understand, but that's okay! Essentially, it just means that not every suggestion is feasible from a technical standpoint, even if it would be helpful.

Why are hardcodes bad?

-Each and every hardcode makes it more difficult for outside viewers, and even our own code team, to read the code, understand the code, and change the code without making mistakes.

-Each and every hardcode adds another distinct, specific piece of information that players would need to memorize that can't just be found by using /randbats, and makes the code both more necessary as a resource to learn the format and more difficult to read as a resource to learn the format.

-Piling up too many hardcodes negates the worth of the base framework, which brings into question its viability as a framework.

-Adding too many hardcodes, especially with vague documentation or obfuscation that they are hardcodes (e.g. trying to say that "Pokemon with over 100 speed should not get Regenerator with High Jump Kick" instead of "Mienshao should not get Regenerator with High Jump Kick"), makes the code almost impossible to break into as a newcomer into coding the file, and every hardcode acts as a barrier to new potential members of our Code Team. This has happened multiple times in the history of Random Battle; A former format head had to rewrite the code from scratch without understanding what any of it meant because the format head before that added too many hardcodes by the time they left.

-Adding too many hardcodes results in the review process (wherein coders both on and off of our code team look over code changes and determine if they are good to go) becoming significantly more difficult and drawn out. It will become harder to get willing reviewers to a file that is notoriously full of hardcodes. We have enough difficulty getting willing reviewers already without that.

-Adding too many hardcodes, in extreme cases, can result in major scrutiny and/or action from the Pokemon Showdown core development team in order to prevent it from happening again, which is undesirable.

-Adding too many hardcodes increases the likelihood of unforeseen and difficult-to-fix bugs that will then need to be band-aid patched with other hardcodes. It can also increase the likelihood of crashes, and in extreme cases, slow down Pokemon Showdown.


-Sets should not be tailored to only be good if the Pokemon Teras, outside of Pokemon with Tera Blast and the Tera Blast user role, in order to not interfere with the generation and function of Pokemon with that role, as well as to account for situations where your Tera is better used elsewhere. This means that Pokemon with Tera Ghost will not have Shadow Claw over a stronger coverage move, for instance. This is also why Tera Stellar Enamorus must still run Play Rough. The same rules apply for Dynamax in Gen 8.

-Sometimes certain sets will have to be removed or added for reasons of metagame health, such as Defog Kleavor's existence or Choice item Annihilape's removal, to keep a good balance of the ratios of relevant set types in the larger set-pool. Our long-term goals (see below) take priority over the principle of set variety.

-Tera Blast Users should not be added frivolously because they impact the frequency of all other Tera Blast users, as well as directly affecting the appearance rate of Terapagos and Ogerpon. It is best to keep Tera Blast users at around the frequency they're currently at. The same applies for Z-Move users in Gen 7 and Ultra Necrozma.


In addition to our principles, we also have two long-term goals currently in place that direct our set development:
-There are too many teams with 3 or more Choice item users. As such, we should not add more Choice item sets on Pokemon, or increase the rate of Choice items on Pokemon, without reducing the rate of Choice items on other Pokemon to compensate. Additionally, we try to seek out ways to reduce the rate of Choice items on Pokemon when we can. We are unable to make a broad rule to prevent getting 3 Choice item users entirely, so manipulating individual Pokemon's Choice item rates is the best we can do.
-We get many complaints about the state of hazards vs. hazard removal. We have a goal in place to maintain our current rate of hazard removal (at time of writing, over 1/3 teams get hazard removal), and not purposefully reduce the rate of hazard removal unless extremely necessary.




Set Development - How do we do it?

Set development works through a consensus-based technocratic system, to be short. In longer terms: set development contributors (currently Random Battles room auth plus a few consultants) participate in Discord channels for each Random Battles format. In these channels, suggestions from other sources like the Random Battle Sets thread are discussed, and new suggestions are brought up by the contributors themselves. The Format Heads then implement or reject the suggestions based on a combination of how good the suggestion is for a Random Battles setting, consensus among the contributors, our Random Battles principles and goals above, and technical feasibility. A large number of suggestions get denied due to at least one of these reasons, and often a combination thereof. However, a large number of set suggestions and adjustments also pass each update. I make an effort to bring every genuine and feasible suggestion brought to me to the contributors for discussion.

In cases where a consensus cannot be reached among the contributors, either the Format Heads make a call, or the development council votes on it, depending on how severe the disagreement is.

In Gen 9 Random Battles, we have the luxury of having a very high sample size for our win rates; this lets us test our set suggestions and changes with a relatively high degree of accuracy. As such, we often make large sets of changes in the middle of the month in order to compare the change in win rate between the first and second halves of the month. We will revert changes that turn out significantly negative during this process.

Updates do not occur at a scheduled rate, but we try to keep them on the weekends whenever reasonable, and often at least update the current generation of Random Battles twice a month.
 
Last edited:
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top