Java-Gaming.org Hi !
 Featured games (91) games approved by the League of Dukes Games in Showcase (757) Games in Android Showcase (229) games submitted by our members Games in WIP (844) 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 1981 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

 EgonOlsen (58 views) 2018-06-10 19:43:48 EgonOlsen (40 views) 2018-06-10 19:43:44 EgonOlsen (60 views) 2018-06-10 19:43:20 DesertCoockie (239 views) 2018-05-13 18:23:11 nelsongames (141 views) 2018-04-24 18:15:36 nelsongames (140 views) 2018-04-24 18:14:32 ivj94 (882 views) 2018-03-24 14:47:39 ivj94 (143 views) 2018-03-24 14:46:31 ivj94 (794 views) 2018-03-24 14:43:53 Solater (158 views) 2018-03-17 05:04:08
 Java Gaming Resourcesby philfrei2017-12-05 19:38:37Java Gaming Resourcesby philfrei2017-12-05 19:37:39Java Gaming Resourcesby philfrei2017-12-05 19:36:10Java Gaming Resourcesby philfrei2017-12-05 19:33:10List of Learning Resourcesby elect2017-03-13 14:05:44List of Learning Resourcesby elect2017-03-13 14:04:45SF/X Librariesby philfrei2017-03-02 08:45:19SF/X Librariesby philfrei2017-03-02 08:44:05
 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