Search Unity

Resolved Multiple NetworkObjects using "fake" NetworkObjects?

Discussion in 'Netcode for GameObjects' started by MatanYamin, Feb 14, 2023.

  1. MatanYamin

    MatanYamin

    Joined:
    Feb 2, 2022
    Posts:
    110
    I know, the title is confusing but I'll try to explain my question.

    Hi everyone, I am building a multiplayer game in NGO.

    Part of my game is spreading a lot of "Food" objects around the area (up to thousands).

    Currently I am developing this with NetworkPooling, which creates a large amount of pre NetworkObjects of that "food" prefab before the game starts, and using it when I need it. So far so good and it works.

    BUT, my concern is using a large amount of NetworkObjects will eventually kill my game that supposed to work on mobiles as well.

    My idea was to "fake" the network objects by spawning the food around the map, and ONLY SEND the positions of every food object to the clients. With that list of position, every client will spawn a regular local GameObject that will "represent" that NetworkObject.

    Same for when a player "eats" that food, the server will send the id of that food and tell all the clients to remove this food from their local machine.

    Is that approach is legit or this is crazy talk?
     
  2. RikuTheFuffs-U

    RikuTheFuffs-U

    Unity Technologies

    Joined:
    Feb 20, 2020
    Posts:
    440
    CodeSmile and MatanYamin like this.
  3. MatanYamin

    MatanYamin

    Joined:
    Feb 2, 2022
    Posts:
    110
    Thanks!
     
    RikuTheFuffs likes this.