Jump to content

Barrage - non concurrent multiplayer script


Recommended Posts

# What is it?
Barrage is an external script which emulates a game server which only allows one player at a time, by automatically saving and loading a KSP save file through a git repo, and locking the save while it is in use. Barrage Science Edition can even modify the save file to keep each player's science and technology progress separate! There is also a 'simulator' script which creates an untracked copy of the shared save, so you can design and test craft in context while the main save is in use. Barrage is very stable and mod compatible. So long as all the players have the same mods installed, everything should work exactly as it does in singleplayer.

# Why is it?

I've made several attempts to play coop campaigns on Dark and Luna multiplayer mods, and while the mods are impressive, they still delete craft and cause physics issues too often to be used on a long term game. (not to mention that I struggle to progress without the crutch of save-scumming). After finally convincing some friends to try the game, and souring some of them on it with a buggy run on Dark Multiplayer, I took inspiration from Dwarf Fortress succession games and made something that better suited my needs.

# How do I install it?

First, decide which version is right for you:

  • standard Barrage-Multiplayer - Simply shares the save file. Could be more compatible with progression mods
  • Barrage-KSP-Science - Shares most of the save file, but keeps science experiments and tech tree progress separate per player. Only for science mode.

Go to the appropriate github page, in the "Code" button click "Download ZIP", then follow the instructions in the readme.

# Questions I anticipate:

"Player limit of one? That's not multiplayer at all! Why bother?"

 - With the distances involved in KSP, players don't run into each other anyway. I tend to spend more time planning missions and designing/testing craft than actually flying, and with the simulator script, you can play concurrently with friends so long as you communicate well and take turns performing missions while the others build and plan.

"How do you resolve merge conflicts?"

 - The script will stop you from playing on the save if anyone else is using it when you try to load it. If it breaks and somehow allows a merge conflict to occur, you should revert to the last valid commit. This has never happened in my testing.

"Will you make a version for separate career mode progression?"

You can already play career mode on standard Barrage, if you are okay with sharing funds, contracts, and tech tree. The save hacking approach I used to make separate science work could be extended to much of career mode, but there are a lot of problems:

  • Kerbals are complex. I'd likely need to set them to MIA when players that don't own them are playing, but what about crew respawning? What happens to active craft with MIA kerbals in them?
  • There are many mods that add external progression systems that'd need to be explicitly supported. Strategia, Scansat, EVA repairs, etc. Any mod that stores it's own data would need to be added and tested separately.
  • You'll get crew rotation and resupply contracts for other player's stations and bases.
  • If you play with life support mods, other players could starve your kerbals.
  • Your contract timers will expire while other people are playing. To solve this I'd either need a mod that disables all contract timers, or do some difficult save hacking to make timers not count down while other players are on.

Ultimately, I expect making a Barrage for KSP career mode is possible, but would require a bit of tricky coding, a lot of testing, and ultimately still have a lot of mod incompatibilities. I've already gotten what I wanted out of this project, but if anyone else wants to try, I'd be happy to share everything I've learned from developing it this far, and help as appropriate. The project is MIT licensed, and you all have my permission to fork and modify it to serve any purpose.

"Is this safe?"

While I'm not aware of any specific exploits, loading unknown save files does always pose a risk. Please be careful about who you allow to join your Barrage games.

 

3MCdDXB.png

License: MIT

Edited by BadRAM
fix redundant title
Link to comment
Share on other sites

16 minutes ago, StormxWolf said:

Cool mod! Am I understanding this right, that if one player is playing actively then others simply cannot use the save? I am not sure I understand how the locking mechanic works.

This is correct. How it works in practice is that the script creates a "locked.txt" file and pushes it to the repository, then deletes it when it pushes updates to the save at the end of your session. The lock file contains the message "Save in use by [USERNAME]" and if the script sees a lock file present when it tries to load the save for a new player, it will instead print the contents of locked.txt and abort.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...