Java-Gaming.org Hi !
 Featured games (90) games approved by the League of Dukes Games in Showcase (778) Games in Android Showcase (231) games submitted by our members Games in WIP (856) games currently in development
 News: Read the Java Gaming Resources, or peek at the official Java tutorials
 Home Help Search Login Register
Pages: [1]
 ignore  |  Print
 Newbie hex map  (Read 2102 times) 0 Members and 1 Guest are viewing this topic.
Wandering Inquisitor

Junior Newbie

 « Posted 2012-11-12 07:32:08 »

Hello,
I am looking for any advice on how to approach a simple hex based game.  The map is hexagonal rather than square and I’d like the size (radius from the center) to be chosen by the player.  I’ve got most all the other components of the game written out in my notes but I’m not sure how hex grids are usually handled.  Are they usually treated as arrays (two dimensional arrays maybe) or is there another way?
Phased
 « Reply #1 - Posted 2012-11-12 07:36:50 »

I'm sure its handled the exact same as square tile map, just a different rendering technique.

How to get the center?
You could use the 2 point distance formula

http://www.purplemath.com/modules/distform.htm

distance = the square root of ( (x2 - x1)2 + (y2 - y1)2)

then divide the distance by 2 to get the raidus.
Wandering Inquisitor

Junior Newbie

 « Reply #2 - Posted 2012-11-13 01:56:01 »

Thanks!  I'm not as far as rendering anything, just trying to get something to work through the console.  Do you know any tutorials on how to setup a square map?  I've gotten a few square maps to work in another project but it was pretty ugly and didn't rely on coordinates but direct connections in each square.
 Games published by our own members! Check 'em out!
loom_weaver

JGO Coder

Medals: 17

 « Reply #3 - Posted 2012-11-13 02:32:46 »

Amit's Game Programming pages probably has the best in-depth treatise regarding hex maps and coordinates.

http://www-cs-students.stanford.edu/~amitp/gameprog.html
Wandering Inquisitor

Junior Newbie

 « Reply #4 - Posted 2012-11-13 06:32:40 »

Awesome, that site is great!  I think I've worked out all my issues with the map.  Thanks guys!
Pages: [1]
 ignore  |  Print

 hadezbladez (377 views) 2018-11-16 13:46:03 hadezbladez (198 views) 2018-11-16 13:41:33 hadezbladez (380 views) 2018-11-16 13:35:35 hadezbladez (93 views) 2018-11-16 13:32:03 EgonOlsen (2195 views) 2018-06-10 19:43:48 EgonOlsen (2245 views) 2018-06-10 19:43:44 EgonOlsen (1387 views) 2018-06-10 19:43:20 DesertCoockie (2025 views) 2018-05-13 18:23:11 nelsongames (1691 views) 2018-04-24 18:15:36 nelsongames (2337 views) 2018-04-24 18:14:32
 LiquidNitrogen 14x KaiHH 14x Spasi 13x orange451 13x 65K 10x bullen 9x NuclearPixels 9x gouessej 8x polinc 7x Zemlaynin 7x VaTTeRGeR 6x CJC 3x cygnus 3x philfrei 3x SHC 2x princec 2x
 Deployment and Packagingby mudlee2018-08-22 18:09:50Java Gaming Resourcesby gouessej2018-08-22 08:19:41Deployment and Packagingby gouessej2018-08-22 08:04:08Deployment and Packagingby gouessej2018-08-22 08:03:45Deployment and Packagingby philfrei2018-08-20 02:33:38Deployment and Packagingby philfrei2018-08-20 02:29:55Deployment and Packagingby philfrei2018-08-19 23:56:20Deployment and Packagingby philfrei2018-08-19 23:54:46
 java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org