LateStartStudio / Hero6

Hero6
http://www.hero6.org/
Other
19 stars 6 forks source link

[Windows] Support for DirectX and OpenGL #86

Open persn opened 7 years ago

persn commented 7 years ago

MonoGame supports both DirectX and OpenGL on Windows, with more graphics APIs for all platforms on the way. It would be neat if we could build Hero6 in such a fashion that the user could choose between graphics APIs instead of having to download one copy of the game for each API. Unfortunately however, because of the way MonoGame is setup it can't be made to work like this in a straightforward manner, so we need to engineer something smart, if that is even possible.

persn commented 7 years ago

One potential problem with this, is that asset files are pre-processed by the MonoGame pipeline tool. We can't exactly provide a copy of every asset for every platform/graphic renderer since this would essentially mean doubling our game size for a minor feature.

We should probably figure out if which assets can and cannot be used over multiple graphic renderers, audio is probably fine, shaders is probably not, unsure about sprites/textures. If for instance we only need to include multiple variations of shaders, then that is probably doable as it wouldn't increase size much, or any.

persn commented 7 years ago

I was a able to hash out a functional prototype, I was actually really impressed with how great the result turned out, I was expecting having to make some hacks for this, but it's all kosher.

Textures works on both DirectX and OpenGL, not surprising since I believe they're raw bitmaps. Sound effects work, however music does not to my surprise. The MonoGame platforms pre-processes music files differently, "WindowsDX" makes files in the .wma format, and "DesktopGL" in the .ogg format, and then most likely the MonoGame software has a pre-processesing directive to include interpreter only for the relevant format.

The easiest way to resolve this would be to include a copy of the soundtrack for each platform but that takes too much space on the user's expense, the soundtrack is most likely one of the most space consuming things we'll have in this game.

We could also open an issue at the MonoGame repo and ask to have playback for multiple audio formats for single platforms implemented. However, they might have had a reason to not include this feature in the first place.

Alternatively we could also make our own audo handler, which is probably out of scope for this project.

https://github.com/persn/Hero6/tree/develop/feature/renderer

Either way I'm done with this for now.