The International Simutrans Forum

Simutrans Extended => Simutrans-Extended development => Topic started by: jamespetts on May 19, 2009, 12:05:57 am

Title: GDI versus SDL (Windows only)
Post by: jamespetts on May 19, 2009, 12:05:57 am
As of Simutrans-Experimental version 3.10, it has, like Simutrans-Standard, been available in both GDI and SDL versions for Windows. Eventually, I plan to release full installer packages for each platform, including Windows, incorporating a complete Simutrans-Experimental compatible pakset, and all the files necessary to run Simutrans-Experimental without the user having to undertake configuration. For the Windows release, I am interested in people's views as to whether the GDI or SDL version ought be preferred. Any testing would be much appreciated, especially with 192 sized paksets (I have had some trouble with SDL with Pak192.Comic and maximising the window).
Title: Re: GDI versus SDL (Windows only)
Post by: colonyan on May 19, 2009, 01:17:56 am
GDI, I will vote if asked to choose one.
SDL can not allow type asian language. Although it can display.
Of course I can still manage with SDL so its not that strong request from me.
Also SDL feel like runs little smootier.
Title: Re: GDI versus SDL (Windows only)
Post by: Isaac Eiland-Hall on May 19, 2009, 03:50:05 am
For me, SDL runs seamlessly at 2048x1536, whereas GDI is slow even at startup screen size.
Title: Re: GDI versus SDL (Windows only)
Post by: Spike on May 19, 2009, 11:30:24 am
I use SDL, but most likely just because I always used the SDL version.
Title: Re: GDI versus SDL (Windows only)
Post by: dantedarkstar on May 19, 2009, 01:40:13 pm
I use SDL version because it runs smoother and "hangs" only for a second when loading new music track (while the GDI version does that often in 3-5 seconds, which is annoying pause in the middle of intense transport network building). I also notice that GDI version is in general slower and more "choppy" - the minimap and main map scroll smoother on SDL, the loading times seem to also be somehow shorter on SDL.
As far as I remember I used SDL version of the game whenever possible. The only quirk is that the fulscreen window mode (I mean, when you maximize window), the window seem to be misaligned by about half the title bar upwards (half the title bar if offscreen, there is appropriate gap below the bottom of the window and the windows bar), but it doesn't hurt gameplay at all.
Never used anything aside from pak64 and pak128, so no idea how pak192 works (and if it does).
Title: Re: GDI versus SDL (Windows only)
Post by: z9999 on May 19, 2009, 01:56:13 pm
SDL can not allow type asian language.

In latest version, you can paste text from clipboard with Ctrl+V. (Windows only)
Title: Re: GDI versus SDL (Windows only)
Post by: wipi35 on May 19, 2009, 02:32:36 pm
I use GDI, but most likely just because I always used the GDI version.
Title: Re: GDI versus SDL (Windows only)
Post by: knightly on May 19, 2009, 03:21:42 pm
I prefer SDL version :)
Title: Re: GDI versus SDL (Windows only)
Post by: jamespetts on May 19, 2009, 03:32:18 pm
Knightly,

why do you prefer the SDL version?
Title: Re: GDI versus SDL (Windows only)
Post by: knightly on May 19, 2009, 03:41:28 pm
James,

As Dantedarkstar said, GDI causes quite a few seconds of freeze when loading new music track. I also experienced this. Thus, I think it's better to have SDL, so that players will not experience such freezes. :)

There should also be a "historical" reason for preferring SDL version, as I always choose it over GDI for Simutrans Standard. However, I can't remember that reason now :P
Title: Re: GDI versus SDL (Windows only)
Post by: prissi on May 19, 2009, 08:11:55 pm
Sadly the SDL version on windows uses exactly the same midi routines as the GDI version ...
Title: Re: GDI versus SDL (Windows only)
Post by: KrazyJay on May 20, 2009, 07:19:41 am
I always downloaded both, but mostly used SDL. Reason? It sounds better then GDI. I think I'm not experienced enough and not aware of the real difference between those two, I'm also not aware of future compability issues, but I remember GDI doesn't require extra components to be installed, so that slightly got my preference.
Title: Re: GDI versus SDL (Windows only)
Post by: Spike on May 20, 2009, 08:40:17 am
... not aware of the real difference between those two, I'm also not aware of future compability issues, but I remember GDI doesn't require extra components to be installed, so that slightly got my preference.

SDL is a cross plattform multimedia library, while GDI is Windows only. From a developers point of view that is important, code for SDL will work on many platforms, and needs only to be written once.

From a users point of view things may look different, he mostly is interested what is easier to install and performs better on his platform.

There should also be a "historical" reason for preferring SDL version, as I always choose it over GDI for Simutrans Standard. However, I can't remember that reason now :P

