Sign in to follow this  

2D Game with DX9 SDK

This topic is 3299 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello to all gamedev members. Firstly, I wish Merry Xmas and New Year to everyone! I am a beginner with C++. I would like to build a little 2D game with DX9 SDK(Aug07). I am limited to this version as it is the requirement for the project. It will be a simple space shooter sim with some nice sounds and sprites and ideally user scoreboards. This is my first game project. May I ask your advice and tips for writing this game, i.e. good places for 2D DX tutorials or tips for setting up DX for this kind of project or any information that you experienced programmers think will be useful to me. I am using Vista/VS2005 Pro and TortoiseSVN along with the mentioned SDK. Thank you in advance :) G

Share this post


Link to post
Share on other sites
For a free, online tutorial I really liked www.directxtutorial.com. It spends a lot of time on 3d graphics which you may want to skip, but has enough on sprites and input to get you going.

Share this post


Link to post
Share on other sites
Don't go to directxtutorials.com. It's just a good way to guarantee that you'll be back here making threads about the problems caused by the bad programming habits that site will teach you.

Evil Steve is working on a series of tutorials aimed at the same crowd as directxtutorials.com, but he's only finished the first one so far. It's up on his dev journal.

Toymaker has some tutorials that includes using the 2D sprite functionality, and they're at least a bit better than what's on directxtutorials.

Share this post


Link to post
Share on other sites
Thanks for the replies. I have spent the last couple of hours browsing directxtutorials.com. It seems pretty straight forward and well organised. It will be useful to me hopefully. Just wish all of the lessons were free...

I am familiar with toymaker site. The creator of this great site was actually my lecturer at Teesside, he is a great programmer and teacher. However I always seem to run into problems with his tutorials :) I do use it for reference though and it is a very good site.

Just checked DirectX properties on my pc, for some reason it is set to retail version of D3D9 (and everything else) and the checkpoint selection area is shaded grey - therefore I cant change this. Same with the Debug Output level slider. Any particular reason for this? How can I enable the debug mode? I think this is the cause for errors with "d3d9x_35.dll missing" I experienced earlier.

its about 4.30am... maybe I should sleep now

Share this post


Link to post
Share on other sites
Quote:
Original post by MooseHuffer
For a free, online tutorial I really liked www.directxtutorial.com. It spends a lot of time on 3d graphics which you may want to skip, but has enough on sprites and input to get you going.
NOOOOOOOOOOOOOOOOOOO

Please don't, for the sanity of yourself and everyone here who will have to answer your questions about all the bugs in that horrible, horrible code. It's not just obvious bugs, it's subtle ones that will cause your game not to work on some PCs, or to behave strangely in ways that appear not to be related to D3D.

Share this post


Link to post
Share on other sites
Any suggestion regrding DirectX control panel? How to enable debug please?
Is it essential?


Photobucket

Share this post


Link to post
Share on other sites
Quote:
Original post by G24UK
Any suggestion regrding DirectX control panel? How to enable debug please?
Is it essential?
You can code without it, but I wouldn't advise it. It'd be like trying to write an application by only ever compiling in release mode and running the EXE from explorer rather than the IDE.

The only time I've see the option to switch to the debug runtime disabled is if you have an old SDK (E.g from DX 9.0b), and a recent runtime (E.g. DX 9.0c).
Have you got the latest SDK? What version do you have? (Latest is November 2008).

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Quote:
Original post by G24UK
Any suggestion regrding DirectX control panel? How to enable debug please?
Is it essential?
You can code without it, but I wouldn't advise it. It'd be like trying to write an application by only ever compiling in release mode and running the EXE from explorer rather than the IDE.

The only time I've see the option to switch to the debug runtime disabled is if you have an old SDK (E.g from DX 9.0b), and a recent runtime (E.g. DX 9.0c).
Have you got the latest SDK? What version do you have? (Latest is November 2008).


bugger.... it is aug07 DX9 SDK. I am limited to the use of DX9 for this project as it will be run on older XP machines and not Vista like i am running here... is there any way around this please?

Share this post


Link to post
Share on other sites
Quote:
Original post by G24UK
bugger.... it is aug07 DX9 SDK. I am limited to the use of DX9 for this project as it will be run on older XP machines and not Vista like i am running here... is there any way around this please?
The latest DirectX SDK builds apps that run fine on XP, I have that set up like that on my work PC.

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Quote:
Original post by G24UK
bugger.... it is aug07 DX9 SDK. I am limited to the use of DX9 for this project as it will be run on older XP machines and not Vista like i am running here... is there any way around this please?
The latest DirectX SDK builds apps that run fine on XP, I have that set up like that on my work PC.


