Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Need advise on the feasibility of a Multiplayer functionality in a tycoon game

Discussion in 'Multiplayer' started by tr0ma, Feb 25, 2018.

  1. tr0ma

    tr0ma

    Joined:
    Dec 4, 2012
    Posts:
    19
    Currently in the process of making a game prototype for a multiplayer game, I recently decided to explorer multiplayer solutions.
    I had a deep look at the HLAPI, and went through examples in order to get familiar with it, and actually coded myself a bit of networking in that prototype.
    But I am now facing some issues when figuring out how I should handle some aspect of this game.

    The Game flow:
    There are two phases, a build phase and a "Mall Opened" phase in which generated customers come and consume in the store you just built. (Think Mega Mall Story but where building is only possible when the mall is closed)

    Here is a video to illustrate what is mentioned: https://drive.google.com/open?id=1p2jzbwOH2dH16apCkwAZiKhFCYmRuqEZ

    What I would like is to have a multiplayer functionality in which players rent and place their store in the same mall during the build phase. So they are competing with other in the same environment. This part is what I managed to do properly as it only involves a few simple messages from client to server,
    and confirmation back from server to clients.

    Now my problem comes with the simulation that runs during the "Mall Opened" phase.

    Right now, one of the client is hosting the game, and act as a server. The server is taking care of generating customers and propagating that to clients. In the game logic, customers are spawned with a destination that is decided depending on a few rules, then a path is established. Once destination is reached, customers
    consume, and decide on a next destination (another shop or leave the mall).

    The goal would be that all players sees the exact same simulation on their screen. What would be the best solution for that:

    - Every customer are network behaviour game objects and are maintained through Network Transform components. What happens if they are hundreds of customer?
    - The server decide in advance how many customers, where they should go, do all the path finding, and through a custom message send all these information back to the clients.
    Clients would just have to perform all the paths, without any need to recalculate anything on their side. Could that be viable? Does it mean that one big message needs to be sent
    to the clients, with hopefully ALL the information? Could I end up with a message a little too big to handle?
    - Same idea as above, but instead of sending one big message for all customers, one message for every customers is being sent. Everytime a customer reaches destination
    on the server, a new path is sent again, and so on. My concern would be: what if a message get lost? Clients would end up with a sticky customers?
    - Any other solution?

    And now I'm also questioning the feasibility of this project, and maybe doing a simulation like that multiplayer is not viable at all, and that's also why I'm posting this.

    Thanks a lot for your feedbacks.
     
    Last edited: Feb 26, 2018
  2. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    If you have specific paths the peds can use such as roads you could use a waypoint system and send only the destination waypoint and make the server and client progress on that waypoint system. Sending hundreds of positions, while possible is wasteful. Try to send data that is neccecary to calculate movement rather than movement updates.