Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Game Programming > DirectX > Working Isometric DD engine... well, except for one little thing. Help!


Reply
 
Thread Tools Display Modes
  #1  
Old 04-04-2002, 08:10 PM
Mithrandel Mithrandel is offline
Junior Contributor
 
Join Date: Feb 2002
Location: They call me nowhere man.
Posts: 351
Unhappy Working Isometric DD engine... well, except for one little thing. Help!


Alright, this is just the graphics portion of a game engine which I've been working on for a week. All the art resources included should be fairly familiar to y'all. =)

Here's my problem (and this is why I included the pillars - you can see it much easier with them). Whenever I tell the program to draw a tile, it draws it twice - once where its supposed to, and once to the right and below it.

But for some darn reason, I can't figure out what is going on! Could I get some help, please? =/
Attached Files
File Type: zip omega.zip (54.2 KB, 71 views)
Reply With Quote
  #2  
Old 04-06-2002, 12:18 AM
Mithrandel Mithrandel is offline
Junior Contributor
 
Join Date: Feb 2002
Location: They call me nowhere man.
Posts: 351
Unhappy *sighs* Please?

Awww.. c'mon. Downloaded five times, but no one is willing to help. Code vultures! *makes weird cawing noises*
Reply With Quote
  #3  
Old 04-06-2002, 04:31 AM
Pookie's Avatar
Pookie Pookie is offline
Gaming God

Retired Leader
* Expert *
 
Join Date: Feb 2002
Location: Brisbane, Australia
Posts: 2,363
Default

Well I did look at it before and saw how confusing it was so gave up.

I'm actually writing a major game in my spare time at the moment which uses the isometric view for a map as well, but I use the coordinates on a 45 Degree shift to the right...

It's a bit hard to explain so this is my iso map routine if you are interested...
Code:
Private Sub DrawMap(Xposition As Long, Yposition As Long)

Dim x         As Long ' Loop Var
Dim y         As Long ' Loop Var
Dim XMap      As Long ' X Co-ordinate of tile
Dim YMap      As Long ' Y Co-ordinate of tile
Dim XIndent   As Long ' Indent every 2nd line down
Dim XOffset   As Long ' X offset of map tiles (-30 is half a tile's width)
Dim Yoffset   As Long ' Y offset of map tiles (-15 is half a tile's height)
Dim XSize     As Long ' How many tiles across the page

  XMap = Xposition
  YMap = Yposition
  XOffset = -30
  Yoffset = -15
  XSize = 15
  
  For y = 0 To 41
    For x = 0 To XSize
      
      BitBlt pctMain.hDC, XOffset + x * 60 + XIndent, Yoffset + y * 15, _
      60, 30, pctSprites.hDC, 180, 105, RasterOps.SRCAND
      BitBlt pctMain.hDC, XOffset + x * 60 + XIndent, Yoffset + y * 15, _
      60, 30, pctSprites.hDC, 120, 105, RasterOps.SRCPAINT
      
      If MAP(XMap, YMap).Wall(0) = 1 Then
        BitBlt pctMain.hDC, XOffset + x * 60 + XIndent, Yoffset + y * 15 - 120 - 30, _
        30, 135, pctSprites.hDC, 30, 0, RasterOps.SRCAND
        BitBlt pctMain.hDC, XOffset + x * 60 + XIndent, Yoffset + y * 15 - 120 - 30, _
        30, 135, pctSprites.hDC, 0, 0, RasterOps.SRCPAINT
      End If
      
      If MAP(XMap, YMap).Wall(1) = 1 Then
        BitBlt pctMain.hDC, XOffset + x * 60 + XIndent + 30, Yoffset + y * 15 - 120 - 30, _
        30, 135, pctSprites.hDC, 90, 0, RasterOps.SRCAND
        BitBlt pctMain.hDC, XOffset + x * 60 + XIndent + 30, Yoffset + y * 15 - 120 - 30, _
        30, 135, pctSprites.hDC, 60, 0, RasterOps.SRCPAINT
      End If
   
      XMap = XMap + 1
      YMap = YMap - 1
    Next x
    
    XMap = XMap - XSize - 1
    YMap = YMap + XSize + 1
    
    If XIndent = 0 Then
      XMap = XMap + 1
      Else
      YMap = YMap + 1
    End If
    
    XIndent = 30 - XIndent
    
  Next y

