Results 1 to 4 of 4

Thread: Isometric !

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225

    Talking

    I've got myself an isometric engine partially written. Here's the blitting routine.

    Code:
    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

  2. #2
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    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?

  3. #3
    Member
    Join Date
    Aug 2000
    Location
    USA
    Posts
    32
    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 ???)
    -Koralt

  4. #4
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Ok. But still, even with DX, I think it uses too many calculations inside a double loop...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width