xboxscene.org forums

OG Xbox Forums => Software Forums => Development => Topic started by: vinsta18 on October 25, 2004, 11:53:00 AM

Title: What Would Slow Xbox/directx Down?
Post by: vinsta18 on October 25, 2004, 11:53:00 AM
Well, I am programming a 2D pixel * tile scrolling (console style) rpg for the xbox using the xdk.  I have written games much like this on pc before without any speed issues.  However, this is my first game using directx.  So I am wondering if there is something I am doing that is slowing it down.  At first I thought maybe it was the resolution, but on a machine with hardware specific to drawing a lot of shapes on the screen really fast (at this same resolution, 640x480) I guess it shouldn't be a problem.  This is what I am using right now:

Textures:  32x32 *.bmp files.
Texture drawing technique: D3DPT_TRIANGLESTRIP
Options:  #define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1)
Buffers: 2, 1 backbuffer, 1 frontbuffer
In the present parameters:
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;

Plus all these settings:
 
DXobject->CreateDevice(0, D3DDEVTYPE_HAL, NULL, D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, &DXDevice);

DXDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
DXDevice->SetTextureStageState(0,D3DTSS_COLORARG1, D3DTA_TEXTURE);
DXDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
DXDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
DXDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
DXDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);

then to actually draw the stuff on the screen, I do this:
//i make my vertecies according to the (x,y) values here
//they are made in a customvertex structure.
Createvertexbuffer
vertexbuffer->lock(.....);
//copy some values to the vertex buffer here
vertexbuffer->unlock();
DXDevice->SetTexture(0, theTexture);
DXDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
vertexbuffer->Release();

//then i call
DXDevice->Present(NULL, NULL, NULL, NULL);

Yeah, if anyone can see anything that drastically needs changing in order to speed things up, I would gladly appreciate it.

This post has been edited by vinsta18 on Oct 25 2004, 06:55 PM
Title: What Would Slow Xbox/directx Down?
Post by: fghjj on October 25, 2004, 01:27:00 PM
If you're going to draw lots of quads batching is the way.

btw. wouldn't you consider using SDL(x) to build your game? Then you can compile with OpenXDK in the future.. B)