Skip to content

(Suggestion) Dedicated/Separate server #33

Open

Description

@aphadeon

Something to consider:
Perhaps a dedicated server would be better?
Would allow the use of external servers, and additionally would prevent network performance from directly affecting the host player's FPS.
LAN parties could still play just as they do now, only difference is that one would open a background process.

As the server didn't exist in vanilla code and was written inside/on top of the client, I like to imagine that this wouldn't be "hella" difficult. Not yet settled in with the code enough to be completely sure of that.

Wanted to propose it for consideration/discussion.

Activity

  1. spacechase0 commented on Nov 10, 2016

    @spacechase0
    Owner

    Hmm. Since the server doesn't do anything authoritative that could be easy. However the host still has maintains a lot, such as day transitions.

    Some stuff would need reimplementing, like time and festivals.

    Another potential problem is mod compatibility. Since clients are fairly independent it may not be a huge issue, but I could see some things (like things happening on day transition) causing a problem. This could become more of an issue once Farmhand comes out, since mods will be able to do more.

    I mean, maybe a dedicated server could just be a player minus the graphics that 'cheats' and auto sleeps when everyone else is ready and stuff?

    It's certainly something to think about.

  2. aphadeon commented on Nov 10, 2016

    @aphadeon
    ContributorAuthor

    Most of the stuff that happens on day transitions is done via "mail for tommorow", which should be easy enough to sync. As for mod compatibility, probably the biggest issue would be locations. Unless we just assume that any location is valid, from any player. So if one goes to an area the server hasn't heard of, it accepts it and simply tracks player locations there. The thing that makes me most nervous about the separation is that we are serializing game objects, so the dedicated server would need to be made aware of their data structures.

    So smaller things like object sync might actually be easier if it is embedded in the client. And the graphics-less client is probably the easier solution. But would require a significant game mod, possibly beyond the scope of SMAPI. And as the game uses XNA, so it's not like we can drop the graphics dependencies (because iirc we need XNA deps just to read the data files).

    Food for thought.

  3. spacechase0 commented on Nov 10, 2016

    @spacechase0
    Owner

    This entire mod is beyond the scope of SMAPI. There's the reason everything is rechecked every frame. :P

    Crops and terrain features (such as grass, weeds/rocks, ...) are some of the things I'm thinking of that aren't mail for tomorrow.

  4. aphadeon commented on Nov 12, 2016

    @aphadeon
    ContributorAuthor

    Was thinking, a separate server could perhaps choose one player each game day to treat as the "growthmaster", and propogate their own changes overnight.

    Do you have plans to port this to Farmhand? If so, perhaps a redesign while porting to make the server its own process, and every player would be a client, might be the ideal time for such a change. I'd be willing to help (as I'd like to switch over to Farmhand myself). I think a separate server would be more scalable (by being able to run on a VPS, etc).

    I know that Farmhand intends to maintain SMAPI compatibility, but a redesign would allow us to add better Farmhand mod support, and address the known issues.

  5. spacechase0 commented on Nov 13, 2016

    @spacechase0
    Owner

    Yeah, I've been putting in PRs to Farmhand already. A couple things I've added because I know I'll need them. :P For instance, I've added a hook for the "whether time should pass or not" function. (And some other stuff not related to this.)

    The growthmaster thing basically sounds like the current situation. :P The server would probably be implemented with just a dummy client running (since otherwise we'd have to manually emulate all of SDV), which doesn't sound very good. It'd just take twice the CPU. Although I suppose if it was just another option that would be fine, for the VPS type thing.

    And then there's of course the issue of if this would all be done before the official MP is out. :P

    <Some stuff I wanted to same but can't remember at the moment.>

    From the first post:

    ... and additionally would prevent network performance from directly affecting the host player's FPS.
    Is this really an issue? I already have receiving in its own thread, I can move sending to one as well. Or maybe that can be done asynchronously. I'd have to look into how that works.

  6. aphadeon commented on May 5, 2017

    @aphadeon
    ContributorAuthor

    A bit late, but I wanted to respond to the very last part - at the time I lived in an area with very slow internet (< 1 Mbps). I have a VPS which I'd love to have host the game, so that I could play, with friends, without being limited to when those friends are up and in the mood to host a game. A dedicated session on the VPS, if viable, would be an ideal resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions