Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add win animation #5

Closed
Tomin1 opened this issue Nov 12, 2022 · 9 comments
Closed

Add win animation #5

Tomin1 opened this issue Nov 12, 2022 · 9 comments
Assignees
Labels
enhancement New feature or request

Comments

@Tomin1
Copy link
Owner

Tomin1 commented Nov 12, 2022

This is a very often requested feature: After a game ends, if the game was won it should throw cards around. Similar to what Windows' Klondike game has. I think the animation doesn't necessarily need to be the same and there could be even multiple variations of it. The difficult part is that Patience Deck supports a number of different games so animations would need to adapt to different positions of stacks in different games. Some games don't have any cards on the table at the end, so there might be need for an animation that works in this situation.

@Tomin1 Tomin1 added the enhancement New feature or request label Nov 12, 2022
@llewelld
Copy link

While waiting for this feature, I find this video helpful (I play it even when I lose): https://www.youtube.com/watch?v=qy7cISueWDk

@Tomin1 Tomin1 self-assigned this Mar 3, 2023
@Tomin1
Copy link
Owner Author

Tomin1 commented Mar 4, 2023

I wrote a very basic proof-of-concept version. It can be seen in animationbuilder branch. If someone tries it or just checks it out to read, don't wonder if the head is jumping as I will be force pushing there. I intend to improve that animation and come up with some more variations of it before I consider it ready. Also it might not yet work properly if you manage to interrupt the animation by starting another game for example.

@Tomin1
Copy link
Owner Author

Tomin1 commented Apr 29, 2023

I got pretty far now. I know it has taken a long time, but I think I'm finally closing in on releasing a new version. I do need to test it some more though and clean up all my commits. 😅

@Tomin1
Copy link
Owner Author

Tomin1 commented Apr 30, 2023

While testing some more, especially performance-wise, I came up a few things to improve. I pushed those to the branch. Most commits got also squashed together so it looks a bit cleaner than it used to be.

Clearly Jolla 1 or Jolla C are not my main concern with regard to performance. Xperia 10 II feels the slowest and I used that for development so I guess whatever works there works well-enough on other hardware. Xperia 10 also feels faster than "mark 2" as usual.

I think I have only once concern left that I'd like to address before merging. Currently uniform_real_distribution is not doing that great of a job for generating radius values for animation. I'd like radii closer to maximum value be more likely than very short radii. I'd imagine a solution based on chi_squared_distribution would do a better job but it can't be used directly here so it needs to be wrapped one way or another. I'll think about that still. But I think we are close to have a win animation. Definitely there can be better and more varied implementations in the future, but this will certainly do it for now.

@Tomin1
Copy link
Owner Author

Tomin1 commented Apr 30, 2023

And now I have a solution for that too. I made distributions for both angle and radius values and it feels like it improved the animation a lot more still. Maybe it regressed a bit in places, but overall I think there is more movement and it's generally distributed better.

I will still test this some more with more games and more devices tomorrow, but I hope that I can merge this early next week. Then it should be just matter of making some builds and testing them before I can release Patience Deck 1.0.1. 😄

@Tomin1
Copy link
Owner Author

Tomin1 commented May 1, 2023

Well, I still found a problem with the animations. I think that was the reason why I thought some regressed. Angle distribution calculations from point and area used wrong values for atan2(). It was more apparent once I started going through different games to see how they behave.

I ran through all the games that I had a won game for in games.test. I found out that Jumbo on landscape had the absolutely worst performance on Jolla C. It had only 38 fps. Also on Xperia 10 II it gives closer to 60 fps, so it's not so clear after all which device performs worse. Anyway, I think I just have to accept tha I get this "at least 30 fps" performance on older devices. The game over overlay already tanks the performance on those so I think the animations aren't really the problem there. I'm not sure what causes it though as changing the overlay invisible doesn't change the performance all that much.

I'm also thinking that it would be pretty nice to create a performance test out of Patience Deck. Loading game states is a CPU test and animations are a GPU test. That's out of scope here though. 😄

One idea I thought of is that I could use game seed also for animations so that you get the same animation until you select a new game. In some ways that would be nice as then you have to finish another game to get a different animation. There isn't a lot variation between them though, just where each card will end up. I'll consider having that still, but yeah, it looks pretty good to merge maybe even later today.

@Tomin1
Copy link
Owner Author

Tomin1 commented May 1, 2023

Oh, I very much like the idea of reusing the game seed. This way the slots are not just iterated in the same way between different plays of the same game but also when the device is rotated, although the directions may differ a little bit.

@Tomin1
Copy link
Owner Author

Tomin1 commented May 1, 2023

This is now in master. See commit a4fd95b and its parents for details.

@Tomin1
Copy link
Owner Author

Tomin1 commented May 1, 2023

I created #14 for further improvements. Please share if you have any improvement ideas. Also if you want to participate on Patience Deck development but can't code, there is a very good place to start in #15.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants