Low level cross platform interface (making one?)

Discussion in 'Game Development (Technical)' started by ggambett, Feb 24, 2011.

  1. ggambett

    Moderator Original Member Indie Author

    Joined:
    Jul 26, 2004
    Messages:
    1,982
    Likes Received:
    6
    Although I'm leaving, for several reasons I need/want my old games to continue working and/or porting them to new platforms such as iOS and Android.

    My framework is 3 levels deep. The first layer, 115 KLOC is completely platform-independent and provides game-specific features. The second layer, 12 KLOC, abstracts the platform and provides window setup, image rendering, sound playback, TTF rendering, and not much more. The third layer is OpenGL/Direct3D/SDL.

    I'd like to substitute the third layer and parts of the second with a single, low level, truly cross-platform library. I want at least Linux, Mac, Windows and iOS, and possibly Android. The problem is, I can't find any!

    Looks like Allegro 5 may be a reasonable choice, but I have no experience with it. The next closest thing seems to be SDL 1.3, but it's 1) still not ready, 2) iOS is only supported through a commercial license, 3) Doesn't use Direct3D in Windows. Then there's Torque, but it's 1) commercial, 2) has a terrible reputation, 3) overkill considering I want just a very low level layer.

    If I can't find anything useful, I'm considering rolling my own and maybe making it open source.

    Any ideas or recommendations?
     
  2. Olofson

    Original Member

    Joined:
    Dec 11, 2005
    Messages:
    270
    Likes Received:
    0
    The Direct3D and OpenGL backends have been developed in parallel from the start, and AFAIK, the Direct3D one is still there.

    My "beef" with the new 2D API is that it doesn't do rotation and arbitrary polygons. Though I can understand the reasons for drawing the line somewhere (it would essentially become a new 3D API otherwise), this means I'll stick with native OpenGL, ignoring Direct3D for now.

    As to your other points, I haven't given 2) much thought yet, but 1) is the reason why I'm still using SDL 1.2 for Kobo II. Will most likely port later on, but as all I need is basic I/O and an OpenGL 1.x context, porting to SDL 1.3 doesn't seem to offer any major advantages right now.

    As to rolling your own, one alternative would be to contribute to an existing project. If SDL 1.3 is a viable candidate for that depends on your time frame, and whether or not it's goals are close enough to yours, obviously.
     
  3. Julio Gorge

    Original Member

    Joined:
    Nov 26, 2005
    Messages:
    152
    Likes Received:
    0
    GLFW is another alternative, though it's only OpenGL (no D3D on Windows) and lacks iOS support (although it would be easy to add).

    I like the fact it's significantly lighter than other low level frameworks.

    As for Android, the 2.3 release and its Native Activity class makes it much more easier to share large C/C++ codebases with other platforms now, but alas it will still be a while (I'd say at least 1 year) before the majority of users get the 2.3 update and targeting 2.3+ becomes feasible.
     
    #3 Julio Gorge, Feb 24, 2011
    Last edited: Feb 24, 2011
  4. jpoag

    jpoag New Member

    Joined:
    Mar 15, 2008
    Messages:
    806
    Likes Received:
    0
    You should have picked up Kanji when you had the chance. It has all the platforms you mentioned and D3D8/9 on Windows.

    There is a port of PTK to the iOS: http://code.google.com/p/iptk/, That's a good start to get a C++ engine running on iOS. I don't know of any Android NDK engines available (other than Kanji/GGE).
     
  5. Jamie W

    Original Member Indie Author

    Joined:
    Apr 16, 2006
    Messages:
    1,211
    Likes Received:
    0
    I've developed my own multi-platform interface. PC with DirectX / Mac with OpenGL (no Linux as yet though) and iPhone / iPad with OpenGL. Main code base in my projects is C++ (uses ObjectiveC only as and when needed) for max portability.

    Will keep an eye on Android too, would be awesome to get C++ code working there!
     
  6. ggambett

    Moderator Original Member Indie Author

    Joined:
    Jul 26, 2004
    Messages:
    1,982
    Likes Received:
    6
    I know. I was going to, but I think it stopped being offered a couple of days before or so. Now I can't even find the Gogii Engine. There's absolutely no way to get Kanji now?
     
  7. jpoag

    jpoag New Member

    Joined:
    Mar 15, 2008
    Messages:
    806
    Likes Received:
    0
    I only have 3rd party hearsay about the status of the engine, but if I am to believe what I hear, then Kanji may eventually be re-released.

    Today (tomorrow) Dark Parables 2 was released using both Kanji and (purportedly) SexyKanji over at BFG.
     
  8. rockford

    rockford New Member

    Joined:
    Apr 6, 2007
    Messages:
    95
    Likes Received:
    0
    I seems Kanji/GGE is now in the hands of BFG. They should deliver the engine one day (not licensing it, as far as I know), but no more information for now :(

    This is the best engine for now: reliable, and targeting PC/Mac/iOS/Android. I'm a lucky guy, I have some licenses and still using it for my projects.
     
  9. jcottier

    jcottier New Member

    Joined:
    Jul 12, 2006
    Messages:
    1,385
    Likes Received:
    0
    I'm pretty sure it is already the case. Basically, you have to manage a bit of code in java to handle your C++ calls. But nothing much different than the iphone: you need a minimum of Objective C. Well, that is what I've heard... will have a proper look when I have time to port my multiplatform 2d engine to android too.

    JC
     
  10. alexionne

    alexionne New Member

    Joined:
    Dec 30, 2009
    Messages:
    8
    Likes Received:
    0
    Yeah, Kanji is great engine, one-of-a-kind currently and I hope GG/BFG/whoever-owns-it will improve/fix it before releasing (again).

    Note that I hit few very nasty bugs out there which need to be fixed in order to get maximum out of engine.
     
  11. ggambett

    Moderator Original Member Indie Author

    Joined:
    Jul 26, 2004
    Messages:
    1,982
    Likes Received:
    6
    OK, so I'm rolling my own.

    It will be based on open source libs (libpng, libjpeg, ogg, theora, freetype), it will use Direct3D for Windows and OpenGL for everything else.

    Part of my evil scheme includes implementing an OpenGL interface to Direct3D. The subset I actually use is pretty small and I've done something similar years ago, so it's not impossible.

    Stupid? Genius? Yes? No?

    Not sure about audio, though. OpenAL seems to be proprietary now. Is there any one or two libs that covers all the platforms (Win, Mac, Linux, iOS)? Audio seems easier than graphics, though, so I may end up writing platform-specific code for all of these.
     
  12. Pogacha

    Original Member

    Joined:
    Jan 21, 2005
    Messages:
    605
    Likes Received:
    0
    I have my own too (will be covering all the platforms in some weeks) and it is really advanced ... but probably it is using a different subset than yours.
    If you write your own I wouldn't mind to contribute with some of my code if I can pick some of yours ... I guess you might by interested in the audio part.
     
  13. InfiniteStateMachine

    Joined:
    Oct 2, 2010
    Messages:
    40
    Likes Received:
    0
    I'm curious, why Direct3D on windows if windows also supports OpenGL?
     
  14. ggambett

    Moderator Original Member Indie Author

    Joined:
    Jul 26, 2004
    Messages:
    1,982
    Likes Received:
    6
    AFAIK, and my info may be outdated by now, calling OpenGL "supported" in Windows is a stretch.

    Does anyone know whether it's still the case? Will an OpenGL game will run as out of the box as a Direct3D one?
     
  15. InfiniteStateMachine

    Joined:
    Oct 2, 2010
    Messages:
    40
    Likes Received:
    0
    I've never had to explicitly install openGL. I'm guessing it's because it's included when you install your graphics card drivers.

    I guess I should have said "runs on" instead of "supported"
     
  16. jcottier

    jcottier New Member

    Joined:
    Jul 12, 2006
    Messages:
    1,385
    Likes Received:
    0
    OpenGL1.0, definitely :)

    JC
     
  17. Bad Sector

    Original Member

    Joined:
    May 28, 2005
    Messages:
    2,742
    Likes Received:
    5
    That would be OpenGL 1.1, AFAIK OpenGL 1.0 was never supported (alone) :p

    Still, for most 2D games 1.1 is enough. Assuming hardware acceleration of course (that is, proper drivers - although even the shittiest Intel drivers should provide 1.1 support nowadays, it is the more advanced stuff they have problems with).

    Personally i never had any problem with OpenGL support and i don't know of any case. Well, except one: some office computer a friend of mine had with a very low end ATI card, didn't support OpenGL at all. It was a driver issue which was fixed by reinstalling the drivers, but before that nothing that used GL (like Microsoft's screensavers or even ATI's own control panel :p) didn't work. Of course if you worry about such cases then you should worry about people having broken keyboards, malfunctioning monitors, etc - they're broken and you can do nothing about that :p.
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer