2D Game with DX9 SDK

Started by
26 comments, last by G24UK 15 years, 3 months ago
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
Advertisement
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.
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.
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).
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]
Hello gamedev members,

It has been a few weeks since my last post and so far I have created a neat little engine with DX and windows wrapped safely away from the game code(which is yet to come). It does initialise DX and create a funky window. I am now onto the sprites and then direct input and then hopefully direct sound.

Is it possible to somehow get some feedback on this project here? I am not sure about uploading the whole thing here as there are 7 files in the project and I would not like to openly share this code with the internet as my fellow students might steal it from me lol. May I ask for the assistance of an experienced DX coder to help me further develop this project? Please PM me if you are kind enough to help me and I will email the beginnings of this little engine for your criticism, which is most welcome, and assistance in creating this game.

Thank you very much in advance
Might I recommend you use XAudio2 instead of Directsound? Directsound is on the way out. You wouldn't start writing an application designed for Windows 98, would you?

XAudio2 has a few quirks like it'll crash if you try to pan a mono sound without any debug messages, but aside from these, it is a much, much better designed sound API. And it works on Vista :P You'll definitely need the latest SDK since it was only released in 2008 (March, I think).

Having read the rest of the thread, you might find D3DX useful for its time-saving functions. D3DXCreateTextureFromFile supports BMP, PNG, JPG, DDS, etc. etc. Sure, you could write your own loaders, but there are loads of time savers in there. The flip-side is end-users have to update their DirectX if its older than the SDK version you are using, which is a bit of a pain for casual gaming, but I'd say its worth it.
Construct (Free open-source game creator)
Quote:Original post by AshleysBrain
Might I recommend you use XAudio2 instead of Directsound? Directsound is on the way out.


Having read the rest of the thread, you might find D3DX useful for its time-saving functions. D3DXCreateTextureFromFile supports BMP, PNG, JPG, DDS, etc. etc.


Hi AshleysBrain,

I have tested Nov08 DX SDK version and luckily it is compatible with the systems it will be run on. Apparently they updated to Aug08 recently. So thats out of the way. My project is now developed on the Novermber08 SDK, therefore I will use XAudio2 as you suggest, but it will take some time to get there :)

This is how the game flows so far:

start engine setup Win32 ready for D3D
start initialise D3D, eventually other components too
start game, load sprites into something that can be drawn(im puzzled here)

loop
update engine
update game
render stuff

shutdown game
shutdown DX components
shutdown engine

This is my sprite loader. It is called upon on game initialisation and load sprites into D3D_SPRITE arrays, ie D3D_SPRITE enemy1[15];

void D3D_LoadSprite(D3D_SPRITE* pSprite, LPCTSTR File, u32 width, u32 height, u32 cols, u32 rows)
{
D3DXCreateSprite(D3D_CORE_Settings.D3D_Device, &Sprite);
D3DXCreateTextureFromFileEx(D3D_CORE_Settings.D3D_Device,
File,
D3DX_DEFAULT,
D3DX_DEFAULT,
D3DX_DEFAULT,
NULL,
D3DFMT_A8R8G8B8,
D3DPOOL_MANAGED,
D3DX_DEFAULT,
D3DX_DEFAULT,
D3DCOLOR_XRGB(255, 0, 255),
NULL,
NULL,
&pSprite->Texture);

pSprite->width = width;
pSprite->height = height;
pSprite->cols = cols;
pSprite->rows = rows;

return;
}

I will draw the sprites in game render stage using this function:

void D3D_DrawSprite(D3D_SPRITE* pSprite, u32 Frame, f32 x, f32 y, f32 z)
{

RECT FrameBox;

FrameBox.left = (Frame / pSprite->cols) * pSprite->width;
FrameBox.top = (Frame / pSprite->cols) * pSprite->height;
FrameBox.right = FrameBox.left + pSprite->width;
FrameBox.bottom = FrameBox.top + pSprite->height;

D3DXVECTOR3 position(x, y, z);

Sprite->Draw(pSprite->Texture, &FrameBox, NULL, &position, D3DCOLOR_XRGB(255, 255, 255));

return;
}



This topic is closed to new replies.

Advertisement