views:

266

answers:

2

Problem Overview

I am working on a game application and need to be able to implement scrollable maps in Silverlight similar to those found in Google Maps. However, I am unsure as to how to implement this effectively. The following paragraphs provide much additional detail. Any ideas or guidance is greatly appreciated!

Problem Detail

I have been working on a new MMOG (massively multi-player online game). The game will implement a coordinate (x,y) based map. Only a very small fraction (less than 0.1%) of the map will be displayed on the screen at any given time. The player should have the ability to click on the map and drag the mouse to scroll and view map areas which are not presently visible. (This is somewhat similar to Google Maps.)

The map background is made up of a series of stitched (repeating) images. These images are woven together to give the basic appearance of the game's "world". A standard set of additional graphics are then superimposed, as appropriate, on each of the coordinate locations . For example, point (0,0) might be a lake, (0,1) might be a city, and (0,2) might be a forest. The respective images for a lake, a city, and a forest would be superimposed on the background.

It is important to mention that the entire map is NOT stored on the local client machine. Rather, as a player scrolls to or opens a specific location, the appropriate map information is retrieved from the remote game server. It is infeasible for us to build the entire game world map ahead of time due to its size and the fact that portions of the map are constantly changing.

I have toyed with the idea of building a bitmap on-the-fly of the new map each time a player moves. However, I think there may be a much better way to add to the map as the player scrolls.

When scrolling, movement of the map should not, if possible, result in a "flickered" refresh of the screen. I believe recreating a bitmap each and every time a player moves even one or two pixels would almost certainly result in flicker.

I am open to 3rd party tools and solutions. However, to the degree possible, I would prefer to use standard Microsoft libraries or open source tools rather than commercial tools.

What are some ideas as to the best way to implement this functionality so that it performs well, is reliable, and transitions to new areas of the map appear seamless to the player?

Thank you in advance for all your help!


Update

Here are a few pieces of additional information that may prove helpful.

Since my initial post, I have been introduced to the concept of a "tile engine". (Many thanks to Michael and Paul for pointing me towards Bing and BruTile.)

My understanding is that a tile engine basically breaks larger images into sections and renders them side by side. As a user scrolls, additional tiles are rendered as others are removed from view. This is very much what I am looking for.

However, there may be a couple of wrinkles that affect my use of a standard tile engine. All of the graphics for the game, including the backgrounds which would be displayed on any tile, will already be downloaded on the client. It is important that the tile engine not retrieve the graphics from a server as this would consume significant unnecessary bandwidth.

Other graphics (e.g. a lake, forest, hill), which represent objects from the gameworld, must be superimposed when the tiles are rendered on the screen. Tile engines such as Bing appear to provide the ability to superimpose custom images. Whatever tile engine is used must not only support this feature but allow exact placement of these superimposed images.

Finally, there is a a requirement to support popup descriptions when the user mouses over one of the superimposed graphics. Unlike the graphics which are already stored on the client, the descriptions contain information which must be downloaded from the game server. BruTile, while excellent in many ways, does not appear to yet support these popup descriptions.

We are making great progress. Thanks for all your help so far!

+2  A: 

Use the Bing Maps control or the MultiScaleImage (Deep Zoom) which it uses. To seen an example, go here. You can use the Deep Zoom Composer to create maps or topologies using your own photos and images. Here is the SDK for the control.

Michael S. Scherotter
I have taken a cursory look at the Bing Maps solution, and I must say, it is extremely impressive. However, I do have some concerns which may or may not be valid. It appears that Microsoft tracks usage of map requests. This indicates that at some point that may start either charging for use of Bing or limiting usage. If this occurs, it could either bankrupt me or render the game useless. Do you have any idea whether there will be any usage limitations or licensing fees placed on Bing?
Anthony Gatlin
Read here about licensing: https://www.bingmapsportal.com/ Inquire here mailto:[email protected] If you use your own imagry with Deep Zoom (like you mentioned in your post), then you don't need to use the Bing maps imagry. You can use the Deep Zoom Composer to create that stitching of the images.
Michael S. Scherotter
+1  A: 

For an open source solution you could look at BruTile. It too has all the features you describe. It can also be used on the Microsoft Surface and on Windows Phone (for your markeplace version).

Paul
The BruTile/SharpMap solution shows real promise. However, one requirement I forgot to list in my overview is the ability to add pop-up descriptions. BruTile does not currently appear to support this out of the box. I am looking deeper into this to see how difficulty it would be for me to add this functionality manually. For the cost, BruTile looks like it may be a great solution.
Anthony Gatlin
pop-ups will not be a part of the library in the short term. For our own projects we write our own custom functionality per project. Bing maps is of course a more mature solution but the flexibility of OSS can be an advantage.
Paul
About having the tiles locally. BruTile supports both loading from the web and loading from disk or db. It can also load tiles from web when needed, and store those locally for reuse later. I think this would be the preferred method since there is no load time at startup. For Silverlight you could use BruTile's DbCache with SqLite: http://www.itwriting.com/blog/1695-proof-of-concept-c-sqlite-running-in-silverlight.html.
Paul