Optimize tileengine (WPF/Monogame)

Hey ppl,

I hope you can help me a little bit :slight_smile: I have some lags in my monogame/wpf application.
Here is the sample: https://www.dropbox.com/s/2vbkng7ne6ey43e/TileEngineTestXnaMonoWpf.zip?dl=0

There are two projects in this solution. The first the simple MG-Game that runs very good. The second contains the same code but runs as a WPF project. Here I have some fps issues on my test pc and strange lags on my home pc.
The test pc have no graphic card, just only an good intel hd chip (remember, the game runs at 60 fps, wpf not). My home pc is a very strong gaming machine (Radeon r9 390 5gb ram, AMD-FX 8350, 8 cores). The fps here is stable @ 60 but if I scroll it lags sometimes.

How can I get it run stable at 60 fps on both machines?


Is it less like lagging and more like hitching or jerking?

I use WPFInterop as well and hitching is something I’ve just come to accept on lower-spec hardware (also using an Intel HD4000 as min-spec target). Since D3D11 has to go through D3D9 there’s a crapload of Locking involved.

On my low-end machine each of those locks is ~5ms, which doesn’t leave a whole lot left for both WPF and my rendering to work with. I’ve been able to dodge it since I’m using MG in WPF for a viewport in a tool so often the viewport is fairly small (~20% of window space).

I’ve come to the point of mashing WPFLight and Winforms MetroFramework together for version 2.0 to dodge the whole D3D11-in-D3D9 mess.


yes you could say hitching to it. Like a rubber band :slight_smile:
But winforms it not an option for me. That sample is only for testing, I have a very large wpf project where I want to integrate it.

I have opened an issue here: https://gitlab.com/MarcStan/MonoGame.Framework.WpfInterop/issues/15

No one any other idea? Should I dispose the vertex buffers? Or there other techniques to render a large world?