- Home /
Making A hex map, want some random generation, could use ideas.
So my first thought on this is to use a maze algorithm, and at each dead end re randomize the int used to tell witch type of hex I want to use. So is this the right direction, or should I use a different type of generation, or which maze algorithm would you suggest. I plan on coding this in C# just want some pointers on which direction to go. Thank you for any help.
what's the game? what requirements does it have for the map?
It's a metroidvania, this hex map is for the overworld. So the player start tile needs to show up, and then there are five opponent races, which there hexes should show up.
so with 4 enemies, that's 5 tiles in total. that's easy to implement isn't it?
Here's a pretty nice tutorial on creating hex maps in Unity by Catlike Coding. There are 26 parts to it as of now and they cover a lot from basics to generating terrain with rivers and everything.
Not see$$anonymous$$g to let me reply what I want, this is a test to see if it is a bug site side, or my side.
Odd, public class OverWorld$$anonymous$$ap : $$anonymous$$onoBehaviour { //Hex Array public GameObject[] CurHex;
//Player Position Indicator
public GameObject PlayPos;
//Random Selector
public int RanHex = 0;
//$$anonymous$$ap Size
public int height = 45;
public int width = 45;
// Gen World
public void GenWorld()
{
for (int colom = 0; colom < height; colom++)
{
for (int row = 0; row < width; row++)
{
Hex h = new Hex(colom, row);
Vector3 pos = h.PosFromCam(Camera.main.transform.position, height, width);
GameObject selected = CurHex[RanHex];
Instantiate(selected, pos, Quaternion.identity, this.transform);
RanHex = Random.Range(1, 6);
}
}
}
//Use Before Start
void Awake()
{
GenWorld();
}
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
here is one of the scripts I'm using
Answer by hugodeheld · Mar 06, 2018 at 09:58 AM
You should watch this video: Daniel Shiffman Maze videos