OpenGL only, needs directx still

Problems building or running the engine, queries about how to use features etc.
Post Reply
MacMan45
Kobold
Posts: 34
Joined: Fri Jun 11, 2004 4:51 am

OpenGL only, needs directx still

Post by MacMan45 »

I'm making some games with python-ogre, and when I packaged up the game for someone else, it complained about "d3dx9_35.dll" missing.

Which was easy enough to fix with an update of directx, but I'm happy just to stick to OpenGL.
However, I still got the message even if I don't include the Direct X renderer plugin.

I was hoping to release my games so anyone can play, without telling them they have to go & download a potential 80 megs or so first!

In the future I'm hoping to make games that I can sell, but for a download game, people aren't usually willing to go through the extra hassle of installing the latest directx.

So is there anyway around this?
I'm afraid that the majority of my potential customers will be running an older version of directx & be scared off from my games by having to update directx (which to some falls in the 'too hard basket'!)
Nathan Williams

Give someone a program - frustrate them for a day.
Teach them how to program - frustrate them for a lifetime.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

If you do not load the D3D9 plugin, you should not need D3DX. Whilst OIS might need DirectInput it doesn't refer to D3DX. Double-check how you're building your app, because OgreMain does not in any way rely on DirectX.

Even if you do use D3D, you can choose what version of Dx9 to depend on. Just rebuild OGRE against the version of the SDK you want to rely on. Just bear in mind that older versions will have older HLSL compilers which have some issues particularly with higher shader profiles.
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Post by syedhs »

I think the reason is because you load plugin via plugins.cfg and in it, you still have directx renderer to be loaded (but not used). So if this is the case, just remove the line and you are safe now.
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
reptor
Ogre Magi
Posts: 1120
Joined: Wed Nov 15, 2006 7:41 pm
Location: Finland
x 5

Re: OpenGL only, needs directx still

Post by reptor »

MacMan45 wrote:I'm afraid that the majority of my potential customers will be running an older version of directx & be scared off from my games by having to update directx (which to some falls in the 'too hard basket'!)
As a practice, I just created an installer for my little hobby game project.

I embedded the August 2008 DirectX re-distributable package into it.

Microsoft tells me that I can take files out of the re-distributable package to make it smaller. I figured out that my application only needs these files to be in the installer:

Aug2008_d3dx9_39_x86.cab
dsetup32.dll
DSETUP.dll
dxdllreg_x86.cab
dxnt.cab
DXSETUP.exe
dxupdate.cab

The combined size of these files is 16.4 MB.

Then I also put these files into the installer:

vcredist_x86.exe 1.73 MB
oalinst.exe 764 KB
PhysX_Game_installer_281.msi 4.03 MB

So the size of the additional files is ~22.9 MB. The game folder is currently only 13.8 MB. Together, they make ~36.7 MB.

The installer is 25.5 MB. I used Inno Setup to create it with lzma compression.

All of the embedded installers can be run in silent mode and that is exactly what I do in my installer. The person who wants to install the application, does not need to do anything else than start the installer and it installs the required DirectX, OpenAL, PhysX and Visual C++ files silently.

Only thing would be, if the user didn't have DirectX 9.0c installed at all, then the computer would have to be re-started after the installation (I didn't test, Microsoft tells it so it is probably true).

I don't think the 22.9 MB is too much. Consider, that my game doesn't have much data yet. Its size will grow a lot from what it is now. The 22.9 MB will be maybe 10-20 % of the total size of the data that needs to be distributed to the user. Of course this depends on what kind of game you make. But as I see it, the 22.9 MB isn't too much even if my game data was 10 MB only.



Reference:

DirectX Installation for Game Developers
http://msdn.microsoft.com/en-us/library ... S.85).aspx
Small Installation Packages

You can create smaller installation packages for DirectX by stripping the contents of the DirectX redistributable folder down to the minimal set of files required to make the installer work and retaining any additional components that your game uses.

