Closed Blaisorblade closed 8 years ago
So, following what I said in #152 about the 3 assumptions I made:
This 3rd one isn't completely true, and that could maybe explain a slight misalignment as @farkam135 was seeing on his phone. I compared screenshots of level 1 Pokémon and max level Pokémon from the same phones, here are the pictures: http://imgur.com/a/MaKvU
As you can see, the Pikachu/Starmie comparison shows that the alignment is not perfect (the green line is noticeably higher than the red one). But it is almost perfect on the other two pictures.
This difference doesn't seem to come from resolution, since the 1st and 3rd picture are both 1440x2560. I don't have enough data to determine if it changes with trainer level or if that discrepancy stays constant on each device.
My max angle calculations should be correct when the green and red lines are superposed/almost superposed (2nd and 3rd picture), but I would like to find what causes what we see on the 1st picture to maybe correct the max angle for these devices.
This difference doesn't seem to come from resolution, since the 1st and 3rd picture are both 1440x2560. I don't have enough data to determine if it changes with trainer level or if that discrepancy stays constant on each device.
Now that I've hit level 29 I do. It changes with level. I have GS7E and at level 28 it was broken. On level 29 it exactly spot on.
@max1c Are you using 2.2.0 or did you build the app with the fixes from #152?
I am using 2.2.0 downloaded apk from git did not build it. It was also broken on 2.2.0 at level 28. I hit 29 last night and it started working properly after that.
@max1c Ok, my comment is talking about a small misalignment that happens after applying #152 (it is not the case in 2.2.0).
Do you have a screenshot of a fully powered Pokémon from when you were level 28? Do you have one of a fully powered Pokémon from after you reached level 29?
If the answer to one of these questions is yes, could you provide these screenshots and a screenshot of a level 1 Pokémon?
Do you have a screenshot of a fully powered Pokémon from when you were level 28?
Unfortunately that's a no. I should have taken them but I never bothered.
Do you have one of a fully powered Pokémon from after you reached level 29?
Here: http://i.imgur.com/VRAuLxT.png
If the answer to one of these questions is yes, could you provide these screenshots and a screenshot of a level 1 Pokémon?
I just looked through a bunch of my Pokemon and it looks like none of them are level 1, sorry.
@max1c When you catch a 10CP Pidgey or another level 1 Pokémon, please update your comment with a link to the screenshot! I can't use one without the other.
@Remiscan I will try. But as you probably know, at this level catching one of these will not be easy.
The following comment is based on screenshots I gathered on reddit, trying to fix misalignment that could happen after the fix from #152 is applied (so not related to misalignment in the current 2.2.0 release). These are mostly comments that I wrote to myself, but I'll post them here, hoping they are not too confusing.
So I guess assumption 3 is wrong, and that's what will cause slight misalignment for some users. Assumption 3 was:
center of the white dot at level 1 / bottom of the white dot at max level are always at the same height
Temporary conclusions based on screenshots I got on reddit :
This means that, if I'm not doing too many mistakes when I'm measuring and trying to understand these things, more often than not, the max angle is around 178.4, but sometimes it goes a little lower and a little higher. We will probably never reach pixel-perfect alignment because, as /u/machiav3lli's screenshots show, the interface itself can move a little bit on the same phone. Max possible angle is not the same for all same-resolution phones (Galaxy S6 and Nexus 6 have the same resolution - although Galaxy S6 doesn't have a navigation bar on screen, I don't have enough data to know if it changes anything or not). So:
If we find out that the max possible angle is not determined by trainer level, and that some noticeable misalignment is seen on some devices, do you think it would be possible to allow a GoIV user to "calibrate" the app by letting them move the red dot freely along the arc (or by increments of .5 degrees?), asking them to move it precisely over the white dot on a fully-powered Pokémon (or maybe even on a not-fully-powered Pokémon), and use the angle he chose to calculate the max possible angle for his phone/level?
@Remiscan I've not had time to follow all the details, though I trust your job.
I wonder about what and when to do a new release. I don't want that we make a new release fixing other bugs and this, and tons of people complain. FWIW I have no complaints, but I also have a Nexus 5 and not 100% alignment.
In the worst case, we could have something like 2.2.1 with the old formula and 2.2.2 with the new one, and otherwise identical and released together. Though of course this would be confusing.
We will probably never reach pixel-perfect alignment because, as /u/machiav3lli's screenshots show, the interface itself can move a little bit on the same phone.
- What's most critical is getting the level right, even if the circle is off. Do we violate that?
- If the level matters, it's probably because the number of stops on the arc changes. After all, I don't think Niantic wrote 178.4 in the source; more likely that arises from sth. else, maybe even rounding errors.
do you think it would be possible to allow a GoIV user to "calibrate" the app
If there's no alternative that's maybe an option... I wonder how other app manage, or if they're just more buggy. However, we need a usable UI for that, and designing/implementing that is probably not trivial (at least not for me, but I'm not the UI GUI).
Do you think we have serious regressions compared to 2.2.0, or is the behavior mostly better?
I believe the behavior is mostly better, unless cases when the max angle is very different from 178.4 are more common than I thought.
I'm afraid of what happens at very low levels and very high levels. I'd like to test it and report if things are horribly wrong or not.
What's most critical is getting the level right, even if the circle is off. Do we violate that?
I'm afraid that if the max possible angle varies too much for some trainer levels, then the detected level would be wrong. Since I implemented the fix on my phone, level of every Pokémon I caught has been correctly detected (except Pidgey/Rattata/commun stuff that I don't check). It wasn't the case before the fix, so all I can say is that it works better on my phone. I hope it's the same on other devices and at other trainer levels, but I can't check it myself. Things look good on my Nexus 5 at trainer level 27. I can test my fix again on a Nexus 4 at trainer level 2 in a few hours.
I don't think Niantic wrote 178.4 in the source; more likely that arises from sth. else, maybe even rounding errors.
I agree. I thought min and max positions were fixed, and CpM was used to determine all positions in-between. But it seems max position isn't fixed and depends (maybe) on the trainer level, so... I don't know. My fix was based on that assumption, and since it's wrong, the problem becomes finding the most extreme variations of max angle, what causes them and how to compensate them. That's why I wanted screenshots, but with so many different devices and trainer levels, I don't have enough data to draw a meaningful conclusion.
Do you have other changes planned soon?
I don't. Unless I find which formula to use to calculate the max possible angle based on trainer level/anything else, there's not much I can do on the programming side. As I mentioned before, I don't know Java/Android dev.
Do you have other changes planned soon?
I don't.
I meant for this to understand whether we should hold off a release—any other fixes are a separate matter. Of course, you're welcome to do as many code or non-code contributions as you like (including 0).
More interestingly, I looked closer at the formula, inlined levelCoeff
and simplified it to the equivalent but simpler:
double angleInDegrees = maxAngle * (Data.CpM[(int) (pokeLevel * 2 - 2)] - Data.CpM[0]) / (Data.CpM[(int) ((trainerLevel + 1.5) * 2 - 2)] - Data.CpM[0]);
Which means the angle is proportional to the PokeLevel after scaling by CpM
. Does that make sense to you? This is equivalent except for rounding errors, but it could have fewer of those.
It makes sense. But do we know where that formula came from in the first place?
We should absolutely hold off a release. Here's what happens with my level 1.5 Charmander on my Nexus 4, trainer level 2: http://i.imgur.com/5SEbk5i.png GoIV detects it at level 1, and moving the red dot to level 1.5 shows what you see on the screenshot. Same thing with my level 2 Rattata: http://i.imgur.com/vjFQTsz.png
The interesting thing is, if I set maxLevel to 160 degrees (which is ridiculous, the white dot wouldn't be at 160 degrees for a max level Pokémon, right? (or is it? to check, I'd need to capture more Pokémon, and I would get to level 3)), the red dot is correctly positioned on BOTH Charmander and Rattata and their level is correctly detected. Sadly, I don't have any level 2.5, 3 or 3.5 Pokémon to check what happens with them, but this is weird.
EDIT: These are almost the same results as what happened with the original formula, without the manual -0.5/+0.5 corrections...
Yes we should wait—but note even that result is much better than what we had before—if you set by hand the level so the dot is closest, you'd manage to set the level correctly, right?
Still, can you try if #191 changes anything? It shouldn't, but this stuff we see shouldn't happen, so we better make sure.
The interesting thing is, if I set maxLevel to 160 degrees (which is ridiculous, the white dot wouldn't be at 160 degrees for a max level Pokémon, right?), the red dot is correctly positioned on BOTH Charmander and Rattata and their level is correctly detected. Sadly, I don't have any level 2.5, 3 or 3.5 Pokémon to check what happens with them, but this is weird.
It's a while that I'm waiting for somebody to figure out it's an off-by-one somewhere or something. Or that the error is in another one of the formulas we're using. Or in the CpM data. Or...
But do we know where that formula came from in the first place?
No clue where @farkam135 pulled it from, maybe one of the spreadsheets floating around? The only forum where people would write enough info is on Reddit, on /r/TheSilphRoad or /r/pokemongodev/.
There various people have essentially this formula, the one after your corrections and my simplifications, https://www.reddit.com/r/pokemongodev/comments/4tq4wv/lv_estimate_by_degree/ https://www.reddit.com/r/TheSilphRoad/comments/4uz4tl/determining_pokemon_level_from_the_semicircle/
For CpM there's e.g. this thread: https://www.reddit.com/r/pokemongodev/comments/4t7xb4/exact_cp_formula_from_stats_and_cpm_and_an_update/d5rg5j1
You might note some details vary a bit.
I don't know how we could find the correct formula. I guess it cannot be extracted from the .apk or someone would have done it already.
What I'd like to know is, if we knew the exact max angle at trainer level 2, would our current formula be correct? I'd need to find a level 2 trainer with a fully-powered Pokémon, and I don't know if it exists. If that was the case, we could store the max angle value for each trainer level, and we'd have a functioning formula.
A max pokemon at level 2 is possible, you just have to be careful.
To power up a level 1 Pokemon to level 3.5 it requires 1200 stardust and 5 candies. That means catching 12 Pokemon, if two are the same you're all set for the candies.
You get 100 XP per catch, that means 1200 XP from catching 12 Pokemon, you also get 500 XP for each new Pokemon. So your starter Pokemon plus a common one to farm is another 1000 XP for a total of 2200 XP. Luckily (for this test) you don't get XP from powering up a Pokemon.
So that still leaves with 799 XP to spare if you accidentally have a great throw, or run out of Pokeballs and need to visit a Pokestop. And I didn't even factor in that you can also catch a level 2 Pokemon, if you do that the stardust cost is only 800, meaning you only have to catch 8 Pokemon (including your starter).
I've created an additional account and will see if I can power up a pokemon to the max on level 2 :).
FWIW: we're going ahead with the release, as the lvl 2 situation is still better than before.
Level isn't correctly detected, is it really better than before?
Level isn't correctly detected, is it really better than before?
I might be wrong, but the argument was the following:
but note even that result is much better than what we had before—if you set by hand the level so the dot is closest, you'd manage to set the level correctly, right?
Oh, yes, right. Version 2.2.0 places the dot a bit closer to its correct position at level 2 though. And I'm afraid of what happens at high levels.
I'm still trying to think of a way to get screenshots of fully-powered Pokémon at every trainer level. Any idea? All screenshots I got from reddit are from trainer levels 21~30.
@Remiscan It's your lucky day! I caught two level 1's yesterday. All of these were taken while me being at level 29. Here are the screenshots:
CP 10: http://i.imgur.com/TGw1lHI.png http://i.imgur.com/ZhsGEmD.png
Maxed CP: http://i.imgur.com/Bi1XkKS.png http://i.imgur.com/VRAuLxT.png
By the way. With the 3.0 update, it looks like I am getting miss alignments again. It was fine with the 2.2.0. I just updated to 3.0. Screenshots:
http://i.imgur.com/flpLBfI.png http://i.imgur.com/TC0eQIx.png
EDIT: So, this miss alignment actually super sucks because again, I cannot tell the IV's for some Pokemon. Example: http://i.imgur.com/5qncqen.png http://i.imgur.com/RhlrY8c.png
http://i.imgur.com/mWpdkwi.png http://i.imgur.com/PUKlFbE.png
Which one of these is correct? I have absolutely no idea. This is exactly the same issue I was struggling with at level 28 on a 2.2.0 and 2.0 versions.
@max1c Could you test this version and tell me if it fixes misalignment at trainer level 29? https://drive.google.com/open?id=0B2rAdxir1m_wSFZJRTlLVms5STQ
@Remiscan It's still not perfect but definitely fixes the issue. http://i.imgur.com/gv0jpou.png
@max1c Does it fix it for all Pokémon levels?
@Remiscan I think so yes. All of the ones I've tested with at least it works well.
@Remiscan Any chance you can send us a PR? Depending on the changes it might fit into 3.0.1, but it's a hotfix so we're sticking to changes we're confident about (and we're releasing it ASAP).
I'm not very involved with the arc calculations, but I got a pm on reddit with the following message:
Came across your app, and just wanted to give you a heads up that the formula for the CP arc is actually float angle = (float)((Pokemon.getCPMultipliers()[(int)(mPokemonLevel2-1)]-0.094)/(Pokemon.getCPMultipliers()[(int)(mTrainerLevel+2)2-1]-0.094)*180.0f); where my CPMultipliers array is {0, 0.094, 0.1351 etc etc }
I havent read through the rest of this thread, but thought I'd put this out here.
@Blaisorblade I measured the max possible angle on screenshots from another level 29 trainer. The result is approximately 178.94 degrees. I just changed the maxAngle variable in the app to test it. Merging this change would only work for level 29 trainers, other levels would be wrong. If we need to change maxAngle for every trainer level, I don't have the data yet to fix it for everyone.
@nahojjjen can you ask what the numbers mean there, or a pointer to source?
I'm not sure what mPokemonLevel2
means, but it could be the same as ours.
That formula uses mTrainerLevel * 2 + 3
if I read it correctly, while we have trainerLevel * 2 + 1
. But maybe mTrainerLevel
is actually trainerLevel - 1
and then it's again the same as ours.
However, I'm not sure why our CpM has many more digits than what everybody else cites—wasn't 0.094 etc. reverse engineered from the game @farkam135? Why do we have 0.0939999967813492?
It seems like you can't get a max arc on level 2 or 3 (didn't go beyond that). My results:
Trainer level 2, pokemon level 1:
Trainer level 2, pokemon level 1.5:
Trainer level 2, pokemon level 2:
Trainer level 2, pokemon level 2.5:
Trainer level 2, pokemon level 3:
Trainer level 2, pokemon level 3.5:
Trainer level 2, pokemon level 3.5 (error that you can't power up):
Trainer level 3, pokemon level 1:
Trainer level 3, pokemon level 3.5:
Trainer level 3, pokemon level 4:
Trainer level 3, pokemon level 4.5:
After 4.5 you again can't power up any further like with level 2.
All screenshots were made on a Samsung Galaxy S6.
@SunMar Thanks a lot! If the new formula @nahojjjen was sent isn't correct, this could help us!
That formula uses mTrainerLevel * 2 + 3 if I read it correctly, while we have trainerLevel * 2 + 1.
His array has an extra '0' entry in the beginning. So I think we want trainerLevel * 2 + 2
—basically there's always one segment at the end to add. (If I'm misreading the formula, it might be 2, but I doubt it).
Working on a possible fix to attempt.
@Remiscan can you test https://github.com/farkam135/GoIV/pull/191? I've used +1, and eyeballing @SunMar's screenshots above at levels 2 and 3 suggests it could be the right thing. Since you already have the data to test, it'd be great if you could try it out.
@Blaisorblade I tested #191 on my level 27 account, and the red dot is always positioned exactly where it should be. The detected level for each Pokémon is correct.
My level 2 account can't login any more for some reason, so I can't test it. But I set GoIV to level 2 and it looks like the positions are OK as well (at least that's what my eyes tell me when I compare the position of the red dot with @SunMar's screenshots).
So, given this formula matches (my reverse engineering of) the tip we got, it makes sense given @SunMar's screenshots, and the difference for higher-levels is minimal, I'm tempted to merge it.
@Blaisorblade I was able to log into my level 2 account, and red dot position/level detection are correct.
We know there are issues with arc alignment for some phones and some levels. @Remiscan is having lots of progress, looking forward to his work. The technical details are mostly in PR #152.
I'll mark other issues as duplicates of this one to collect them together.
Beyond the dot alignment, there might be issues where the red dot is not placed automatically over the white dot. I assume for now it's just a consequence, but we should keep that in mind.