locked
Bindings, Dp's and Storyboards RRS feed

  • Question

  • Hey,

    when developing games, sooner or later the need for certain logics will arise, like Particles, collision detection, sprites, etc...

    Depending on the game this procedures can put a lot of strain on the cpu.

    Although Silverlight offers us a large toolset to draw transform, scale, etc... all this nice

    features involve a lot of boxing and unboxing, which results in a fair amount of performance loss.

    Since game development is a very performance critical section, my question here is: 

    Is it wise or necessary to use those features,  or wouldn't it be better to ignore them and implement own methods to deal with those things.

    Tuesday, March 10, 2009 3:38 PM

Answers

  • Thought so,

    the XAML support is only useful in a more or less static environment, where the layout does not change or only changes in range of finite possiblities.

    Since games mostly exceed those criterias, theres probably not much use for XAML support.

     

    Saturday, March 14, 2009 7:18 AM

All replies

  • That's a good point about the performance of manipulating XAML elements.

    But I can tell you that personally I use transforms like rotate and scale a _lot_ in the stuff I've done, and it can get pretty intense, like in the Physics Helper library. And on an older desktop you will likely hear your CPU fan go into overdrive on some of those demos :)

    But I think there is a better story coming soon. Because awhile ago, ScottGu mentioned GPU Acceleration coming in Silverlight 3. Taking advantage of the GPU should speed these transforms up a bit.

    From Scott's post: "Silverlight 3 will include major media enhancements (including H.264 video support), major graphics improvements (including 3D support and GPU hardware acceleration), as well as major application development improvements (including richer data-binding support and additional controls). "

     

     

     

    Tuesday, March 10, 2009 4:41 PM
  • I know of the coming up GPU Support, which will improve rendering a lot, unfortunately this is a total different story. Transformations will still be applied using dependencyproperties which still do a lot of boxing and unboxing. GPU support will not help here.
    Tuesday, March 10, 2009 4:48 PM
  • Oops, gotcha now. Sorry I didn't actually read the title of your original post, I thought you were talking about performance when using transformations in XAML like rotate, scale, etc. and didn't catch the DP's part in the title.

    Yeah, I don't use DP's or StoryBoards at all, in fact. Everything is in a rendering loop.

    Tuesday, March 10, 2009 4:55 PM
  • It's a little off-topic, but I have done a comparison of using a Grid vs using a Canvas to hold your sprites in your game. http://laumania.net/post/Using-Grid-or-Canvas-as-sprite-container.aspx Thought it would maybe have your interest, even though it a little off-topic. :)
    Wednesday, March 11, 2009 5:13 AM
  • For constantly changing properties or constantly accessed properties, dependency properties are probably not the best in regards to performance, however, for static control properties they do provide a nice model for property changed events.
    Wednesday, March 11, 2009 10:01 AM
  • Thought so,

    the XAML support is only useful in a more or less static environment, where the layout does not change or only changes in range of finite possiblities.

    Since games mostly exceed those criterias, theres probably not much use for XAML support.

     

    Saturday, March 14, 2009 7:18 AM