Skip to main content
GameDev.net gamedev.net
🔒 Locked

Panzer General HEX Style

Started by Genmain Jun 13, 2002 at 10:51 PM 1 replies 450+ views
Original Post
Genmain
Genmain
Hi, Im new to Game programming and I would love to create a Panzer General clone. I have read a few articles on this site and others about creating a Hexagonal Map, but I still cant get one going. Like do I draw the Pologons using a Pen or do I use an External bit image, also Im having a hell of a time determing the actual Hexagon Im in with a mouse click coordinates. Perhaps a beginners level tutorial at doing something like this would be great if someone can point me in that direction. Thanks in Advance, another thing, what do you guys think about using C# as a game programming language.
CaptainJester
CaptainJester
If you have just started game programming, you should not try to do something this complicated yet. Start with Pong or Tetris and work your way up. If you don''t start simple, things will just get to complicated early on and you will just give up.

---
Make it work.
Make it fast.

"Commmmpuuuuterrrr.." --Scotty Star Trek IV:The Voyage Home
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][
Demiurge
Demiurge
first, to get a good idea on isometric games, get tanstaafl's book "iso. game prog. with dx7"
also, i believe he has some article on such things..probably on this site.
the general idea is that different types of maps have 2 differing sets of coordinates.
for instance, in slide maps (god help me if i know of a game that uses such a crappy map system), the map X runs east-west and Y runs northwest-southeast if i'm not mistaken.
in diamond maps, X runs northwest-southeast, and Y runs northeast-southwest, and tile (0,0) would be at the top.
or you could change it and put the zero tile at the left or whatever makes sense to you.
so to get to a certain tile you do tile walking, using an overloaded function or a function pointer, you return different POINT values for different map types in reference to the same direction (ie. in diamond, southeast tile of (x,y) would be (x+1,y) ).
that's tilewalking. then you do tileplotting, which is converting map coords to world coords, by multiplying the tile coords by a certain numbers of tile widths, heights, or halves thereof, on each axis.
for instance i think diamond maps are -
worldX = (tilex-tiley)*tilewidth/2
worldY = (tilex+tiley)*tileheight/2
or something like that.
as you see, world space is obviously bigger than screen space in most cases, so for that keep a POINT which represents the screen's (0,0) in the world.
then, to convert from world to screen coords, decrease that point's x and y values from a world x and y, or vice versa for the opposite..

as for checking which tile you're in, use a mousemap - either a picture of your tile shape with one center color and 4 side colors, or a matrix with possible values for the center and each of the corners.
if for instance you get the color/value which belongs to the northwest corner, you know you need to go 1 tile up and 1 tile left, and you use tilewalking to get that.

hope this was clear enough for a general overview

//Demiurge
Make something idiot proof, and someone will make a better idiot..

[edited by - Demiurge on June 14, 2002 12:18:47 PM]

[edited by - Demiurge on June 14, 2002 12:22:08 PM]
//DemiurgeMake something idiot proof, and someone will make a better idiot..

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.