pctMain.Refresh

End Sub
It is no way near finished by any means and I will port it over to directdraw later when I'm happy with all the objects on the map appearing correctly as well as the 'smart draw' routine I will write which will only draw items which are visible incase there is a wall in front of them....

Hope this helps...
Reply With Quote
  #4  
Old 04-07-2002, 08:15 PM
hotrodx's Avatar
hotrodx hotrodx is offline
Centurion
 
Join Date: Jan 2002
Location: Philippines
Posts: 129
Default Re: *sighs* Please?

Quote:
Originally posted by Mithrandel
Awww.. c'mon. Downloaded five times, but no one is willing to help. Code vultures! *makes weird cawing noises*
Maybe they downloaded your file, checked it out, but can't offer any solutions. That's possible, man.

Anyway, I'll download it to check it out myself. If I can't reply back, maybe because I can't formulate a solution, NOT because I'm stealing your code.

Hope Pookie's suggestion helped.

Later.
Reply With Quote
  #5  
Old 04-07-2002, 09:50 PM
Mithrandel Mithrandel is offline
Junior Contributor
 
Join Date: Feb 2002
Location: They call me nowhere man.
Posts: 351
Default *flaps arms up and down*

((I'm a bat. What are you staring at?))

I was just kidding! Honestly, I don't make weird bird-noises in polite conversation! Seriously!

((Durn nose growing... gives me away every time!))
Reply With Quote
  #6  
Old 04-14-2002, 08:27 PM
AndreRyan AndreRyan is offline
Contributor
 
Join Date: Jan 2002
Posts: 489
Default

Look here:
Code:
For i = 0 To CInt(SCREEN_WIDTH / TILE_WIDTH) + 1
I would presume it would be:
Code:
For i = 0 To CInt(SCREEN_WIDTH / TILE_WIDTH)
It seems to cut down the amount of pillars drawn
Reply With Quote
  #7  
Old 04-14-2002, 11:10 PM
Mithrandel Mithrandel is offline
Junior Contributor
 
Join Date: Feb 2002
Location: They call me nowhere man.
Posts: 351
Default Well, I thought so too at first. But...

Actually, the added 1 in there is neccesary to prevent 'pop-in'... where pillars on the far right of the screen suddenly pop into view. This is neccesary because when the center of your screen is halfway between tiles, you need to draw in one extra layer of pillars on the far right side or else they'll pop in once you're stationary once more (and the pillars on the far left are no longer on the screen).

Heh. Good point though. Maybe I should write some sort of loop so that it only displays those extra pillars when you're moving? Save a few fps. =P

Ah, but I have a more interesting announcement. =/ Next post, please...
Reply With Quote
  #8  
Old 04-14-2002, 11:23 PM
Mithrandel Mithrandel is offline
Junior Contributor
 
Join Date: Feb 2002
Location: They call me nowhere man.
Posts: 351
Default Well, looks like isometric is out.

Well, thanks to everyone who downloaded the code and gave it a shot, but it looks like I'm going to be doing a traditional rectangle-based system, since I can't get the durn isometric tiles to give me the proper values.

And rectangles will make the art a bit easier to produce. A little harder to program, though, to make sure they still look 'right' (since I still hope to make it *look* isometric, even though its rectangle-based. I think StarCraft did this, too...).
Reply With Quote
  #9  
Old 04-17-2002, 10:41 PM
AndreRyan AndreRyan is offline
Contributor
 
Join Date: Jan 2002
Posts: 489
Default

This might help you, it's an isometric map example I downloaded a while ago.
Attached Files
File Type: zip isometric example.zip (38.2 KB, 50 views)
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->