PlaneShift

Development => Development Deliberation => Topic started by: YellowShadow on February 05, 2007, 05:18:25 am

Title: Using Direct X
Post by: YellowShadow on February 05, 2007, 05:18:25 am
I know that Crystal Space has support for Direct3D/DirectX so would it be possible for me to change the source code to use Direct3D/DirectX?


-YellowShadow
Title: Re: Using Direct X
Post by: Xordan on February 05, 2007, 05:20:29 am
With enough time, you can do anything. So yes.

However, I'm not sure how good the support is in CS for it (DirectX).
Title: Re: Using Direct X
Post by: YellowShadow on February 05, 2007, 05:23:38 am
Hmm, I'll check on that. Also is PlaneShift made with OpenGL or does it have an option to use Direct X or OpenGL.
Title: Re: Using Direct X
Post by: Xordan on February 05, 2007, 05:39:54 am
Atm we only use OpenGL.
Title: Re: Using Direct X
Post by: YellowShadow on February 05, 2007, 06:15:00 am
Okay. I'll try my best to implent DX and see what happens.
Title: Re: Using Direct X
Post by: Ralleyon on February 06, 2007, 06:49:13 pm
Currently, PlaneShift supports 3 major platforms: Windows, Linux and MacOS. If you switch to DirectX completely, it reduces the player base to Windows only which wouldn't be fair. If it is only as an alternative, and only for Windows, sure, go ahead. But is it really worth the effort? :)
Title: Re: Using Direct X
Post by: ThomPhoenix on February 06, 2007, 07:09:43 pm
I don't see the benefits of Planeshift using DirectX, would you like to explain the reasons why you think PS needs DirectX support?
Title: Re: Using Direct X
Post by: Wired_Crawler on February 06, 2007, 07:37:19 pm
Crystal Space currently does not support Direct3D, although it has some kind of (preliminary) support for Direct Draw 8 2D rendering (last reference in history.old is dated 3-Jun-2001). It is listed on current TODO list as low priority optional feature.

Quote from: Crystal Space Docs
     * Direct3D: Not currently supported. (If you would like to write a
       Direct3D renderer, please contact us.)

If You want Direct3D in Planeshift, write appropriate plugin for CS.

Then in Planeshift switching to DirectX/Direct3D would require only some changes in psclient.cfg, for example:

System.PlugIns.iGraphics3D = crystalspace.graphics3d.Direct3D
Video.DDraw.Canvas = crystalspace.graphics2d.ddraw

No need to mangle PS code :).
Title: Re: Using Direct X
Post by: YellowShadow on February 07, 2007, 04:29:16 am
Wait what there is no Direct3D renderer!?!?!?!. Psh, nice Crystal space.
Title: Re: Using Direct X
Post by: LigH on February 07, 2007, 12:54:25 pm
The great advantage of OpenGL is: Operating System independency.

PlaneShift does not support the most complex 3D effects, so it runs fine on a great variety of hardware (e.g. smooth enough on a GeForce2 GTS and 800 MHz AMD Duron in 1280x960 pixels resolution) via the OpenGL based, mainly OS independent, CrystalSpace 3D engine.

Switching to any DirectX version specific API will have several disadvantages:

- DirectX is only well supported under Windows. Linux support under WineX is limited (maybe even wrapped to OpenGL?).
- The several DirectX version APIs are not completely compatible to each others.
- Direct3D is not as flexible as OpenGL: in OpenGL, you can use or ignore some "extensions"; for Direct3D, you may have to select another API version for better looking effects. But ... how much graphic effects does a roleplaying game really need? So much that you would risk losing good friends with outdated hardware?

There is, however, one part of the DirectX API which is supported in the Win32 version: DirectSound. An OS independent audio system, like OpenAL, is unfortunately not yet as usual as the OS independent graphics system, OpenGL.
Title: Re: Using Direct X
Post by: Induane on February 07, 2007, 01:33:30 pm
Quote
Wait what there is no Direct3D renderer!?!?!?!. Psh, nice Crystal space.

LigH has it right.  When creating a 3d engine thats designed to be 100% portable across all major platforms then directx is out.  Its one of those features that doesn't deserve any priority.  In effect spending all kinds of time with a directx renderer makes no sense at all.  It would totally limit the scope and purpose of the entire crystalspace project.  Since PS relies on crystalspace for its 3d engine, its simply not feasible to add directx rendering without as wired_crawler said, creating a whole new rendering plugin.  I'm not sure what Psh, nice crystalspace means...  it seems that they made the appropriate, intelligent, and overall correct choice.  There simply aren't that many things about directx that make it that worthwhile.  Also, since windows won't be making directx 10 for windows, its further limiting itself to windows vista... so its not even very open on windows - it limits what windows versions you can run too.  OpenGL 2.0 specs have been out for a bit, and once drivers are taking advantage of that it will be out ahead of DX in many ways featurewise anyways.  Both have their feature advantages but I'm really not sure an intelligent person could justify making directx a priority given the goals of the project, and balking at them for not having a directx renderer doesn't help much either.
Title: Re: Using Direct X
Post by: Xordan on February 07, 2007, 10:41:37 pm
There is, however, one part of the DirectX API which is supported in the Win32 version: DirectSound. An OS independent audio system, like OpenAL, is unfortunately not yet as usual as the OS independent graphics system, OpenGL.

