- Home /
Can I use predifined hexagons in generating random maps?
This might be tricky, but I have created 70 hexagons (in Photoshop), and i want to use 64 of them to create various maps in my game:
8x8 map (like a chess but with hexagons)
randomly placed hexagons; adjacent and in a shape like an "O" or "U" for example.
The trick is not for me to pre-make those maps; this way the maps will be the same every time! Instead, I want each time the map to be different by a random placement of the hexagons. I.E: imagine in game 1, hexagon ONE being in position A; then in game 2, i would like the hexagon to be placed in position 42. It could be positioned in the same location; but not necessarily.
Can this happen through creating seeds of maps? Me creating all those different combinations and saving them as seeds in numeric vectors, and then each game a random seed will be selected with each hexagon's number going to the assigned position of the seed?
Hopefully I am clear!!! If any clarification is needed please let me know! Thank you.
Answer by Animatick · Sep 18, 2017 at 10:02 AM
There is a guy on youtube that I used to watch a long time ago, he does a lot of game programming tutorials. this sound like what you are trying to do. check it out here
I hope this helps.
I came upon his tutorial series; i am just wondering if it makes sense to use photoshop created hexagons first. I will most definitely check it out thank you!
Answer by Glurth · Sep 18, 2017 at 03:42 PM
-You can make a single hex shaped mesh, and store it as a prefab. Configure the mesh such that it's UV's match that of the hex images you will use.
-Store each photoshop hex image as a separate file (asset) in your project.
-Now you can create a new material, manally during scene configuration or automatically at runtime(harder), for each one of your imported hex images.
-Then instantiate the prefab at each of your random location, assigning to each new instances' MeshRender, the material you want the hex to display.
So, a fair bit going on: creating a mesh from scratch, assigning correct UV texture mapping to it, creating materials at runtime, and instantiating prefabs. Obviously, a lot to cover, but hopefully breaking it up into parts will help your research.
Your answer
Follow this Question
Related Questions
,Identifying direction of GameObject in Range 0 Answers
google maps 3d API lacks detail 0 Answers
Create map of the USA 0 Answers