Search Unity

Need advise about many scenes/planes i dont know...

Discussion in 'General Discussion' started by Mr-Game330, Sep 10, 2019.

  1. Mr-Game330

    Mr-Game330

    Joined:
    Aug 12, 2014
    Posts:
    52
    Hello,
    I develop a game for some time already and came to a wall, i need some advice how to bite this.

    From the beggining, i need something like this:
    Got world map and after clicking any location on it i want to present whats going on there, when camera is not on map or any other locations i want still time passing on all those locations, after some time there can be many of them but some will expire while others start to be accessible and able to look at.

    Was thinking about multiscene but dont know if using this approach i can have actions going on all locations and world map even if not looking at them by camera.

    Or making planes in one scene and simply move them away to some distant transform.position if not needed to look at but this feels like meh approach and there is also problem with Static (you cant move objects at runtime which are static, planes will be lighmap static for example).

    I dont want ready solution only advice how to bite this if someone are willing to help.
    Or where is best place to ask this cause maybe i put this in wrong place.

    Thx in advance.
     
  2. PizzaPie

    PizzaPie

    Joined:
    Oct 11, 2015
    Posts:
    33
    Personally I would split the visualization from the logic running each entity and only bind them once visible (on focus).

    I ll use as an example a world map with multiple villages.
    Each village should get updated regardless if it focused or not. So each entity contained in said village shouldn't be bound to a game object.
    These entities can be update based on the same logic you are using when are visible, but for
    performance reason you'd probably want to speculate their progress. Say you have a villager that delivers goods in the village, you wouldn't want to run a path finding algorithm to move him rather speculate the mean time it takes to move and then use that.
    Same goes for every process bound to a village and you could grossly estimate everything by applying a groth/ progress factor to each village skipping all the details.
    Of course this estimation should be synced with the progress made when a village is focused.

    Now when you choose a village you ll load a scene and set each entity's data based on the data you already have.
    Thus linking visualization and data, the logic previously dictating the processes of the village should now overriden
    by the proper logic, ex now you ll have to run pathfinding. This logic can be contained on components present on each scene.

    To conclude the you ll need a world manager present regardless of the current loaded scene (village).
    A village manager to contain and update each and every village on intervals dectated by the world manager and once a particulare village is loaded to pass appropriate data to each game object present in it.
    Other than that you ll need a data representation of each component present in a village.

    The problem with this is that you ll need to change the core of the game altogether and thus might not make it a viable option.
    Other than that I wouldn't use scenes at all but rather prefer to instantiate each village "manually" which would allow
    reusing/ pooling game objects.
    Be advised this is major system that would require quite a bit of time to get properly constructed.
    The main logic is that game objects are your enemy, only use a game objects if the represented entity is visible.