Hey guys/girls,
I have just downloaded the free version which I hope will help me with my task.
Ok, so I have 16 prefabs (unity3d). Each prefab is like a street setup. A street from south to north, T-junctions, left / right corner streets, west to east etc. Each prefab is 128px*128px or units as square tiles.
My prefabs are named in Binary 0 means wall or building 1 means an opening, each prefab has four sides north, east, south and west and a road which is w-e would be named 0101 or a corner 0110.
I would need to have a pathing algorithm for the player object to move around the map after a mouse click. However the map is randomly generated,with some sense so that we do not get any silly dead ends or inaccessible areas.
1, I set up my tiles by string name to a 2d array list.
2, my code then checks the next position to place a tile, the code checks the tile above, below, left and right so it chooses a “good” tile.
3, the code then saves and instantiates the prefabs to another 2d array of objects and as said instantiates in the world as a 10*10 tiled area.
4, code chooses a random tile around the border of the map to spawn the player.
Now I need to control the character which will be a human+gun and I shall throw in some enemies later on. However I need something that will help me in path finding on a dynamic map.
The player will control the character by mouse clicking to move in a strategy/rpg camera view. So clicking a slight distance away and round a corner or two, the character would need to move there without clipping into the prefabs “walls / soon to be buildings”.
I tried the A* a little last night, I would need to have a code that on start() it would do the Scan function to lay out the nodes? to click on.
Would A* help ? I have been trying to find any instructions and help/youtube for dynamic maps. Any tutorial like this around? or similar for random maps