Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Coming soon] 2D Tile based map generation

Discussion in 'Works In Progress - Archive' started by UniqueDragutin, Dec 16, 2014.

  1. UniqueDragutin

    UniqueDragutin

    Joined:
    Aug 27, 2014
    Posts:
    21
    Hello everyone,
    I was working on 2D tile based map generation, so far this is the result:

    Update 1



    Advantages:
    • Terrain consist of one mesh(one draw call, only one chunk)
    • Simple water system(fast)
    • Terrain can be easily saved and loaded(you need to save one array and to load it, every block with specific texture and values will be loaded)
    • Terrain is using simple collider(at the cost of performance)
    • Terrain runtime editor(add, check , edit or remove blocks)
    • Choose when and how to generate each block in whole map
    • Terrain is using one texture map(it consist from different textures)
    • Water is seperated mesh with collider
    • Square lighting
    • Many more

    Disadvantages:
    • Whole map is generated at the start game(not infinite, I tried 10000*300 blocks - Generated for less than 2s)
    • No marching squares algorithm(terrain is using simple squares)

    Tell me what you think...would you like to see it on asset store? ;)
     
    Last edited: Dec 20, 2014
  2. TheCowMan

    TheCowMan

    Joined:
    Aug 24, 2010
    Posts:
    387
    When first opening this post I expected just another tile editor, but this is actually really cool. I'm guessing this could be easily used as an actual game, just take away the editing ability and you basically have a Terraria-style terrain to work with, very very cool.
     
  3. UniqueDragutin

    UniqueDragutin

    Joined:
    Aug 27, 2014
    Posts:
    21
    Thanks TheCowMan for your feedback.
    This terrain should be used for an actual game ;) ...and terrain editing is just another script which can be disabled.
     
  4. UniqueDragutin

    UniqueDragutin

    Joined:
    Aug 27, 2014
    Posts:
    21
    New update*




    I have changed a lot of things, here is the list:
    1. Terrain is now static object
    2. Water is separated mesh with its own collision
    3. Added terrain render distance , terrain collision distance
    4. Now you can set transparent tiles
    5. New water pressure
    6. Only square lighting, with multiple lights
    7. Water use its own tiles - 4 of them (based on how much water is in one square)
    8. Water will move down even if it hit the edge of the rendered part of the terrain
    9. Better performance
    10. Only 32*32 textures allowed for tiles
    11. ...as always a lot more.
     
  5. UniqueDragutin

    UniqueDragutin

    Joined:
    Aug 27, 2014
    Posts:
    21
    New update :D
    I think that this new light effect is much better than the last one... In both images just one light is used!

    Light1.PNG
    test.PNG

    Soon I will upload demo so you can test it...
     
  6. UniqueDragutin

    UniqueDragutin

    Joined:
    Aug 27, 2014
    Posts:
    21
    Hello guys, I started re working whole terrain, Now I will keep my eye on performance. ;)
    Today I tried 140 blocks X 140 blocks(witouth mesh collider or water) updating each frame without any lag or lag spike. Scene run at 14ms.

    Don't believe me?

    Capture.PNG
    Capture.PNG
     
    Last edited: Dec 24, 2014