SilverlightShow: XNA for Silverlight developers: Part 4 - Animation (frame-based) Comments http://www.silverlightshow.net/ Silverlight articles, Silverlight tutorials, Silverlight videos, Silverlight samples en-us SilverlightShow.net estoychev@completit.com (Emil Stoychev) Argotic Syndication Framework, http://www.codeplex.com/Argotic http://www.rssboard.org/rss-specification RE: XNA for Silverlight developers: Part 4 - Animation (frame-based) http://www.silverlightshow.net/items/XNA-for-Silverlight-developers-Part-4-Animation-frame-based.aspx#comment5552 <p>Nick, I have written a post about the sprite sheet and the performance gain you can expect on the Windows Phone 7 device here:</p> <p><a href="http://www.pitorque.de/MisterGoodcat/post/What-difference-does-a-sprite-sheet-make.aspx">http://www.pitorque.de/MisterGoodcat/post/What-difference-does-a-sprite-sheet-make.aspx</a></p> ( Peter Kuhn) http://www.silverlightshow.net/items/XNA-for-Silverlight-developers-Part-4-Animation-frame-based.aspx Tue, 22 Feb 2011 11:00:33 +0200 RE: XNA for Silverlight developers: Part 4 - Animation (frame-based) http://www.silverlightshow.net/items/XNA-for-Silverlight-developers-Part-4-Animation-frame-based.aspx#comment5535 <p>Paul, I'm not sure if I understand your intention completely. In XNA, you have to recreate the complete screen content in each frame. However, in certain situations (dragging the whole, static screen might be one) it can be more efficient to use a technique like rendering the whole content to a texture first and use that instead for transitions.</p> <p>Nick, I carefully thought about adding explanations for this optimization technique to the article and decided against it because I only wanted to demonstrate the concept (it will however be part of a future article about optimizations). The main advantage of a sprite sheet takes effect if drawing the screen content in a sprite batch operation would require to switch between multiple textures, because this is an expensive operation. In this sample animation however, only a single image is drawn on the screen in every frame, i.e. ending the sprite batch operation flushes all outstanding drawing calls and restores the device state anyway. There is no performance benefit in this case. A good example where sprite sheets would really make a performance difference would be if we had a lot of these animations on the screen at the same time, and each one would currently show a different frame (i.e. they were all started at different times). Then frequent texture switches would have to happen in a single sprite batch operation and/or frame, which a sprite sheet avoids.</p> <p>You are right though that we would have had a benefit in terms of loading times and total required space for the textures, because a lot of space is empty and therefore wasted in the individual images at the moment. Even so, I still didn't see the forceful argument for it in this simple sample. In real-world applications, even if there's no real benefit performance wise, this is probably the best argument to still use sprite sheets however.</p> <p>Btw. if you're interested, I built a simple sprite sheet creator in Silverlight for fun some time ago. It can be found online <a href="http://www.pitorque.de/MisterGoodcat/post/Animation-Texture-Creator.aspx">here</a> (with source), and the live development protocol can be found <a href="http://www.pitorque.de/MisterGoodcat/post/Protocol-of-developing-an-animation-texture-tool.aspx">here</a>.</p> <p><br /> </p> ( Peter Kuhn) http://www.silverlightshow.net/items/XNA-for-Silverlight-developers-Part-4-Animation-frame-based.aspx Fri, 18 Feb 2011 00:55:30 +0200 RE: XNA for Silverlight developers: Part 4 - Animation (frame-based) http://www.silverlightshow.net/items/XNA-for-Silverlight-developers-Part-4-Animation-frame-based.aspx#comment5534 <p>It would probably be better to use a sprite sheet instead of loading each image separately.</p> ( Nick) http://www.silverlightshow.net/items/XNA-for-Silverlight-developers-Part-4-Animation-frame-based.aspx Thu, 17 Feb 2011 22:56:09 +0200 RE: XNA for Silverlight developers: Part 4 - Animation (frame-based) http://www.silverlightshow.net/items/XNA-for-Silverlight-developers-Part-4-Animation-frame-based.aspx#comment5530 Looks like a great set of articles that I'll study later. One question I have - Any tips for frame-based animation where I'm using simple primitives like 2D line vectors. I have an app where I need to do a simple transition as the user drags the screen but each frame has to be re-calculated. Do I have to remove/add the line child objects each frame or is there a better method? Thanks. ( Paul) http://www.silverlightshow.net/items/XNA-for-Silverlight-developers-Part-4-Animation-frame-based.aspx Thu, 17 Feb 2011 14:29:54 +0200