Should I make my game engine cross platform?

Started by
14 comments, last by AgentC 10 years, 4 months ago

Making an engine cross-platform means forcing yourself not to use system shortcuts. This means higher quality code on most cases and shouldn't affect performance, unless you're doing something on a really low level, what probably is not your case.

But consider that making an engine cross-platform between Windows Mac and Linux will automatically make it easier to port it to game specific platforms and consoles, since the independent code will already be independent.

My father told me once that unplanned work means doubled work...

If this is an engine that you intent to use in order to actually make games and maybe release them, you may be losing profit here.

But if it is just a "learning experience", you have no real reason to worry, include that win32 with all your might!

Have you made a complete game before this game engine making adventure?

Advertisement

One good tip if you want to continue to make games for Windows, Linux and Mac would be to focus efforts on OpenGL rather than DirectX, if you choose to build the renderer yourself.

Alternatives are using libraries that exposes rendering functionality through its own library functions and classes, such as SDL. SDL can use both Direct3D and OpenGL.

Or using a game engine that is even MORE multiplatform, such as Unity, where you can create games for even handheld devices.

In my case, I am focusing on Windows, Linux and Mac. It was fairly easy to do with GNU compiler suite (g++ and co.), as well as some multiplatform libraries. For rendering I am using OpenGL.

It has been extremely easy to do, since the libraries does so much of the work for me already. My biggest problem was just creating the proper build chan, by learning to use Make properly. I have builds for Windows and Linux that just works, as it should be. :)

I am mainly making the game engine to educate myself on graphics programming.

One more question. What are the benefits of using DirectX over OpenGL (if any)?

the only benefit I really see using directx is support for the Xbox which would obviously not be an option for a platform. Both apis have all needed features for creating modern games. I just prefer OpenGL over directx just because of its wider support over multiple platforms.

Neither really hold a strict advantage over the other. In terms of platform support there's a good deal of market-share/revenue-potential overlap, but also exclusive support for certain platforms in either camp -- For example, if you want to run your game on XBox One, Windows RT (Surface, et all), or Windows Phone, you need to support Direct3D; likewise, basically every other platform runs OpenGL or OpenGL ES -- Although "more platforms" is a decent enough argument in favor of OpenGL, in practice the D3D ecosystem is probably about equal to the GL-based ecosystem in terms of dollars (if not users) available, but the GL-based ecosystem is more fragmented (linux, MacOS, iOS, Android for starters, and myriad hardware devices to finish) so its more work to tap all its potential. In the D3D-centric ecosystem, you can reasonably ask for more money for your game, whereas the bulk of the GL-based ecosystem is iOS/Android, where you reasonably can't and have to design around and subsist yourself on micro transactions for the most part. Anyways, none of this money stuff might be a concern for you now, but its worth bearing in mind for the future.

Other than that, Direct3D is a little more "modern" in its features and syntax (for better and for worse), but the two are close enough in functionality that you can create an abstraction layer between the two without much trouble. Pick one and learn it using contemporary best-practices, and all will be fine.

throw table_exception("(? ???)? ? ???");

Some benefits of each, excluding API preferences:

- on Direct3D shaders may execute a bit faster, and drivers are better tested, so you're less likely to get into customer support hell for your game

- on OpenGL you will get a bit faster drawcalls (less CPU overhead per drawcall)

For the "shaders execute faster" point, see http://aras-p.info/blog/2007/09/23/is-opengl-really-faster-than-d3d9/ which is fairly old, but that still seems to hold true for today's hardware, at least on quite basic shaders (blinn-phong lighting, shadowmapping)

This topic is closed to new replies.

Advertisement