How to store field of hexagons
Hello everybody!
I'm working on a game that would look like Dicewars and my question is how to properly store field of hexagons.
I think it should look like matrix of values. Every value means whether hexagon relate to the certain player who owns it. Also each hexagon is a part of an area that can be conquered so it seems to be important to store relation of hexagon to the particular area.
Maybe there are any other better ways to do the same or kind of improvement.
Answer by Noobeloper · Mar 07, 2016 at 09:27 PM
OK, that's what I did and what suits my project:
// number represents belonging to certain zone
public static int[] array_of_hexagons = new int[] { 0, 0, 1
0, 1, 1
2, 2, 2 };
// array index is a zone
// array value is player's number
public static int[] belonging_to_player = new int[] {1, 2, 0};
// this means that zone 0 owner is Player 1,
// zone 1 owner is Player 2,
// and zone 2 isn't conquered by any player so far.
Your answer
Follow this Question
Related Questions
I need help to make a Ray hit a 2D sprite hexagon map. 1 Answer
Player Movement in a Turn Based Hexagon Game? 0 Answers
Looking for a turn-based strategy beginner's tutorial. 5 Answers
How can I create an array of hexagon tile types, while building hexagon grid? 0 Answers
Best way to implement the server-side of a online turn based game? 0 Answers