Very old Simutrans versions used Allegro as multimedia library, then came SDL, and later GDI (for windows only, while the others have been used for Windows and Linux, SDL also for BeOS versions). So the historical reason might just be, that at times there was nothing else but SDL.
Title: Re: GDI versus SDL (Windows only)
Post by: knightly on May 20, 2009, 09:56:24 am
Very old Simutrans versions used Allegro as multimedia library, then came SDL, and later GDI (for windows only, while the others have been used for Windows and Linux, SDL also for BeOS versions). So the historical reason might just be, that at times there was nothing else but SDL.

Really sorry for misleading you, Hajo, for what I meant by "historical" reason is not really historical. I deliberately put the word "historical" in quotation marks simply because of this -- that is only a joke. I did not discover Simutrans until half a year ago, and IIRC the first version I tried was 99.xx only.
Title: Re: GDI versus SDL (Windows only)
Post by: Spike on May 20, 2009, 10:29:34 am
Really sorry for misleading you, Hajo, for what I meant by "historical" reason is not really historical.

No worries :) Maybe I still could shed some light on the topic for the other people who feel confused about the duality of SDL and GDI versions for Windows. Till 2005 or so, there was only SDL.
Title: Re: GDI versus SDL (Windows only)
Post by: KrazyJay on May 20, 2009, 04:51:08 pm
No worries :) Maybe I still could shed some light on the topic for the other people who feel confused about the duality of SDL and GDI versions for Windows. Till 2005 or so, there was only SDL.


Without trying to get off-topic, if SDL has a broader/cross-platform support, is easier for coders and programmers, then why was GDI invented? Aren't there other options that also and maybe better support our wishes for the future? I can imagine that a specific way of coding wont last for centuries. Are there any hints yet in favor of one or another? Sorry for getting off-topic, but now Simuthaners are busy with implementing experimental functions and some great paks are being developed, maybe switching to a better platform (if existing) might be the right time.
Title: Re: GDI versus SDL (Windows only)
Post by: VS on May 20, 2009, 05:10:04 pm
Edit: I realized only now that this was originally about James' question. I tried to answer to KrazyJay's one, above this post, which is slightly different.

Well. Main advantage of SDL is the multiplatform availability. Apart from that, its implementation on Windows uses DirectDraw to utilize hardware acceleration - thus it easily outperforms GDI, which is mostly for drawing user interfaces, the simple and uncomplicated way. If you say GDI to me, I think about things like buttons and windows and menus - that's the GDI stuff, not games. The hidden gem is, along with the underlying Windows, GDI can handle well letters like ěščůýáííýäшвпиעִבְרִית海外のフリ and millions others. Specifically reading them from keyboard, which is where SDL kind of fails.

That Simutrans can use more backends for i/o is really a blessing. It's much better than just being tied to one, albeit multiplatform library.

And by the way, SDL sucks, as many people say. In short: slow development and great resistance to bug reports.

Other options? Allegro is iirc pretty fast as well. Theoretically we could go for full hardware acceleration with OpenGL (just tiles in z-axis). Other than that, there aren't that many options. I didn't know of any and found only two things that might be worthy looking into - SMFL (http://www.sfml-dev.org/features.php) and Cairo (http://cairographics.org/). There is a lot of convergence in this area and with Allegro and SDL there is not much need for alternatives. Most of the libraries are just wrappers for SDL or OpenGL anyway.
Title: Re: GDI versus SDL (Windows only)
Post by: jamespetts on May 20, 2009, 06:11:47 pm
As far as performance is concerned, the graphics are not (with the exception of trees, which, both in GDI and SDL slow things down considerably), as far as I can tell, the main drain on performance: the simulation engine itself is the main drain on performance.
Title: Re: GDI versus SDL (Windows only)
Post by: VS on May 20, 2009, 06:22:27 pm
So far I thought I could see the difference. So, I was probably wrong :-\ It is most visible when dragging the screen.
Title: Re: GDI versus SDL (Windows only)
Post by: jamespetts on May 20, 2009, 06:27:47 pm
It may be that the difference shows up more on some systems than others.
Title: Re: GDI versus SDL (Windows only)
Post by: KrazyJay on May 20, 2009, 06:51:35 pm
Thanks for the detailed explanation, it's really much appreciated!

Basically, if I get it right, we have SDL for performance and usability on different platforms, and GDI for it's extended language support. It's quite hard to prefer either of those; you sacrifise a litte of speed for the majority in order to keep every language supported or you dissatisfy a smaller group of fans in order to speed up things for the rest. But based on what I have heard today I surely do understand this thread much better.

Hopefully I didn't mess up your original question, James...  
Title: Re: GDI versus SDL (Windows only)
Post by: VS on May 20, 2009, 07:29:38 pm
Oops, I jut now realized that KrazyJay's question wasn't the beginning of thread. I apologize.
Title: Re: GDI versus SDL (Windows only)
Post by: prissi on May 20, 2009, 09:54:41 pm
Actually performs depends very much on the display driver. Theoretically GDI should be faster (and on some machines it is), since less overhead occurs. However, Allegro is the fastest, since it lets you draw directly in the screen buffer. eliminating one copy operation. The downside is, that Allegro does not allow window resizing.