Depending on your minimum specifications, you might not even need to include the core DirectX 9.0c cabinet files in the redistributable folder of your installation media. A large majority of Windows XP installations have Service Pack 2, which includes the core DirectX 9.0c components, so the DirectX setup operation will be very fast and will not require a reboot. The smallest package that can be created is about 3 MB, and it can be compressed to about half that size. A package like this contains one version of the D3DX DLL, and it requires that DirectX 9.0c be already present.

The minimal set of files that are required to build a redistributable package are the following files, located in the DirectX SDK Redist folder (Program Files\DirectX SDK\Redist\):

dxsetup.exe

dsetup32.dll

dsetup.dll

dxupdate.cab

dxdllreg_x86.cab

Add to these the cabinet files for the components that you want to install. If you require the users of your application to already have DirectX 9.0c, then you do not need to include DirectX.cab or dxnt.cab, which make up most of the space requirement. DirectX.cab is only needed for Windows 98 and Windows ME, and dxnt.cab is only needed for Windows 2000, Windows XP, and Windows XP SP1. Also, if you do not make use of DirectShow, or you assume that it is already installed, you can omit BDA.cab, BDANT.cab, and BDAXP.cab.

Note You can assume that users of your application already have DirectX 9.0c if it was installed by a previous version of your application, you force users to manually update via the Web Installer, or you assume that they have Windows XP SP2 or later.

Continuing with this example, if you are using only the 32-bit version of D3DX for April 2006, you can add Apr2006_d3dx9_30_x86.cab. If you are using the 32-bit August 2006 32-bit version of XINPUT, you add Aug2006_xinput_x86.cab.

If you have a native 64-bit application, you'll need to add the _x64 versions. However, if you have a 32-bit application running on a 64-bit OS, the 32-bit versions of the DLLs will work.

You can then distribute this package of files and launch DirectSetup in silent mode or run dxsetup.exe in the command shell in silent mode. Remember not to guard this package by any version checking of files, and make sure that your users cannot opt out of running the DirectX setup, because either of these events creates a fallible installation process.
See, you can even get a smaller DirectX update than what is in my example if you leave out some more files, if you tell your users to have DirectX 9.0c installed, without caring about which version it is.

I'll show it here. If I require that the users of my application have DirectX 9.0c installed, but don't care about the exact version, then the file list would be:

Aug2008_d3dx9_39_x86.cab
dsetup32.dll
DSETUP.dll
dxdllreg_x86.cab
DXSETUP.exe
dxupdate.cab

The combined size of these files is 3.75 MB. If the user doesn't have some version of DirectX 9.0c installed already, then the installation would fail.


Another reference:

Installing DirectX with DirectSetup
http://msdn.microsoft.com/en-us/library ... S.85).aspx
Reducing the DirectX Redistribution Size

The DirectX redist default file set contains all the files that are needed to support all DirectX applications. It is highly recommend that developers use all the files in the DirectX Redist folder. To reduce the size of the DirectX redist footprint, you may remove optional DirectX SDK redistributable files. These files are listed in the CD root\Documentation\License Agreements\DirectX Redist.txt.

For example, here are several common scenarios:

No BDA Support (3 megabyte savings)
If your application does not require broadcast driver architecture (BDA) support then the following can be removed BDA.CAB, BDANT.CAB, and BDAXP.CAB.

No Managed DirectX (approximately 5 megabyte savings)
If your application does not require Managed DirectX then the MonthYear_MDX1_x86.CAB and MonthYear_MDX1_x86_Archive.cab files may be removed from the redist folder.

D3DX Support (approximately 17 megabyte savings)
If your application does not require D3DX 9 or if you only require a specific month's release, then the older MonthYear_d3dx9_HeaderVersion_x86.cab and the MonthYear_d3dx9_HeaderVersion_x64.cab files may be removed from the redist folder.

No 64-bit support (approximately 10 megabyte savings)
If your application is NOT a native 64-bit (x64) application then *_x64.cab files may be removed from the redist folder.

DirectX 9.0c is installed
If your application requires DirectX 9.0c (or higher), then you may remove the DirectX.cab and the DXnt.cab from the redist folder. However, if you remove these cabs from the redist folder (and DirectX 9.0c (or higher) is not installed), DirectXSetup will fail.

