Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Open World Navigation... is it impossible?

Discussion in 'Navigation' started by joshcamas, May 6, 2018.

  1. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    3,552
    that's why you have the (temporary) big navmesh baked under them ... lol
    1. use the big navmesh for navigation
    2. sample the cell navmesh (not the big navmesh) to detect crossing
    3. if sample is same, do nothing, store sample as old sample
    4. if sample is different, new cell detected, create a link between current sample and old sample
    5. ...
    6. profit!
     
  2. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    310
    Why not just use the big navmesh then, since a big navmesh doesn't slow things down.

    My issue is I don't want to have to build the entire navmesh of the entire world every time I change something.
     
  3. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    3,552
    It should be automated, and you wouldn't have to build the entire mesh, just a portion around the cells (or group of cells) to update (it's a neighbor check after all). Anyway, your mind is set up already.
     
  4. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    310
    I'm sadly still confused. you're saying I don't have to build the entire mesh, but then you say I need a big mesh as well as small meshes... I don't get it :'(

    But yea I think Ima go with the direction of either tile replacement (which is sorta supported already in A* pathfinding project) or mesh splitting (doesn't seem to be supported in base unity, possibly could get it working for A*)

    This would allow for simply updating whatever cells you want, without the need of an extra large navmesh nor links
     
    Last edited: May 16, 2018
  5. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    1,755
    Rebuilding a navmesh doesn't rebuild the entire thing, it detects which tiles have changes and rebuilds those.
     
    joshcamas likes this.
  6. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    3,552
    I was trying to provide an automation in edit time, basically you create a script that would detect and create stuff for you.
    The big navmesh would a temporary data use to give context to smaller navmesh that will be kept, and the context is used to find and build navmeshlink before being discarded.

    So in term of steps
    1 - create navmesh for all cells
    2 - load a single cell from the list of cells
    3 - load the neighbor of that cells
    4 - bake a context navmesh on all the cell at the same time
    5 - run a script that move a navmesh agent from cells to cells
    6 - everytime the agent sample two navmesh in delta time, check if there is navmesh link already, if no, create a navmesh link
    7 - once all link are created, discard the context
    8 - goto 2 until there is no cells left in the list

    Or you can do it by hand

    But why not use the big mesh? well it depend on how you manage your memory, the impact it has, how do you deal with event horizon, the cost of updating change, etc ... it's a cost benefit things. If you are constantly changing things, then only one cells (and the neighbor) need to be rebaked/automated, assuming big navmesh is costly to bake, but maybe the biggest cost is to have all the cells at the same time in order to bake.

    Let's say that's one more option in case you have problem.

    I was thinking that the big mesh could be a problem if a cell wasn't uploaded, and an AI wander off the void of that cells, but if you unload object based on distance, and a big navmesh cost is minimal, why not? Object would never meet an empty cells in theory. In practice, if you have streaming, you can have cells poping up when player move too fast and then have ai falls down the world map. Happen in AAA games.
     
    joshcamas and GameDevCouple_I like this.
  7. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    310
    I understand now. I'm thinking for now I'm just going to have a big navmesh, like you said... however I do plan in the future to switch to arongranberg's A* pathfinding project, and since he has a feature implemented where you can save/load tiles, I'll be doing that.

    :) Thank you all very much for your help!!! And thank you neoshaman for your patience xD
     
    neoshaman likes this.
  8. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    1,755
    Make sure to test the A* project thoroughly end to end before starting to replace the unity stuff. The A* navmesh implementation is just not the same quality and it shows in several areas.
     
    joshcamas likes this.
  9. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    310
    Oh, really? I figured it would be better, since it's... well, not closed source, and costed me $70 :^^^) I'll be sure to make sure, thank you very much for the warning!
     
  10. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    1,755
    joshcamas likes this.
  11. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    310
    whaaaaaaaaaat I HAD NO IDEA