TerryCavanagh / VVVVVV

The source code to VVVVVV! http://thelettervsixtim.es/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Time trial decimals should be stored robustly

Daaaav opened this issue · comments

Since VVVVVV 2.3, time trial best times include not just the number of seconds, but also the number of frames. However, this hasn't worked out for me for some reason - my save file contains <bestframes>-1,-1,-1,-1,-1,-1,</bestframes> despite having definitely beaten my records in 2.3+.

Reading back an old discussion on Discord about potentially adding decimals to the time trials menu, I suspect it has always been working correctly (?) but since this data is only stored in unlock.vvv and not settings.vvv, opening an older version of VVVVVV even once instantly makes you lose your frames records. I can't confirm if it actually works properly other than that - I thought it had always been broken, but maybe 2.2 overwriting unlock.vvv is the sole cause of problems here.

(There's also another reason why I felt it was broken: if the best frames is set to -1 (the initial value), then it's only ever updated if you beat your record in seconds territory. In other words, -1 is counted as a better time than .00, and you can't beat your old time within the same second and have it be recorded. But I think I changed my mind on that being a bug. Yes, .99 (or actually .96) is the only safe thing to say about a time that was stored without frames - but on the other hand, you cannot be sure that the player beat their time until they beat it in whole seconds (because they might've had .00). So, if the frames are known we could display them, while for -1 times we could simply show it without decimals like before, until the player has definitely beaten it by beating the seconds.)

So in my opinion, we need to make sure that this is stored robustly against 2.2 and older deleting it (by putting it in settings.vvv?) before 2.4 comes out.

So, thinking more about this, I'm not sure if there's an elegant way to solve this, so it may not be worth it. Thoughts?

Ever since settings.vvv existed I felt safe opening 2.2 real quick to check something, because everything added by 2.3+ was in a file 2.2 didn't touch anyway. At least, that was one of the reasons we got to settings.vvv in the first place (#373). But I didn't immediately realize that time trial best frames would keep being wiped, because it doesn't really belong in settings.vvv.

Putting it in settings.vvv has several problems - it's tied closely to the best times in seconds, which does exist in 2.2, and whether or not you copy that to settings.vvv too, you might get weird situations where you first get a record in 2.4 and then beat your time in 2.3, meaning the frames don't belong to the seconds anymore, or your worse records overwrite your better ones, or something like that. Also, with Steam Cloud, we're deliberately not syncing settings.vvv because it has machine-specific properties like window dimensions in it. So that might also cause some weird splits.

I guess the problem goes away if everyone is careful to never ever open 2.2 anymore for even one second, if they want to keep their time trial records complete, or back them up manually every time. But people may not know that, and it's kind of an annoying thing to lose - it's not just a setting you can change back, it's your records you probably don't remember exactly.

We could migrate records to another brand new file, but that still has the same problem of mismatching seconds/frames records if you go and set a new record in 2.2. Then we would have to implement some sort of system that somehow purges the frames if you've set a new record in 2.2? But that's literally cache invalidation and I don't want to do that.