kvakvs / playable_alpha2

Terraria-like digging sandbox made with Unity3D/C#
Other
16 stars 5 forks source link

Empty scene when opening project :( #1

Open Nayjest opened 8 years ago

Nayjest commented 8 years ago

See subj.

Nayjest commented 8 years ago
kvakvs commented 8 years ago

Might have to open Assets/Scene.unity.

lwt1840823916 commented 4 years ago

After a brief look, it is easier to realize the map with Unity's Tilemap. I am also a fan of Terra games, how to achieve the liquid effect in Terraria? This problem has troubled me for a long time, and I have not been able to find examples.

kvakvs commented 4 years ago

You simulate the liquid volume in each cell of the map. Something like byte water[WORLD_WIDTH][WORLD_HEIGHT] and each simulation tick you see if the water has somewhere to flow, and what's the water level difference. Half of that difference can be transferred between water[][] cells, for example, trying to equalize water levels. Render as a blue box of height proportional to water value in that cell.

If you also simulate lava, you check if say more than half cell volume of lava meet more than half cell volume of water, then they create lava stone (obsidian). And if more than 0.5+0.5 volume of liquids meet, extra can splash into neighbouring cells, or can create steam if you also simulate gases like in "Oxygen not included".

lwt1840823916 commented 4 years ago

Thank you for your suggestions and replies I don’t quite understand what you said. Can you give me an example? I feel that it can be realized with a particle system, and I have no experience with it. I used the ‘water2D free’ plugin before, but the style and effect are not ideal.

kvakvs commented 4 years ago

Create a byte array size of your world, where you will store volume of water in that cell. Let's say 0 is empty, and 255 is full block of water. Water can flow, you have to run simulation in cells around the player to check if water can flow, and how much water will be moved. Particle system can be created for effects and splashes but it will not solve water simulation.

Look at this video https://www.youtube.com/watch?v=ZXPdI0WIvw0 Water is here simulated like you would simulate your world blocks, but in a different array. Another discussion here https://redd.it/bgwpkp Hope this gives you some keywords to search for more info.