Does this apply to the release version only? This project will have to be rebuilt on the XP machine with DX9 sdk in debug mode and release mode.

Share this post


Link to post
Share on other sites
App built with the latest version of the SDK will work exactly like they did with old versions when it comes to XP: Release versions can be run on other CPU's if the appropriate redistributables (Visual C++ Runtime and DirectX Runtime) are installed, and debug versions will only work on PC's with the full SDK installed.

Share this post


Link to post
Share on other sites
Quote:
Original post by MJP
App built with the latest version of the SDK will work exactly like they did with old versions when it comes to XP: Release versions can be run on other CPU's if the appropriate redistributables (Visual C++ Runtime and DirectX Runtime) are installed, and debug versions will only work on PC's with the full SDK installed.
AFAIK there's no difference between compiling an app in debug or release mode when it comes to DirectX (Platform SDK is another matter). The debug version of D3DX is a static library (Or it was at one point certainly), so it won't require linking to any strange libraries.

Share this post


Link to post
Share on other sites
a bit confused. so I should not install the latest SDK?

My requirements: this CD will be compiled and run on the XP machine, along with the already compiled release version from my PC

3. The source-code and artefacts for the program on CD or DVD.

4. The compiled executable able to be run from CD or DVD (dlls and other files may need to be included so make sure you test this).

5. The workspace and project files for Visual Studio so that the program can be easily compiled.

so if I get the latest SDK, compile the project, burn it onto a disk - the release executable will work on XP however the project files will not?

shall I continue with aug07 SDK and disabled debugging?

Share this post


Link to post
Share on other sites
Quote:
Original post by G24UK
a bit confused. so I should not install the latest SDK?

My requirements: this CD will be compiled and run on the XP machine, along with the already compiled release version from my PC

3. The source-code and artefacts for the program on CD or DVD.

4. The compiled executable able to be run from CD or DVD (dlls and other files may need to be included so make sure you test this).

5. The workspace and project files for Visual Studio so that the program can be easily compiled.

so if I get the latest SDK, compile the project, burn it onto a disk - the release executable will work on XP however the project files will not?

shall I continue with aug07 SDK and disabled debugging?
You always need the latest SDK. Enabling the debug runtimes just enables debugging of any DirectX application on your PC - including commercial games. It has (as far as I know), no effect on the compiled file - so it'll work fine on XP or Vista, no matter if that PC is using the debug or the release runtimes.

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Quote:
Original post by MJP
App built with the latest version of the SDK will work exactly like they did with old versions when it comes to XP: Release versions can be run on other CPU's if the appropriate redistributables (Visual C++ Runtime and DirectX Runtime) are installed, and debug versions will only work on PC's with the full SDK installed.
AFAIK there's no difference between compiling an app in debug or release mode when it comes to DirectX (Platform SDK is another matter). The debug version of D3DX is a static library (Or it was at one point certainly), so it won't require linking to any strange libraries.


Oh it is a static lib? Never mind then. :P

Share this post


Link to post
Share on other sites
What is important to me is the smooth running of the project files on the XP machine. If I make this game with the latest SDK on my PC and then try to compile it on the older SDK XP pc - Will it work?

Share this post


Link to post
Share on other sites
Quote:
Original post by G24UK
What is important to me is the smooth running of the project files on the XP machine. If I make this game with the latest SDK on my PC and then try to compile it on the older SDK XP pc - Will it work?
So long as the DirectX SDK isn't too old. Some of the functions (Only D3DX ones I think) have changed slightly.

Having said that, you should be using pretty much the same SDK on all machines you develop on. I have 4 PCs I develop on, all of them have different SDK versions, but all are from 2008 (Jan or Feb, March, June or July, and November). So long as the SDK versions aren't wildly different, you have a good chance the code will compile fine (Although it's not guaranteed).

Share this post


Link to post
Share on other sites
I see. I think its best if I stick to the Aug 07 release as it is the latest DX9 release(correct me if Im wrong) since it will most likely be a lot diff to the Nov08 version

Share this post


Link to post
Share on other sites
Quote:
Original post by G24UK
I see. I think its best if I stick to the Aug 07 release as it is the latest DX9 release(correct me if Im wrong) since it will most likely be a lot diff to the Nov08 version
The latest DX9 release is the November 2008 SDK - it contains the headers and libraries for DX10 as well, but it still has the DX9 files.

I'd strongly recommend getting the latest SDK so you can enable the debug runtimes, they're absolutely invaluable. You can always install the November 2008 SDK on your XP and Vista machines.

