Any developer who has started work on their own Pokémon fan game, whether they are new or experience developers, has run into the same problem and tried different methods to approach the problem. Level progression of wild Pokémon and trainers.
What are your methods to progressing levels in your fan game? Do you have some sort of elaborate formula based on routes or gyms entered? Or do you just go up a level per map? What method gives your players the best challenge, while actually being beatable?
I play through what I've done already, and see what level I am when i get to this part of the game, bare in mind i battle everything I come across, and then depend on my level, i mix the levels around that.
I just give the opponents Pokemon arbitrary (Usually lower) levels and then playtest the game up to that point, and, battling everything I can along the way, base it off that. It's an efficient method. Later in the game, you may want to have the tougher opponents even as much as 5 levels higher than you, as it helps to avoid the problem the main games have where later gyms get much easier.
I have a decent feel for it based on playing past games. There is still some trial and error though. Theorymoning here, but for gym leaders you could count up all the experience given by forced trainer battles and divide by the likely amount of trained pokemon the play would have. So for gym 6-8 in a typical game mirrored after GF games, you'd divide total experience by 6. Gym 4-5 divide by 5. Gym 3 divide by 4. etc. Then you could adjust for how difficult you want to make the game. Better movesets, higher levels, etc.
All varies as the part of the game that you are, so the beginning is easy, the mid is mid and the latter part is hard. I hate when the game gets easier as I proceed (I played some fangames with this problem), a wrong difficult level generally ruins the game for me.
Trainers with only one pokémon generally have the pokémon as the wild pokémon average level plus 5 (wa+5). If they have 2 pokémon is wa+3, 3 is wa+2, 4 is wa+1 and 5/6 is wa. A good number of times I subtract 1 or 2 levels for a pokémon and sum in others of same party. I also substract/sum levels for pokémon that are too strong/weak for the game part, like Beedrill/Pachirisu in the beginning/final. Bosses are around 5 levels above a normal trainer.
But ALL depends of testing until I am comfortable with the result, specially bosses. When I am testing, I try to go in a novice player perspective, so I miss some items and even lower some of my pokémon levels.
And have at least several hours of playtime with easy gameplay, otherside the less skillful players will easier quit.