Jump to content
  • Advertisement

Recommended Posts

Posted (edited)

Hi all. I haven't visited Gamedev in some years. Was looking at my graphics engine project I spent 3 years on and feeling disappointed. I'd like to start again with something more simple and more specific, so that it is actually doable. I had some ideas for a simple hex based strategy game or two.

I've got 13 years of C++ experience and some basic linear algebra skills.

I've read up on https://www.redblobgames.com/grids/hexagons/, but that's about the only resource google is showing me. There used to be books back in the 9c days that would walk you though a game project from start to finish, it would be great if there was something out there like that to hold my hand with DX11 and hexes. Are there any other resources for me?

Edited by Fleshbits
premature post

Share this post


Link to post
Share on other sites
Advertisement

List off the things you want your engine to do, eg: is it a height based open world, is it tiled with the hexes as pregenerated meshes, is it only player and AI movement that uses the hexes (the terrain doesn't necessarily have to be based on a hexagon mesh for this). What exactly does a hex define?

The link you listed is kind of just focused on one thing that I would say is pretty straight forward. Not trying to insult the author, it just focuses on one area. How the hexes are represented is more than a numbering scheme, for example are they a linked list of objects or an array of structures, or just an offset grid of texture based information. If you think of it like a quad mesh, then you just have 6 neighbours instead of 4 and follow similar principles. If there is level of detail splitting it wont be as simple as a quad mesh but you may not want to go down that path anyway.

You will likely have to make decisions about things like texture mapping, because your textures will still probably be rectangular, so for example how would you blend two adjacent tiles using different texture sets (if you use texture sets).

Share this post


Link to post
Share on other sites

Oh, nothing fancy. My whole focus is to keep it super simple this go around so as to be able to get it done. I just want a flat hex map that I can move static models on top of. Very board game like. A flat hex, with a texture applied to each.

I imagine there will be some class to represent the entire map/floor and it will have to be able to give me coords of the individual hexes by some manner of index, so that I can place things on top of a given hex. It will probably wrap the rendering of the whole thing with one call too. But I don't really know how these things are normally done. Hence why some kind of walk through tutorials would help.

 

Share this post


Link to post
Share on other sites

There is a whole section about coordinate systems in the page that you linked. The Offset coordinates or the Double coordinates look simplest to understand. Movement code is a little strange though as you move sideways back and forth in one direction. Maybe the double coordinates works better, don't know.

I played with Axial coordinates a little bit, and that works too. Movement is simpler, but mapping a tile coordinate back and forth to the 2d position is quite more tricky I seem to remember. I didn't use your resource though, the solution might just be explained in it.

The hands-on approach is to take some paper and draw a grid, and define the coordinate system using one of the discussed coordinate systems. Then figure out how the coordinates change as you move in each direction. Maybe you want to try a few of these systems so you get an idea of how they compare, and which one you like best.

Once you know how it works you can start working on how to implement it.

Share this post


Link to post
Share on other sites
Posted (edited)

Yes, I read the article I linked.

My problems aren't going to be with understanding the coordinate system. It's going to be how to organize the hexes and have them, and what they contain, rendered in DirectX. I was just answering TeaTrim's question.

The original question is simply a query to see if there are any resources out there beyond the link I gave, that people know of. I could swear there was a book that did a simple hex based strategy game from start to end circa 2003, but I cannot for the life of me remember the name. Any other resources at all would help.

Edited by Fleshbits

Share this post


Link to post
Share on other sites

Many turn-based strategy games use hexagons. If you look in that area, you'll likely find resources.

The coordinates can be very simple. Imagine a chess board (or a regular grid, for that matter). Horizontally x, vertically y, each square a (x,y) pair, nothing special.

Now move every other column a 1/2 height down. Make the left and right vertical edges more round so the square looks like a hex, and you have the Offset coordinates system, one of the two right-most pictures, depending on which columns you moved down.

The 2 left-most pictures do the same, but with rows instead of columns.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!