disc, on 01 May 2013 - 07:07 AM, said:
Do the developers though about converting some performance critical part of OR to native? (as i heard .net have a feature for this, called "native images". Maybe it would speed up the game.
Yes, it is one of many options. However, a large portion of Open Rails's rendering time (which you correctly note below is often the limiting factor) is spent in native calls already. Almost all native execution time is spent in the draw calls and related calls in to XNA (which then calls DirectX directly). It's not completely clear how much of the time is spent in interop (the work needed for .NET to call native) and how much is in DirectX and the graphics drivers, but I believe it is actually weighted towards the latter.
It is because of this that I don't believe replacing any part of the rendering pipeline with native versions will, in itself, make a worthwhile difference in performance. However, if anyone has actual data regarding this, I'd certainly be interested in seeing it.
We have, though, been looking at newer versions of XNA (i.e. 4.0) and alternatives (e.g. ANX) as well as non-XNA-like solutions (e.g. SharpDX) to see if the performance of the calls is a factor of the CLR (.NET) version, XNA version, XNA vs. alternatives or intrinsic to DirectX.
disc, on 01 May 2013 - 07:07 AM, said:
But still, i think the best solution for performance problems would be the draw call batching/ or new 3d engine. It's clearly vistible from the examples above, that always the render thread limits the overall performance of the game.
Some of the ways the engine appears to work is due to MSTS's poorly thought-out
content, i.e. shapes will regularly use a whole swathe of different textures that could have - if anyone had been bothered - been turned in to a single texture atlas (or maybe two, for alpha blended and opaque). Unless we, in OR, dynamically do texture atlasing (which isn't going to be much fun) the way these MSTS shapes are drawn in so many bits is mostly fixed.
Regarding "draw call batching", there's some confusion of what this phrase means, it seems. One definition is just about the order draw calls are done: Open Rails already puts all the draw calls for the same material (texture + state) together and only initialises the shader once, so it satisfies this definition already. On the other hand, if you mean something more like "display lists" (as I think OpenGL calls them) or "command buffers" (as DirectX calls them), where by the application makes only 1 call, that's another story. I am very interested in any ability to do display lists/command buffers. I have not seen anything intrinsic to XNA for doing them, though, but there are things that might be interesting to try, like
Parallel Rendering with DirectX Command Buffers.