No XInput support ( less than 1 megabyte savings)
If your application does not require the XInput API, you may remove the MonthYear_xinput_x86.cab and MonthYear_xinput_x64.cab files from the redist folder.

No XACT Support (approximately 1 megabyte savings)
If your application does not require the XACT API, you may remove the MonthYear_xact_86.cab and MonthYear_xact_x64.cab files from the Redist folder.

For instance, suppose you know that your customer has DirectX 9.0c installed, and you want the smallest redist that only includes the 32-bit version of the D3DX library from the December 2005 SDK release. For this scenario, you need to include the following CAB files in the redist folder:
dxsetup.exe
dsetup32.dll
dsetup.dll
dxupdate.cab
dxdllreg_x86.cab
Dec2005_d3dx9_28_x86.cab

Your installation can use the DirectXSetup API or run DXSetup.exe to install the D3DX component.
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Post by syedhs »

Hmm suppose you know your customer has DirectX 9.0c installed, what could be the problem if you simply bundle together the related d3dx9_XX.DLL? I have always done this, and so far there is no problem.
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
reptor
Ogre Magi
Posts: 1120
Joined: Wed Nov 15, 2006 7:41 pm
Location: Finland
x 5

Post by reptor »

Well, that was the question I had in mind as well.

My conclusion is this.

The DirectX installer just writes the missing files to the user's system.

And the applications which use some version of DirectX, only use that version. The presence of newer DirectX files, or a presence of a partial update of DirectX (like in my example), will not break things. Because older applications, which were working before on that computer, are not asking for files which are missing from the DirectX update which came with my installer.

So I think there will be no problem. This is an impression I get from the MSDN articles. Why else would they tell us that we can do it. If there was a problem, then they wouldn't be telling us that we can do it.

Edit: Or do you mean that you put the DLL with your game but don't install it to the system directory? I don't know about that. But I think I saw Microsoft mention somewhere that it is not recommended.
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Post by syedhs »

reptor wrote: Edit: Or do you mean that you put the DLL with your game but don't install it to the system directory? I don't know about that. But I think I saw Microsoft mention somewhere that it is not recommended.
Yes exactly, just put the d3dx9_xx.dll together with your directx render plugin. I do think it is not recommended, but so far there is no problem. And I would like to know why it is not recommended.
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
reptor
Ogre Magi
Posts: 1120
Joined: Wed Nov 15, 2006 7:41 pm
Location: Finland
x 5

Post by reptor »

Well, one reason why it is not recommended could be that that way people can end up having many copies of the exact same file on their hard disk drives.

If each application installs their own private copy of the exact same file.

I don't know other reasons.

The other way, which I am planning to use and explained above, suffers from duplication as well, but in that case the duplicates will not be installed to the user's system.
MacMan45
Kobold
Posts: 34
Joined: Fri Jun 11, 2004 4:51 am

Post by MacMan45 »

Thanks for the help everyone.

I wasn't loading it in plugins.cfg (I have about 4 years experience with ogre on & off!), but I think it might be an issue with python-ogre (or maybe when I use py2exe).
I'll look into it more and try to find where the dependency comes from.

As for including it in the directory, that is apparently against the EULA for directx.
It also means that if a security issue is found in the dll, it won't get fixed / updated, and you are exposing the user to possible problems.

If I can't fix it, I'll just roll the web-install into my game's installer, so the user only needs to download as much extra as they need.

As for size, I'm actually aiming at 10 megs or less right now.
I had to use UPX (& a fully zipped media folder) to reach it, but it cut things down from 40 meg to 7 for my last project! (The python-ogre bindings get kinda big when included by py2exe)
Nathan Williams

Give someone a program - frustrate them for a day.
Teach them how to program - frustrate them for a lifetime.
reptor
Ogre Magi
Posts: 1120
Joined: Wed Nov 15, 2006 7:41 pm
Location: Finland
x 5

Post by reptor »

Actually, I think Microsoft says that you should not include their DirectX web-installer in your own installer. They say you should point the user to their website instead. I think I read this from the DirectX SDK documentation.
Post Reply