-1

I am currently working on a project where i want to display data of a game and my own graphs on a rebuilt minimap.

The data is given as ticks of the game with the entitydata changed in that tick. At first i want to draw the map and then all entities existing at the first tick. Then for every tick i want to update positions and draw lines between entities

My WPF User Interface is set up with the MVVM Pattern.

Now i am struggling with the creation of and techniques for the minimap.

What i want the minimap to support/create:

  1. Interactivity

    • Click on entities on the field to display more information about them.
    • Zoom the map
    • Follow entities(with a zoomed in game field)
    • Toogle different visuals (disable one team, highlight sth etc)
    • ...(and other interactions like the above)
  2. Performance

    • Graphics should look as smooth as possible(Map,Images, anti-aliasing, no stuttering)
    • High framerate (at least 30FPS)
    • At best it should be a solution with most of the above features built in(see 1.)
  3. Exporting screenshots and a video of the whole game(with my own graphs and stuff)

What i already considered(from this post WPF real-time rendering)

  • Data binding and canvas

Problem: Slow and not performant..at least as I implemented it) - WriteableBitmap(Problem: No funcitionalities built in(see 1.)

  • DrawingVisuals

Problem: How to realize as MVVM? Is it efficient?

  • WriteableBitMap

Problem: I have to build the functionality of 1.) on my own. But looks like it is efficient

Before i start implementing a lot of my wanted features myself i wanted to ask if there is anything fitting my needs or if any of the above technologies is not suited.

I hope that my question is clear enough.

Feel free to let me know if anything is missing.

PMatt
  • 25
  • 4
  • [This Library](https://github.com/teichgraf/WriteableBitmapEx/) will give you all the drawing functions you are used to for drawing on a `WritableBitmap`. – Bradley Uffner Aug 14 '17 at 13:30
  • @BradleyUffner: Does it also support hit testing? It may become more complicated than imagined when working with zoom and translation. – JanDotNet Aug 14 '17 at 13:53
  • It is just a drawing library, you would still need to hit-test on your own. I would recommend creating a `UserControl`, drawing with `WritableBitmapEx` and doing the hit-testing directly in the code-behind of the `UserControl`. You can use `DrawingVisual` to do the hit-test. MVVM really breaks down for something like this, as hit-testing is really part of the direct UI layer, rather than the view-model layer. – Bradley Uffner Aug 14 '17 at 14:04
  • Zoom and Translation should be fairly easy to handle if you create a class that can take screen-space cords, and converts them to map-space coords. It could probably be done with a fairly simple matrix calculation. You might even be able to throw rotation in to the mix too. – Bradley Uffner Aug 14 '17 at 14:23
  • thanks for the input so far. – PMatt Aug 14 '17 at 15:12

1 Answers1

0

DataBinding is nice for connecting view models to input controls, but not for updating the state of graphic objects in real-time.

I would go with DrawingVisual because it is relative lightweight and supports hit testing. Even if you don't have MVVM support, it is easy to update the visuals "manually".

JanDotNet
  • 3,746
  • 21
  • 30