|
Post by bennet on Mar 7, 2015 18:43:16 GMT
Hello, I've got an existing hex random map generator that I've got working(it's an x,y type of hex grid generator and it produces civ like maps) and I'd like to use Honey hex for the graphics side. Now I'm relatively new to programming and I'm finding it hard to see if this is even possible. I can see in the world script there's generatorMode but I can't see how it's generating the large hex shaped island in the test scene. Can someone give me a pointer in the right direction of which scripts I need to look at to create something other than a hex shaped island? like maybe two different islands not shaped like hexs. :0 For lower order progammers such as myself the documentation doesn't have big enough training wheels thanks, bennet.
|
|
|
Post by khash on Mar 7, 2015 19:00:46 GMT
Hi! Our framework is not great for non programmers, its true, becuase it is just set of tools which help you achieve far targets but they expect programmers to manage their behavior.
To answer your question: Look at World.cs class in "GenerateBasicWorld" function
line which defines which hexes are part of the world: List<Vector3i> rangeHexes = HexNeighbors.GetRange(new Vector3i(), radius);
What you want to do here is to define poistion of all playable hexes (land and water). Above line just procudes "circle" in hexagonal system, that is why our world looks like a big hex. But there is nothing wrong in feeding world shape which is not circular.
Another usefull bit is the loop:
foreach (Vector3i v in rangeHexes) { hexes.Add(v, GetHexDefinition(mode, v, tdList)); }
which changes those positions into proper hex data, feeding them with terrain type and other data required to build world layout.
Note that we are using Vector3i for hex coordinate system. Which means that if you want to use system where you have right angle between X and Y coordinates you need to look into some way of converting your hex system coordinate into yours. I recommend to look into HexCoordinates.cs class because it contains useful coordinate system conversions.
Hope this helps!
|
|
|
Post by bennet on Mar 8, 2015 6:58:05 GMT
ok thanks for the quick reply. I don't think I can use honey. I didn't realise the amount of programming skills needed to get a different result, from the test scene. It does look very nice and maybe I didn't research it very well,and the documentation provides little help..... for me that is. bennet.
|
|
|
Post by khash on Mar 8, 2015 18:04:03 GMT
Yes, it is a framework so it provides a base to build on. Its not a plug and play layer.
|
|
|
Post by gymfrecklelaundry on Sept 9, 2020 22:23:42 GMT
For future visitors, you can easily specify a square shape for the generated terrain by using GetHexCentersWithinSquare instead of GetRange. So on line 150 of World.cs, change it to:
List<Vector3i> rangeHexes = HexNeighbors.GetHexCentersWithinSquare(new Rect(0, 0, 10, 10));
You specify the size of the rectangle by Rect(0, 0, 10, 10) (The first 10 is the width, the second is the height of the square)
Just a head's up - the RiverFactory isn't expecting this shape, so I just disabled rivers by commenting out line 103 in World.cs:
//RiverFactory.CreateRivers(this, hexRadius);
|
|
|
Post by bbb on Sept 14, 2020 8:57:53 GMT
hello gym, yes that's right, I use this to get a list of all hexs in my sized map(I like square maps and I call that seahexs, then shuffle that list and pick a number of random points which i put into a separate landpoints list. I then use: List<Vector3i> rangeHexes = HexNeighbors.GetRange(new Vector3i(), radius); on each point in this landpoint list, and add each of the hexs in rangeHexs to another list I call landmass(i randomly cull a certain number of the perimeter hexs before I add them to the landmass list to get a more natural coast line also i remove these hexs for the seahexs list ) . I do a lot more during this process like checking the initial points are not to close together which tends to get a nice spread of landmass across the map.For me in the end I would end up with several lists ,land ,coastal water,coastal land, inland, deep water, ect. I do this process a few times adding, a few times subtracting and then feed each of the final lists into the foreach (Vector3i v in whichEverList) { hexes.Add(v, GetHexDefinition(mode, v, tdList)); } and give it an appropriate hex definition. I've had no problem from the river factory...but I don't actually code in the world.cs I call my custom script from world and then feed my info back in to the GetHexDefinition() and world.cs does the rest nicely cheers bennet
|
|
|
Post by bbb on Sept 14, 2020 9:57:31 GMT
above is just a basic start of a random map generator, currently I use multiple passes of random point picks and perlin noise of different frequencies. I should also point out that in the above post where I " List<Vector3i> rangeHexes = HexNeighbors.GetRange(new Vector3i(),radius); " I random the radius value 'Random.Range(minSize,maxSize)' to get different sizes. Pretty basic but it works and I still use it in a pass. cant see how to post a pic of what it gives unfortunately. bennet
|
|