Advertisement

DX Problem

Started by February 05, 2003 05:13 PM
1 comment, last by HeXaDeCiMaL86 21 years, 9 months ago
Ive recently been working on an isometric type of game, and ive been having problems with the tiles since day 1. No matter what i do, when tiles go off the screen they seem to be redrawn on the other side, which causes a lot of problems. I was wondering if this was a direct3d option i set or if i actually put the code in for it a hell of a long time ago and cant find it. Thanks
Two words - "Programmer Error". Your game will only render what you tell it to render, where you tell it to render.

Former Microsoft XNA and Xbox MVP | Check out my blog for random ramblings on game development

Advertisement
To be more helpful than the last guy, it sounds like your drawing isn''t clipping.

When you draw something to the screen, you are really just filling in sections of data on a big long string of cells.

Say each row is 4 cells long and 4 cells high. It would look like this:

0000
0000
0000
0000

If you are drawing a 2x2 square, at 1,1 (assuming upper left is 0,0) it would look like this:

0000
0XX0
0XX0
0000

But really, in memory, it looks like one big long string:

00000XX00XX00000

If you try moving the 2x2 square over to the right two spaces without checking for the edge of the screen, you get something like this, which is what I assume you are getting:

0000
000X
X00X
X000

In memory, it looks like 0000000XX00XX000

It may not look like they are offset because of how small the pixels are, but that''s what it is doing.

What you need to do is figure out if any of the pixels being displayed are out of the bounds of the screen and shouldn''t be displayed.

There are some things DX can do to help with clipping, so check them out in the SDK.

Hope this helps.

£§
£§

This topic is closed to new replies.

Advertisement