Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Hypothetical multiplayer idea: World file on a server  (Read 1423 times)

Grimosaur

  • Escaped Lunatic
    • View Profile
Hypothetical multiplayer idea: World file on a server
« on: April 13, 2021, 11:28:58 am »

I've been thinking about ways in which multiplayer could be implemented into Dwarf Fortress. On the surface it seems like the most multiplayer unfriendly game ever, but I think there is one way which might actually work. A single world file on a server that anyone can play on and add their own fortresses to. The world file would update with any changes players have made, so on the world map people could see all the different fortresses created by other players and (possibly..?) go explore them for themselves in adventure mode.

The only problem would be how the world gets updated. Would it update in real time? Or would everything update all at once at a specific time of day, as if everyone logged off at the exact same time.  For example if someone playing in adventure mode stole an artifact from someone elses fortress, it wouldn't be shown for that other person playing in fortress mode at the same time. Then when the world file updates, the artifact would have disappeared from the fortress with no reason as to why, unfair for the fortress player. That's why it would have to be restricted to fortress mode for everyone, to minimise most of the inconsistencies like that. Perhaps when a player logs off their fort, time would continue as normal on the server as if the fort gets retired whenever they leave.

What could make multiplayer like this extremely engaging would be how sieges against two player fortresses would work. I've seen the mod which allows for two players to work on the same fortress at the same time and I think that same idea could work incredibly well for a player vs. player siege. The two players would have to be on at the same time of course, and if one decides to invade the other they would be able to control their own dwarves on the other players fortress, attacking their dwarves, dig into their fortress, destroy structures, attempt to flood the fortress, steal goods and artifacts, and any other dastardly ideas they can come up with while they are on the other players play field.

...Of course I have no idea how any of this would actually work, so I guess I'm only asking if any of this is actually possible with the idea of multiple people playing on the same world file. At least having it be fortress mode only seems feasible to me, but really I don't know how difficult something like this would be to set up. I just had this idea and thought I might as well make a topic about it to see what others think.
Logged

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: Hypothetical multiplayer idea: World file on a server
« Reply #1 on: April 13, 2021, 12:24:35 pm »

Biggest issue would be merging all the conflicting data. The same migrant (the king, no less!) arrives at two different fortresses. In one he's making masterworks (each resulting in a historical event,) in the other he's dead. Two separate babies are born into two fortresses, but are both given the same next available unit ID. And so on.

Anything unhandled corrupts the save file.
« Last Edit: April 13, 2021, 12:38:07 pm by Bumber »
Logged
Reading his name would trigger it. Thinking of him would trigger it. No other circumstances would trigger it- it was strictly related to the concept of Bill Clinton entering the conscious mind.

THE xTROLL FUR SOCKx RUSE WAS A........... DISTACTION        the carp HAVE the wagon

A wizard has turned you into a wagon. This was inevitable (Y/y)?

Grimosaur

  • Escaped Lunatic
    • View Profile
Re: Hypothetical multiplayer idea: World file on a server
« Reply #2 on: April 13, 2021, 04:04:11 pm »

Biggest issue would be merging all the conflicting data. The same migrant (the king, no less!) arrives at two different fortresses. In one he's making masterworks (each resulting in a historical event,) in the other he's dead. Two separate babies are born into two fortresses, but are both given the same next available unit ID. And so on.

Anything unhandled corrupts the save file.

That would only happen if there was no communication with the server from each player though, right? As if the multiplayer aspect was only multiple players overwriting the same world file over and over again all at the same time. The updating of the world, migrant waves, sieges, all that jazz could all be done by the server and sent to players, with the only data being sent back by players is what is happening in their fort. Any babies being born in a player fortress will have to ask for a unit ID from the server and have it sent back to the player so everything would be up to date. Players would still be able to pause the game, but if they unpause after a long period of time they might get a migrant wave, a caravan, a season change and a goblin siege all at the same time as all that data sent by the server updates for the player.

...I could be wrong though, I know absolutely nothing about how servers work, this all just sounds right in my head.
Logged

DwarfStar

  • Bay Watcher
    • View Profile
Re: Hypothetical multiplayer idea: World file on a server
« Reply #3 on: April 13, 2021, 04:13:38 pm »

If you wanted to keep all the players in sync in game time, you'd have to stop the player once they've used up the game time allotted each real day. You might allow one year of game time per real day, but at the end of that year you'd have to stop the game and tell the player, "you've used up all the time for this year, please log in again tomorrow". I guess to be completely fair you'd have to also run the simulation forward unattended for players that didn't log in at all, so that you couldn't skip a siege by only logging a few game days instead of a year.

Figuring out how to schedule the raids so that both players are online at the same time could be a challenge.

But, I think playing with those limitations would be acceptable, if a lot of work to implement, and it sounds like a great idea!
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: Hypothetical multiplayer idea: World file on a server
« Reply #4 on: April 15, 2021, 08:17:02 am »

Theoretically this is almost possible with dfhack. Practically this would be a huge project. The idea would be to generate same world and then if you want to "merge" the world you would resolve id conflicts. Or you could try doing that each time anything takes an id. Probably easiest would be to binpatch df itself though...