Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (780)
Games in Android Showcase (233)
games submitted by our members
Games in WIP (857)
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 2141 times)
0 Members and 1 Guest are viewing this topic.
Offline Wandering Inquisitor

Junior Newbie

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

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?
Offline 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

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

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

Junior Newbie

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

Thanks!  Smiley 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!
Legends of Yore - The Casual Retro Roguelike
Offline 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.
Offline 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!  Grin
Pages: [1]
  ignore  |  Print  

hadezbladez (739 views)
2018-11-16 13:46:03

hadezbladez (379 views)
2018-11-16 13:41:33

hadezbladez (729 views)
2018-11-16 13:35:35

hadezbladez (191 views)
2018-11-16 13:32:03

EgonOlsen (2388 views)
2018-06-10 19:43:48

EgonOlsen (2550 views)
2018-06-10 19:43:44

EgonOlsen (1477 views)
2018-06-10 19:43:20

DesertCoockie (2141 views)
2018-05-13 18:23:11

nelsongames (1945 views)
2018-04-24 18:15:36

nelsongames (2624 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 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‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!