Gridiron Solitaire #72: Performance
Sorry--very late start today because I came home from Eli 12.1s hockey practice and Gloria wasn't feeling well.Last week I was in total meltdown mode, basically, but I somehow regained my sanity and things are moving forward. After repeated requests from the testers, there's a new difficulty mode: "Champ", which is 15/35 on defense. That will be a very, very challenging level, even for the best players.
Also, Fredrik is investigating night games. I thought it would be too much work, but they may make it in after all. So playoff games would all be night games, which would nicely distinguish them from regular games. The playoffs originally involved special field logos, a custom pregame broadcast, and a static confetti layer. Now there will be night games, custom broadcasts, national anthems, field logos, falling confetti, a team picture, and a special newspaper edition. It's a real reward for winning the league championship.
I've reached the point where I'm working on a few remaining big items instead of lots of smaller ones. File permissions, for one. Performance, for another.
This is not a big program. It doesn't do big things. Generally, performance, even on low-end machines, is very good. The one place where it's a real resource hog is with the crowd animations, where CPU usage (according to ANTS, a performance profiler) will spike to 125%. I've been able to reduce that to 110% with a few tweaks, but that's not nearly enough.
I'm sure I didn't originally write the code with maximum efficiency, but it was a damned miracle at the time that I actually got it to work (and could assign team colors to individual "fans" in the crowd). And it works just fine--it's just too much of a resource hog.
DQ XAML Advisor Scott Ray sent me a suggestion:
In order to be able to control them all from a single object, I create a bunch of clsCrowd objects and load them into an ObservableCollection. I bind that collection to an ItemsControl that actually uses a canvas as its ItemsPanel. This allows me to GREATLY simplify things by using a DataTemplate and DataTriggers to handle my animations and such.
My challenge for the next few days is to figure out what the hell he's talking about. I'm highly motivated, though, because if I can just get this crowd animation CPU resource load down to 50%, then this will run well on almost any machine.
Figure this out, get the CPU load down, and then I can move on to file permissions. When that's done, I'll be in the final polishing stage, and that's not going to last more than a couple of weeks (it's already about as polished as I can make it).
There's probably a meteor on the way.
<< Home