Search Unity

Would setting up a small server for database manipulation be too much for a networking novice?

Discussion in 'Multiplayer' started by Afropenguinn, Jul 10, 2017.

  1. Afropenguinn

    Afropenguinn

    Joined:
    May 15, 2013
    Posts:
    305
    I'm working on a project, with the goal being to learn more about networking and databases, and I was wondering if setting up a small server for performing math calculations and modifying the database upon a client request would be too much for someone with no networking experience. I've worked with a database before for a website, but that's the extent of my knowledge on the subject.

    An example of something I'd like to do is:
    The client has Hero and Monster. The client says it wants Hero to attack Monster. So it makes a request to the server, the server looks up Hero and Monster's stats in the database, then runs a damage calculation, and modifies Monster's health in the database for the amount Monster was hurt.

    Would this be too much for a beginner, and if so, where would you recommend starting to learn more about networking before attempting something like this?
     
    fvde likes this.
  2. robochase

    robochase

    Joined:
    Mar 1, 2014
    Posts:
    244
    I mean, the specific problem you described would be relatively easy to complete with something like node.js, but there's a few layers of complexity there that you may or not be looking to solve. For example, users - do you need a user table, a hero table, etc. from there you're starting to talk about sessions which can get to be a pretty big topic.

    Like I said, node is really easy to get started with. Even something like a simple php script that can run sql queries might be enough to get you going. A more comprehensive framework like rails might set you up better in the long term though.

    The important thing is that you just try it. You won't make the thing if you don't try it.
     
  3. fvde

    fvde

    Joined:
    May 15, 2014
    Posts:
    19
    If you are more comfortable with c#, you may also look into java based Spring Boot. Very solid framework that has good abstractions for database management (ORM) as well as request handling. The quality of tutorials is also outstanding.
     
  4. Afropenguinn

    Afropenguinn

    Joined:
    May 15, 2013
    Posts:
    305
    Yes, I was planning to have user accounts come into play. Ideally though I wanted to package the server with the game, so player's can have private servers for just their friends. I'd like it to be a standalone application that works on Linux and Windows. What are my options for backends when making a server anyways? Node.js and PHP are the only big ones I know.
     
  5. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    You can try to use Master Server Framework asset, it's simple, free and well documented. Packed with LiteDB initial implementation which can be stored on a local machine, and PgSql.

    You can also implement any DB accessor you want with it. And pack it in a master server + game server + client setup, if you wish to do so.
     
  6. Afropenguinn

    Afropenguinn

    Joined:
    May 15, 2013
    Posts:
    305
    So I managed to get a node.js server running, and I've gotten many players to connect to it at once with little issue! It's basic, but far more than I thought I could do in one day. So to those who stumble across this thread: Don't be afraid to start. Like robochase said, you won't accomplish anything if you don't try.
     
    fvde and robochase like this.