I last discussed Set about 3 weeks ago. At the time, my implementation was based on buttons. It worked fine, but when I saw how it looked on a friend's machine running the 'classic' theme I was appalled.
I got thinking: there has to be a way to make this game more interesting.
The answer: 3D and gratuitous animation.
The address for the XBAP hasn't changed: http://j832.com/workBlogFiles/WpfSet/
The source code has been checked-in to my SVN repository. The code files actually live under J832.Wpf.BagOTricksApp, but you can build and play with the stand-alone app by loading the J832.WpfSet solution file. (Thank you, CSProj file linking feature.)
Cool stuff:
- The listbox on the right that displays the matched sets now uses AnimatingTilePanel.
- First use of the new WPFUtil class, which exposes a set of Animate methods. These basically formalize and abstract my simple attraction-based physics model. I support 1-dimensional (double), 2-dimensional (Point/Vector), and 3-dimensional (Point3D/Vector3D) animation. Check out ZapScroller and AnimatingTilePanel in the source to see the other places these are used.
- I've also added some helper extension methods to WPFUtil. Very useful.
- Implemented a couple of super-simple 3D components: ButtonBase3D and ToggleButton3D. An interesting exercise. Hoping to move FlipTile3D to these in the future.
Not cool stuff:
- Keyboard accessibility has evaporated. With the previous implementation, you could tab around to the buttons and press spacebar to select/unselect a "card". More work than I signed up for in this iteration, but something to keep in mind.
- WPF handles z-order great in 3D unless you have transparency in your textures. Take a look at the corners of raised cards. Very frustrating. The only work-around is to manually re-order the child elements. Lame.
- Perf is great...on my super fast workstation. Even on my relatively beefy laptop, I notice some glitching when things are moving around. Ideally, I'd detect machines hardware limitations and degrade the animations. I should probably offer a "turn off the fancy stuff" check box. Eh, V3.
This will of course be included in the next drop of the full bag-o-tricks, but I thought it was cool enough to share out-of-band.
Have fun.


5 comments:
Man, when I thought Hellgate London maxed out my machine, I hadn't seen this fancy 3D game yet! Better get a new one if I want to keep up with this WPF craze ;-)
Hey Kevin,
This is awesome stuff. You actually introduced me to Set, I had never seen it before. Not only is it an intelligent game, but your app looks great.
I wanted to take a look at the code, but was unable to get just the Set game from your repository. Could you sip it up as a stand alone and make it available? I am really interested in how you deal new cards, calculate possible sets, and, as of V2, your animations.
Great job,
I have just one word: WOW!
I've known Set for several years now, but I could never imagine that someone will create a WPF version of it.
Awesome work man!
I looked at the code and saw that the shapes are not images but vectors. Very impressive!
Keep up the great work!
This is by far the best implementation of Set that I've ever seen! Is it at all possible for you (or anyone else) to create and share a lite standalone version of this which does not rely on the Bag-o-Tricks (or any other external libraries)?
Great work!
I've fiddled around with this for a bit and made it into a completely standalone file. I also added a hint button. =]
http://www.filedropper.com/j832wpfset
This has a lot of potential!
Post a Comment