- Home /
Generate the world
In my game (mmo) world divide to cells, that divide 8x8 cells too. I generate array 8x8 with indexes. For example: index 0="grass", 1="rock", 2="tree".
Array looks like:
11110000 11110000 10111000 00001000 11100000 11111000 00110000 00010000
http://img23.imageshack.us/img23/9708/pichs.jpg
I see 2 variants of realization:
Generate mesh. More difficult programming, but faster.
Create prefab for all posible index, and add it's to scene for every cell with thise index. This variant is more easier for: add new index, work with prefab, add script to every prefab, creating beauty model.
What are you thinking about this?
(Sorry for bad English)
If you are making a game similar to $$anonymous$$ecraft, then creating the terrain from prefabs maybe the easier option, especially if you would like the individual blocks to be editable ingame e.g. blocks can be removed etc. This may however not be the best option performance wise..
I would say the prefab version is more effective for editing purposes and should be really easy to optimize. Start with the easiest method you know and optimize if it is too slow. Try using occlusion culling and see if that would help. Another optimization might be to keep track of each 2d base grid by height, check neighboring sets, and hide anything below the cutoff. Basically, it's like forcing your own occlusion culling vertically.
Your answer

Follow this Question
Related Questions
Apply new complex fbx to saved prefab 0 Answers
Generated mesh not applied to main prefab (2018.3) 0 Answers
Sharing a generated mesh between multiple game objects 2 Answers
Copying the mesh, collider, and material of a procedurally generated GameObject 0 Answers
Different prefabs using same mesh. Any performance gain? 1 Answer