https://www.pokecommunity.com/posts/6856053/
Here is a post with the RAM layout for Fire Red. Most of the data you are looking for are in various memory addresses in the RAM as they are temporary things that the game overwrites over time as necessary.
For individual answers of your questions:
the variable that had my rival select a starter that was strong against my selected Pokemon: By default, Fire Red uses the variable 0x4001 to determine which pokeball you picked in Oak's lab. It is equal to 0 if you picked Bulbasaur, 1 if you picked Squirtle, and so on. However, 0x4001 is a temporary/disposable variable that the game uses only to apply movements for your rival in the lab at the start of the game during the starter selection. The game also uses 0x4031 to determine which starter you picked. (Credits to
this post)
As for the memory address of where the values of these variables are stored, I myself am unsure (still a novice here). They are apparently DMA-protected. DMA stands for Dynamic Memory Allocation. That is their memory addresses are dynamic instead of static. If they were static instead, there would have been fixed memory addresses for them using which you could change or manipulate their values through your scripts or ASM routines.
the player's current badges stored: IIRC, there are no variables of any kind in Fire Red that keeps track of HOW MANY badges you have. Instead, the game checks various flags to see WHETHER you have a particular badge or not. Here is a list of the flags that get set once you get the corresponding badges:
Technically, you could use one of the temporary/disposable variables to keep track of how many badges a player has. Just at every gym battle script, add something like "addvar 0x4069 0x1" right after when the gym flag is set. Then 0x4069 will have the value equal to the number of gym badges the player has. You could use a different variable though but make sure it is not used for other stuffs in the game and make sure it is safe. Just in case you don't know: variables from 0x4000 to 0x4100 are the safe ones IIRC. Still cross check from other Pokecommunity posts!
the data for all of the Pokemon in the party, such as their typing: There is the memory address for the data for each of the player's Pokemon and also each of the opponent's Pokemon mentioned in the very first link of my reply. Still for clarity:
The data for trainer's party Pokemon is stored at 0x02024284 in the RAM. 0x0202402C contains the data for the wild Pokemon / opponent's Pokemon. Each Pokemon's data takes 100 bytes of space. You can find even more details about them from these two Bulbapedia pages:
Pokémon data structure in Generation III
Pokémon data substructures in Generation III
the data stored for the opponent's Pokemon party: same places as above
I hope these helps! Feel free to ask for further simplification!