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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Resolved Server save data

Discussion in 'Netcode for GameObjects' started by reiconrooc, Apr 29, 2023.

  1. reiconrooc

    reiconrooc

    Joined:
    Aug 11, 2018
    Posts:
    16
    I am making a turn based client - server game.
    The idea is that when a player do an action, a RPC is sento to the server that validate and applay it.
    The player send its identifier, the match identifier and the action identifier, so the serve can know what player do what in what match.

    I think to avoid data losses in case of server shutdown, to use some data persistence.
    I found some different ways:
    - External DB running in the server
    - DP embedded in the program
    - Data Serialization on file system

    What should I use to perform data persistence?
    How frequently should I save data for every single match?
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,330
    Use what does the job. How often do you expect a server to shutdown prematurely or crash? Better try to avoid that situation as much as possible.

    Frequency: once per turn, since it‘s turn-based.
     
  3. reiconrooc

    reiconrooc

    Joined:
    Aug 11, 2018
    Posts:
    16
    Thanks.
    I think the better way is to use a DB. Some recommended for Unity? I think to use SQLite.
    Do you know better solutions?
     
    Last edited: Apr 30, 2023