I've used them already in the hour I've been programming tonight - trying to Reset() the device to go to fullscreen 640x480 on my widescreen laptop gives:
Direct3D9: :Subclassing window 00180768
Direct3D9: :StartExclusiveMode
Direct3D9: (ERROR) :Display mode is unsupported
Direct3D9: (ERROR) :Display mode is unsupported
Direct3D9: (ERROR) :Display mode is unsupported
Direct3D9: (ERROR) :Display mode is unsupported
Direct3D9: (ERROR) :Unable to set the new mode. CreateDevice/Reset Fails
Direct3D9: (ERROR) :ResetEx failed and ResetEx/TestCooperativeLevel/Release are the only legal APIs to be called subsequently

wheras Reset() returns the less than useful D3DERR_INVALIDCALL. Without the debug runtimes, I'd probably be trying all sorts of things before I discovered that this laptop can't do 640x480.

Share this post


Link to post
Share on other sites
Quote:
Original post by G24UK
I see. I think its best if I stick to the Aug 07 release as it is the latest DX9 release(correct me if Im wrong) since it will most likely be a lot diff to the Nov08 version


You will have no problems running an app on XP that you develop with the latest SDK, as long as you only use the DX9 portions.

Share this post


Link to post
Share on other sites
Guy's maybe I don't phrase my question correctly... How can I put it :

Ok, I understand that building an application with the latest SDK, completing it, releasing exe. The exe will run on XP/Vista no prob

BUT
ATTENTION NOW!
WILL THIS PROJECT (THAT IS BUILT WITH THE LATEST SDK AND THEN TRANSFERRED ON TO A PC WITH XP AND AN OLDER SDK) COMPILE AND LINK PROPERLY? The release version will work, OK. But will the source code compile again on this older machine?

Latest SDK being Nov 08 and project compiled on Vista
Older SDK being Aug 07 and project compiled on XP

Thanks

Share this post


Link to post
Share on other sites
Quote:
Original post by G24UK
BUT
ATTENTION NOW!
WILL THIS PROJECT (THAT IS BUILT WITH THE LATEST SDK AND THEN TRANSFERRED ON TO A PC WITH XP AND AN OLDER SDK) COMPILE AND LINK PROPERLY? The release version will work, OK. But will the source code compile again on this older machine?

Latest SDK being Nov 08 and project compiled on Vista
Older SDK being Aug 07 and project compiled on XP
"Maybe". I don't have the August 2007 SDK here to check. It depends if you rely on any behaviour that's out of date in the August 2007 SDK.

If you don't use D3DX, and only use D3D then I'm 99% sure it'll compile on both machines without modification. If you use D3DX, and especially ID3DXSprite or ID3DXFont, then you may have to make changes for the code to compile on one or the other - however, there's very little reason not to use the latest SDK for all development machines (The only reason I haven't is because I'm lazy, and it works for me currently).

I'd suggest trying it and seeing if it's a problem. If you get compile errors under the August 2007 SDK, then you could install the November 2008 SDK on that machine.
Any problems you get will be due to the functions changing parameters or names, not because of any XP vs Vista / DX10 issues.

Share this post


Link to post
Share on other sites
I don't know of any major changes made to the DX9 portions of the SDK between August '07 and August '08. As far as I know, your code should work fine with both SDK versions.

Share this post


Link to post
Share on other sites
Quote:
Original post by G24UK
Guy's maybe I don't phrase my question correctly... How can I put it :

Ok, I understand that building an application with the latest SDK, completing it, releasing exe. The exe will run on XP/Vista no prob

BUT
ATTENTION NOW!
WILL THIS PROJECT (THAT IS BUILT WITH THE LATEST SDK AND THEN TRANSFERRED ON TO A PC WITH XP AND AN OLDER SDK) COMPILE AND LINK PROPERLY? The release version will work, OK. But will the source code compile again on this older machine?

Latest SDK being Nov 08 and project compiled on Vista
Older SDK being Aug 07 and project compiled on XP

Thanks


It should unless you use new functionality which I doubt exists. However, the primary question is why you cannot use an updated SDK on the other machine? You mentioned it as a requirement, but that seems strange given that there is absolutely no benefit to using the older SDK (unless you need the MDX documents).

Share this post


Link to post
Share on other sites
I see. Well so far I think D3D will cover most functions as it is only a simple 2D game. Will have to test it tomorrow on the other machines

Thank you all for the input, thumbs up!
Will post more questions as they arise

[Edited by - G24UK on December 23, 2008 4:14:21 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this