PDA

Click to See Complete Forum and Search --> : Isometric !


git
Jan 22nd, 2001, 10:33 PM
I've got myself an isometric engine partially written. Here's the blitting routine.


Private Sub BitBltMap()
Dim TempX As Integer
Dim TempY As Integer
On Error Resume Next
TacPic.Cls
For Y = 1 To 22
For X = 0 To 16
TempX = ((XOffSet + Y) + (YOffSet + (X - (MapYSize \ 2))))
TempY = ((XOffSet + Y) - (YOffSet + (X - (MapYSize \ 2))))
If Not TempX < 1 And Not TempY < 1 And Not TempX > MapXSize And Not TempY > MapYSize Then
BitBlt TacPic.hDC, (X * 40) - 20, (Y * 20) - 20, 40, 19, TileSource.hDC, (Map(TempX, TempY, 1) - 1) * 40, 19, vbSrcAnd
BitBlt TacPic.hDC, (X * 40) - 20, (Y * 20) - 20, 40, 19, TileSource.hDC, (Map(TempX, TempY, 1) - 1) * 40, 0, vbSrcPaint
End If
Next X
For X = 1 To 16
TempX = ((XOffSet + Y) + (YOffSet + (X - (MapYSize \ 2))))
TempY = ((XOffSet + Y) - (YOffSet + (X - (MapYSize \ 2))))
If Not TempX - 1 < 1 And Not TempY < 1 And Not TempX - 1 > MapXSize And Not TempY > MapYSize Then
BitBlt TacPic.hDC, (X * 40) - 40, (Y * 20) - 30, 40, 19, TileSource.hDC, (Map(TempX - 1, TempY, 1) - 1) * 40, 19, vbSrcAnd
BitBlt TacPic.hDC, (X * 40) - 40, (Y * 20) - 30, 40, 19, TileSource.hDC, (Map(TempX - 1, TempY, 1) - 1) * 40, 0, vbSrcPaint
End If
Next X
Next Y
End Sub


How do I figure out the square location of the mouse ? (FYI, the 1 in the 3rd array value is a placeholder for the z-axis)

Btw I'll be converting over to Direct Draw soon enough, don't worry. ;)

-Git

Jotaf98
Jan 27th, 2001, 11:53 AM
Isometric engines have a problem: half of each tile is not blted, which makes it slower than it should...

So, it would be better to have a lookup table with the positions of the pixels we have to blt! What do you think?

Koralt
Jan 27th, 2001, 03:25 PM
Actually, in a well-designed iso engine, that attribute can make it go *faster* than a standard engine, believe it or not. It can also allow it to take less memory for each image.

git's code has one majour inneficiency (besides the fact that it uses BitBlt, which does draw, actually, *4* times as much as it needs to -- first the mask, then the image, both of which are twice as large as is necessary), and that's that it uses multiplication for each tile. A series of cumulative additions would be much faster, but the effect would be negated by BitBlt's legendary slowness.

*Anyway* ... this is just a simple case of solving for two variables given two formulae. That's pretty easy (subtraction, anyone ???)

Jotaf98
Jan 28th, 2001, 07:07 AM
Ok. But still, even with DX, I think it uses too many calculations inside a double loop...