After some trial and error I finally have some objects being created and being positioned. I've just chucked down some reference dots for the time being since I haven't drawn a hexagon yet, but even still it does not seem like they have been positioned as I wanted them.
Development diary for a hex-grid based tactics game (currently unnamed). Game will have a battle system similar to FFTA, and a system of obtaining new characters similar to colllecting/catching pokemon in the original games.
Tuesday, November 22, 2016
Monday, November 21, 2016
Learning!
Short update:
Just been spending time learning object structure, hierarchy and components in Unity. Should be able to have the hex map created and visible next time.
Just been spending time learning object structure, hierarchy and components in Unity. Should be able to have the hex map created and visible next time.
Wednesday, November 16, 2016
Basic Hex Map
Not much work today. Created a method that should generate a basic hexagonal field of hexagons. Haven't been able to test out if this properly works yet, but it's based on the hexagon article linked in a previous post.
My next step is to be able to render the hexagons (create Unity objects?), thus also testing whether the generating works properly. After this I'll add height variation and we'll see where that leads us.
My next step is to be able to render the hexagons (create Unity objects?), thus also testing whether the generating works properly. After this I'll add height variation and we'll see where that leads us.
private void Generate() { int range = 5; for (int i = -range; i <= range; i++) { for (int j = Math.Max(-range, -i - range); j < Math.Min(range, -i + range); j++) { var k = -i - j; _map.Add(HexCoord.ToString(i, j, k), new HexTile(i, j, k)); } } }
Tuesday, November 15, 2016
HexCoord class
Something I forgot to mention in my first post was that I would be using the Unity3D game engine for this project. I am very new to Unity so there may be some hurdles along the way, but have many years experience in C# so at least the syntax and language specific intricacies will not be a hassle.
Contrary to last post I decided, since the tiles are stationary anyway, it is better to do the conversion on creation of a HexCoord, but looking at the math it didn't seem to matter too much anyway. Ended up with a HexCoord class, and now I'm building up a HexTile class, which will include things like height, position, terrain type, etc. The rest of the hexagonal functionality code will come when I end up needing it, but for now, I need a way to store all the HexTiles.
My thinking is, since the battle grids are always going to be seemingly random in shape and size, storing the coords in an offset format in a 2D array would be wasting space. Instead I'm going to store them in a Dictionary and access them via position.
Hopefully in the next few days I have something more to show than just code, but I imagine I'll get stuck with learning how to use Unity.
Contrary to last post I decided, since the tiles are stationary anyway, it is better to do the conversion on creation of a HexCoord, but looking at the math it didn't seem to matter too much anyway. Ended up with a HexCoord class, and now I'm building up a HexTile class, which will include things like height, position, terrain type, etc. The rest of the hexagonal functionality code will come when I end up needing it, but for now, I need a way to store all the HexTiles.
My thinking is, since the battle grids are always going to be seemingly random in shape and size, storing the coords in an offset format in a 2D array would be wasting space. Instead I'm going to store them in a Dictionary and access them via position.
Hopefully in the next few days I have something more to show than just code, but I imagine I'll get stuck with learning how to use Unity.
public class HexCoord { public HexCoord(int x, int y, int z) { }; // Cube coord X public int X { }; // Cube coord Y public int Y { }; // Cube coord Z public int Z { }; // Axial coord Q public int Q { }; // Axial coord R public int R { }; // Offset coord column public int Column { }; // Offset coord row public int Row { }; public override string ToString() { }; }
public class HexTile { public HexCoord Position { get; set; } public int Height { get; set; } }
Monday, November 14, 2016
Blog Created!
Blog created!
Starting a new project and using this blog as a diary of my development over (hopefully) a long period of time. Game idea is a game similar in battle style to Final Fantasy Tactics Advanced, with a hex-grid twist.
First thing is first, hex-grid! I've been reading up a lot about hexagonal math and programming related to game development on a hexagonal grid. My main resource (and such an amazing one) is located at:
http://www.redblobgames.com/grids/hexagons/
I highly recommend this to ... everybody. For me at least, this is an amazing learning tool. Interactive diagrams and code, and logic and math taught well, to not only copy/paste but to actually have an understanding of.
After reading through this, my first piece of code will simply be a HexCoordinate class which will hold the coordinates and have getters for each different type of coordinate system described in the article (offset, cube, axial). Since I feel most calculations and representation will be done in cube coordinates, I'll be storing them as this, and conversions will happen whenever the other 2 systems need to be used. If this seems to not be the case later on, I can change it, but since the battle grid will only ever consist of a few hundred tiles at the absolute maximum, I don't think calculating the conversions will ever be a bottleneck or performance concern.
Starting a new project and using this blog as a diary of my development over (hopefully) a long period of time. Game idea is a game similar in battle style to Final Fantasy Tactics Advanced, with a hex-grid twist.
First thing is first, hex-grid! I've been reading up a lot about hexagonal math and programming related to game development on a hexagonal grid. My main resource (and such an amazing one) is located at:
http://www.redblobgames.com/grids/hexagons/
I highly recommend this to ... everybody. For me at least, this is an amazing learning tool. Interactive diagrams and code, and logic and math taught well, to not only copy/paste but to actually have an understanding of.
After reading through this, my first piece of code will simply be a HexCoordinate class which will hold the coordinates and have getters for each different type of coordinate system described in the article (offset, cube, axial). Since I feel most calculations and representation will be done in cube coordinates, I'll be storing them as this, and conversions will happen whenever the other 2 systems need to be used. If this seems to not be the case later on, I can change it, but since the battle grid will only ever consist of a few hundred tiles at the absolute maximum, I don't think calculating the conversions will ever be a bottleneck or performance concern.
Subscribe to:
Posts (Atom)
