- Home /
2D Dynamic map generation
Hi, Making RPG/RTS game, want to create 2D infinite map. A map that contains resources, Our troop attacks on resources. We can swipe infinitely. Reference video link : https://www.youtube.com/watch?v=qIaRmgY3J74 Skip video up to 2.22 minute to see map functions.
I want to create same map as shown in video. How we can to create such map in unity3d?
Thank you in advance
$$anonymous$$aking an infinite map, even a "simple" one like this, requires a great deal of thought. It would help if you had a few months of coding experience. I'd recommend starting with a hand-made map so you can focus on learning general coding principles.
Once you have some basic program$$anonymous$$g familiarity, you can research the topic of infinite map generation and keep up with what the authors are talking about.
The concepts required aren't too intimidating, but we cannot deter$$anonymous$$e your level of coding experience from your question, and thus it's hard to know where to start. If you're an experienced coder please indicate as much. Otherwise we have to start from scratch with our explanations, and that's a lot to ask.
hi thanks for reply, I have 3 year experience in Unity3D program$$anonymous$$g. But here i am confused where to start developing, there is need to generate infinite map and it is different from all other games as it contains orthographic view. Also how to assign resources tiles on map, virtual PvP battle,map travelling deter$$anonymous$$ation to other resource . Hope you will get my point.
Is this a map containing, say terrain? Is it a top-down view? You might want to take a look at perlin noise: https://docs.unity3d.com/ScriptReference/$$anonymous$$athf.PerlinNoise.html.
No its not containing terrain.
its isometric view swiping. I think concept is same like perlinNoise concept, but don't know it is possible with it or not. If you see its map you will get idea. I have played game "Deadwalk-the last war" but now not available on play store. if you have time please check video in map. Thanks
Answer by AlwaysSunny · Dec 30, 2016 at 06:20 AM
Obviously this is not the only approach, but it's a pretty simple way of doing this:
Start with the smallest logical unit. Assuming you want territory shapes like what we see in the video, the smallest unit might be the narrowest possible strip of land. The average territory might be about 50 of these units in a randomized shape. Let's call them "tiles".
Next, consider the smallest "chunk" of land you'd ever want. A chunk should be a square of tiles big enough to occupy a whole screen, and will probably contain parts of multiple territories.
Now instead of generating an infinite map, you only need to generate one chunk at a time. For each chunk, pick some semi-random tiles to be like the capital of the territory. Territories can grow out from the capital by selecting adjacent tiles in a semi-random way.
Chunks must also know about their neighbors, if only to allow territories to be "closed off" without boring straight edges. Ask your neighboring chunks if they have any territories with boring edges, and allow those territories to participate in this chunk's grow-out-from-capital algorithm.
You always want to store the minimum amount of data from each chunk. If you use a seed-based generation technique, theoretically all you need is the seed. However, in most cases this is not really enough, so you'll need a strategy for remembering information about each territory / capital so when you come back to it later, it will remember any changes that were made to it.
When you're moving around and getting close to the edge of the generated world, simply generate new chunks for the empty area you are about to enter.
There are more sophisticated ways to approach infinite map generation, but this will hopefully give you some idea of where to begin. Even if you don't like the rest of the strategy, the idea of splitting the world into chunks is probably a smart plan.
yes you are right, there is not need to think whole function development at the same time, Let me try as per you logic. Thanks a lot.
Your answer
Follow this Question
Related Questions
Block based map generator 5 Answers
Creating a RTS Map 1 Answer
How to make the camera start in the camera2 position (Unity 2D) 0 Answers
Adding Verticies to Mesh 1 Answer