I am new to game development and i want to use silverlight for it. First of all i want to learn the logic of player centered gameplay. Something like this;

Player character moves in large scaled map but player can see only the viewport (centered on player) like on 3000x3000 px map with 400x400 viewport

what do i need to achive this? Is there a code example or any bookthat contains this? Do i need to use a map generator? (so when player moves it replaces titles according to matrix text file etc)



1 Answer 1


There are several points you should take care of while implementing a game using Silverlight:

  1. Silverlight is not a game engine, nor it is a technology primarily targeting game development (like XNA, for example). You will need to implement more things on your own. the most classical example here is the implementation of the game loop -- it is possible in Silverlight using Dispatcher and Timer, but this can be tricky (due to multi-threading etc). Just google for "Silverlight Game Loop", there are plenty of good tutorials on that topic.

  2. I would generally recommend to read some gamedev tutorial for Silverlight. You will find a plenty of links in this thread. Especially this link to a Silverlight platform tutorial and starter kit (ported from XNA) can be helpful for you.

  3. And now to your question! :) You will probably need to use the ScrollViewer component from Silverlight core components and manipulate the ViewPort properties to reach the scrolling and centering in your application. Just google for "sliding with ScrollViewer" and you'll find many ways how to implement this behaviour.

  • \$\begingroup\$ These points are fairly obsolete with the releast of Silverlight 5, which has an XNA-like interface and a 3D engine that may work very well for gaming. \$\endgroup\$ Commented Dec 13, 2011 at 21:51
  • \$\begingroup\$ @JeremyLikness: I don't see what points have become obsolete with SL5. I haven't worked with it yet (it is just released), maybe I missed something? \$\endgroup\$ Commented Dec 13, 2011 at 21:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .