FIFE forums

Please login or register.

Login with username, password and session length
Advanced search  

News:

FIFE 0.4.0 has been released on 15th of January, 2017!

Author Topic: Dropping SDL rendering support  (Read 5287 times)

Joshdan

  • Developer
  • Newbie
  • *
  • Posts: 46
    • View Profile
Dropping SDL rendering support
« on: January 13, 2008, 04:35:12 am »

I have been going over the profiling results with Sleek, and it seems like a lot of effort both in performance and in code size is devoted to rendering a 3d scene into 2d (for example we apply our own orthographic projection).  In the long run I think we could easily get several times the framerate by taking advantage of hardware rendering, avoiding any need for other optimizations for a long time.  Over time we could also probably simplify a bunch of things using OpenGL since it can apply camera/matrix transformations too.

The only major roadblock to moving in this direction seems to be our current 2d SDL support.  Since basic OpenGL support (e.g. drawing textured rectangles) is pretty much a guarantee on any platform, is there any reason to continue SDL graphics support?
Logged

mvBarracuda

  • Administrator
  • Sr. Member
  • *
  • Posts: 411
    • View Profile
Re: Dropping SDL rendering support
« Reply #1 on: January 13, 2008, 07:03:10 am »

The only major roadblock to moving in this direction seems to be our current 2d SDL support.  Since basic OpenGL support (e.g. drawing textured rectangles) is pretty much a guarantee on any platform, is there any reason to continue SDL graphics support?
On win32 systems OpenGL support is really common nowadays. Even users with eight year old systems should have a graphics card with OpenGL support as they became quite a standard around the year 2000.

The main reason why we added SDL support to the engine was because OpenGL support was a problem for linux users who did not want to use proprietery graphics card drivers. Does anyone know if free (as in free speech) drivers feature basic OpenGL for the majority of modern graphics cards on linux nowadays? In case all active linux-based developers can run FIFE with OpenGL support without any hassle and if removing the SDL backend would ease our work in the long run as we would just need to maintain one backend, we should remove the SDL support IMO.
Logged

jasoka

  • Developer
  • Jr. Member
  • *
  • Posts: 51
    • View Profile
Re: Dropping SDL rendering support
« Reply #2 on: January 15, 2008, 12:54:48 pm »

I guess it could be worth of its own branch to test what it means to have openGL backend only (and use e.g. MESA instead of 3D card support).

However I'm not sure if we can get rid of all matrix calculations with OpenGL approach, for example with elevation - layer transformation. However view certainly have its spots where this could be useful.

In any case, switching to plain openGL from current approach is not a totally trivial task, so in any case if anybody wants to try this, I would recommend the branching. However like stated before, I would be happier with functional game that renders slowly, than no game and fast rendering :)
Logged

Joshdan

  • Developer
  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Dropping SDL rendering support
« Reply #3 on: January 19, 2008, 05:38:38 pm »

I saw a bit of talk about this on the forums and I wanted to clarify my proposal.  I am not talking about any change to the way that scenes are described, but just to the rendering.  From my brief encounter with the code, it seems we are doing a rather sizable amount of 3D work for a 2D engine, most of which appears pretty ad-hoc.  This I think could be improved with standard OpenGL approaches (though I don't know a lot of specific cases yet).

As for the way worlds are defined, I think this should definitely be as 2D as possible, and simple layering is great.  Then somebody programming, e.g. Checkers, doesn't have to carefully think out 3D layouts, just "this goes on top of this".
Logged

jasoka

  • Developer
  • Jr. Member
  • *
  • Posts: 51
    • View Profile
Re: Dropping SDL rendering support
« Reply #4 on: January 20, 2008, 09:05:44 am »

Perhaps you could create a proposal into wiki what kind of changes you envision, taking specific cases from view that could be changed. At the moment the proposal is a bit hard to comment on, since we don't have anything to grab on.
Logged

phoku

  • Developer
  • Full Member
  • *
  • Posts: 102
    • View Profile
    • IZ dev blog
Re: Dropping SDL rendering support
« Reply #5 on: January 22, 2008, 06:11:04 am »

I'd like to add a point in case for SDL rendering support.

FOSS games tend to be deployed in Universities and Low Tec computing facilities. These rather often still have a thin client architecture, which denies usage of OpenGL at all (graphics go over X).

I think we'd miss a lot of potential players if we drop SDL rendering.
Logged

Sleek

  • Developer
  • Jr. Member
  • *
  • Posts: 57
    • View Profile
Re: Dropping SDL rendering support
« Reply #6 on: January 23, 2008, 07:48:05 am »

@phoku,

Don't those systems have something like a Mesa implementation ?

I guess if they don't, we will keep the SDL renderer and optimize the SDL-OpenGL alone.
Logged

skybound

  • Newbie
  • Posts: 11
    • View Profile
Re: Dropping SDL rendering support
« Reply #7 on: January 23, 2008, 09:44:21 am »

Mesa is more like a reference implementation: it is far too slow for actual use; whereas software blitting with SDL is simple (in comparison) and thus heavily optimized.
Logged

Joshdan

  • Developer
  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Dropping SDL rendering support
« Reply #8 on: January 25, 2008, 02:26:46 am »

I have been checking out the objections to dropping SDL, and I have definitely been swayed myself.  To run OpenGL over X, you must have GLX installed, which may not be an option in the multi-user environments Phoku mentions.  Also, Barra mentioned to me the GP2X (a Linux handheld gaming platform) which surprisingly also does not support OpenGL (apparently not even in software). 

So while it still seems like desktop support for OpenGL is practically 100%, there are plenty of niches that OpenGL has yet to fill.  It's easy to see FIFE being the platform of people's favorite games within those niches, since 2D graphics can be still be breathtaking with minimal horsepower.

Sorry to have dug up an old debate, but at least we've got some of the reasons laid out where the next overeager newbie can be pointed.
Logged