Results 1 to 4 of 4

Thread: Hexagonal Maps

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Location
    Connecticut
    Posts
    2

    Question

    Hi everyone,

    I'm new to this forum (well, I've been lurking for a good few months now, just registered, though) and I've already got a question to throw out here. My main interest in Visual Basic is in game programming (I learned programming in C and C++, yet for some reason I've recently become obsessed with proving that Visual Basic can make top quality games) and I was hoping to expand my knowledge base a bit in an area where it is completely lacking - doing anything with hexagons.

    I don't know how many of you have played computer games such as Heroes of Might and Magic (or any tabletop wargame that uses a hex board), but what I'm looking to do is make a simple 'game board' consisting of a number of hexes. Unfortunetly, I lack any knowledge on the subject and wouldn't even know where to start. If anyone could provide a good explanation of the math behind this I would be extremely appreciative. Please no source code, though. I'm not looking to copy someone elses work or to memorize code, I'm more interested in understanding the process.

    -George

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Ok, first off, it's very possible to make games with vb, but you have better advantages making a good quality game in C++. But since you seem to want to proove it can be done with vb to, then you just need to be as stubborn as i am, since i've always tried to do games with VB, including such with elevated hextiles such as in settlers2.
    mapping a hexagonal area is probably easiest done with a tilted view:
    Code:
    _____
    \/\/\/
     \/\/\/
      \/\/\/
       \/\/\/
    whereas all tiles actually are triangle each even \/ and each odd /\. 6 of these forms a hexgon as you can see. The coordinates for each vertex is given by this formula:
    pixelx=(x+y/2)*tilewidth
    pixely=y*tileheight+heightoffset*elevation <-- this is if you need to have elevation.

    To draw these you need to use either bitblt or Ddraw, Ddraw is probably the best if you want to have a good quality game, although using that you are using a lot more C++ implementations than with bitblt lol. well if you need more help just ask.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Location
    Connecticut
    Posts
    2

    Thumbs up

    Hmmm.... yeah, I definetly see what you're saying. Thanks a lot for the help. My first program using your idea was kind of a mess (maybe I'm just a slow learning? hehe..), but then I revised it a bit and I'm off to a much better start. I managed to pretty much work out all the bugs I had in it and it looks like I've got my first working hex map program. Thanks a lot! ...

    As for game programming in VB -- yeah, I've had my fair share of hurtles to get over, but I am a pretty stubborn guy and I've kept with it (satisfying my C++ addiction by writing tutorials for my soon to be launched website ). I'm very familiar with using DX7 in C++, but I've come to understand that both DX7 and DX8 (which I just downloaded the full sdk for) have a good deal of Visual Basic support. Guess it's time to check eight out...

    ...anyway, thanks again for the help.

    [Edited by station-7.com on 12-14-2000 at 06:43 AM]

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    oh, you're familiar with using DX7 in C++, since were actually going in opposite direction, i know how to use DX7 in VB, and want to go on learning it in C++ and you on the other hand want to learn it in VB, i thought we might help each other do you have ICQ or something^?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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