MS is dropping hardware accelerated Direct3D sound and going for OpenAL (still hardware accelerated) pretty much now (with Vista). So OpenAL is going to become much wider used than OpenGL very quickly.
Title: Re: Using Direct X
Post by: LigH on February 08, 2007, 08:11:28 am
:D Good news, Xordan!

And if there are "generic" OpenAL drivers available (e.g. DSound wrappers), then the change will be easy...


Oh, did I say "if"? -- OpenAL driver downloads (http://www.openal.org/downloads.html), supported platforms and technologies (http://www.openal.org/platforms.html)
Title: Re: Using Direct X
Post by: konzy on March 15, 2007, 01:41:28 am
MS is dropping support for XP at year end 2007 many will be switching simply for the sexy backend of vista and its updates.  <sarcasm> As all the vista users would agree, making opengl play nice with vista if fun! </sarcasm>
Title: Re: Using Direct X
Post by: Xordan on March 15, 2007, 02:44:35 am
The current opengl performance problems with Vista are due to the graphics drivers, not Vista itself. So it's not MS's fault, blame the graphics vendors :P
Title: Re: Using Direct X
Post by: Kaerli on March 15, 2007, 12:32:31 pm
The current opengl performance problems with Vista are due to the graphics drivers, not Vista itself. So it's not MS's fault, blame the graphics vendors :P
I have heard that M$ made writing Vista graphics drivers into a royal PITA though...
Title: Re: Using Direct X
Post by: Xordan on March 15, 2007, 01:16:47 pm
Even if true that's no excuse for these multi-billion dollar companies who had months, if not years to write them before release.
Title: Re: Using Direct X
Post by: Induane on March 17, 2007, 04:33:46 am
Part of the problem is actually, at least according to msdn article I read, that windows vista provides opengl support in a similar but reversed manner to the way wine handles d3d, which is by routing opengl calls to directx equivalents - so opengl in vista is provided via a wrapper, which they claim is necessary because the desktop uses directx so you can't switch renderer's on the fly.
Title: Re: Using Direct X
Post by: Xordan on March 17, 2007, 05:51:59 am
Well, both the ati and nvidia vista drivers claim 'native opengl support', so you'll probably find that opengl can either be done natively in the driver, or by rerouting opengl calls to directx in software.
Title: Re: Using Direct X
Post by: Induane on March 18, 2007, 03:01:35 am
You're right!! I did some digging and found out that it IS possible now thank goodness.  Sounds like Microsoft is deliberately trying to kill opengl, but failing :D

Quote
Quote
The reason why OpenGL was not ever officially supported by Microsoft was because of Direct3D. Direct3D is Microsoft’s driver model whichis intended to make OpenGL unnecessary. However many games and applications use OpenGL even today. With Windows Vista, Microsoft made it clear that OpenGL support would only work as a layer sitting on top of Direct3D. There was going to be translation involved and thus, a performance hit.

This week the Khronos group, which is responsible for developing and maintaining OpenGL, has released a report indicating that OpenGL support will now be natively supported in Vista without layering over Direct3D. Using standard Windows installable client driver (ICD), OpenGL will be fully accelerated and be fully compatible with Windows Vista's Aeroglass UI. In fact, Khronos says that by the time Windows Vista ships, Aeroglass performance on OpenGL will be superior to that of Direct3D. According to Khronos and NVIDIA:

    * Hardware overlays are not supported
    * Hardware OpenGL overlays are an obsolete feature on Vista
    * ATI and NVIDIA strongly recommend using compositing desktop/FBOs for same functionality

However, the OpenGL ICD drivers must still bedownloaded and will not ship on the Windows Vista installation disc. Khronos said that NVIDIA already has a beta 2 ICD OpenGL driver available and ATI will release its own soon. If no ICD is present, Windows Vista will rely on thelayered OpenGL mode by default and only offer basic functionality.
Title: Re: Using Direct X
Post by: lordraleigh on March 21, 2007, 06:35:33 am
You're right!! I did some digging and found out that it IS possible now thank goodness.  Sounds like Microsoft is deliberately trying to kill opengl, but failing :D

Still I wonder if I should keep with Windows XP as long as possible, or until Vista Sevice Pack 6 is released.

And yes, coding support for Direct X is an utter waste of time for a game that uses an open-source engine and that is intended to work on other OSes besides Windows. Why won't PS support DirectX? Because it's intended to be multi-platform and not an Windows-only game, because it would duplicate efforts and for similar reasons it won't have Havok 2.0 physics engine as a feature as well, I believe that open-source projects should avoid alltogether relying on commercial copyrighted technologies for their creation.