Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Trying to setup a server thingy???  (Read 1664 times)

coteyr

  • Bay Watcher
    • View Profile
Trying to setup a server thingy???
« on: March 23, 2015, 08:08:12 pm »

Ok so if this isn't the right section then just move it where it needs to be.

I am trying to setup a Dwarf Fortress "server", and I have done some research on the forums and the wiki and I think I understand this enough, but I want to put the plan together so that someone with more experience then me can comment.

First, "what I can tell".

Basically I am working with these assumptions.

  • Two people writing to one region - bad
  • 900 people writing to 900 regions in a shared save folder is just fine
  • Sharing a save folder via dropbox is just fine

Now the plan

First I want to build 3 ways to access the "game"
    1. Dropbox for local play
    2. VNC Server for graphics clients
    3. SSH access for ASCII (ncurses) access

This is so far fine

Now what I want to do is allow two "types" of games
    1. A succession game - "anarchy mode"  - You logged out, you gave up control, anyone can "take over"
    2. My World - You can create your own region and it's just "yours" to do with what you want. Run your own succession game
    3. (it's a bit of a bonus but) you can let multiple people connect to VNC and watch you play, or work together or what ever.
Problems I don't intend to fix
    1. Security - It's public so it's not secure. You fortress gets trashed by an ass-hat that's what happens. There will be backups, but for the large part doing it on a server means it's not "just yours"
    2. Many connections at once. While many people can play in the save folder via drop box, the server is only going to allow 1 connection to either ssh or VNC.
Questions I have
    1. Do you see any problems with the setup, and what are they? I seems to have both  ssh and VNC working at an acceptable speed.
    2. Any Tips
    3. Is there any non-os way to lock a region (a lock file I can write or something) that would stop two people from opening a region. If not, that's fine, I can fake it, but it would be better if there were a dfhack plugin for it or something. If I could find a really good file lock plugin longer succession games would be possible.
I am really interested in feedback on this. I would really like to discuss potential problems and gauge interest.

P.S. it runs great via ssh or vnc on my android tablet over either ssh or vnc.
Logged

Amperzand

  • Bay Watcher
  • Knight of Cerebus
    • View Profile
Re: Trying to setup a server thingy???
« Reply #1 on: March 23, 2015, 08:37:58 pm »

If this works it could be really interesting, posting to watch.
Logged
Muh FG--OOC Thread
Quote from: smirk
Quote from: Shadowlord
Is there a word that combines comedy with tragedy and farce?
Heiterverzweiflung. Not a legit German word so much as something a friend and I made up in German class once. "Carefree despair". When life is so fucked that you can't stop laughing.
http://www.collinsdictionary.com

coteyr

  • Bay Watcher
    • View Profile
Re: Trying to setup a server thingy???
« Reply #2 on: March 25, 2015, 01:28:58 am »

I have 98% of the technical side worked out. VNC and SSH are working quite will as are some of the limits. I am really hoping for a lock file thing. I can fake it, but it will be easy to mess up when people play locally. I also still wonder about "other" issues.
Logged

Chaoseed

  • Bay Watcher
    • View Profile
    • Chaoseed Software
Re: Trying to setup a server thingy???
« Reply #3 on: March 25, 2015, 04:36:32 am »

This sounds pretty awesome. I don't necessarily know if I can help, but I'm trying to understand the problem...You want someone to log in with VNC or SSH, and then start a Dwarf Fortress instance on the server; then this server instance accesses the appropriate save folder, but you want to make sure that save folder hasn't been locked by someone else loading it for their game. Am I close?
Logged
Surprisepalace! Overseers wanted!
But they never would have given up either. And compared to sitting around in this prison for the rest of my life? Losing is fun.

coteyr

  • Bay Watcher
    • View Profile
Re: Trying to setup a server thingy???
« Reply #4 on: March 25, 2015, 07:15:12 am »

Yep that's pretty much it.

With VNC or SSH I can setup a lock file (outside dwarf fortress) that will not even start the app if someone else is using it. This would effectively limit the SSH access or VNC access to a single user at a time.

But I also want to make the "game" available to people that want to run it locally (as that may be preferable for a number of reasons). What I need to make this work however is the ability to state "You can't play this region right now, it's currently in use."

So where the game is running on the server I can use external tools to "lock" the game (region folder) to one person at a time. If I make the save folder available via dropbox, I can't really see a good way to keep some one from playing a region that someone else is playing.

To be clear I am not talking about security, just the ability to let someone know "it's not there turn".

Take a succession game. Your supposed to rotate ever 24 hours. But what if someone doesn't upload their save, how do you know it's ok to continue. I am trying to prevent someone on ssh or vnc from playing a region that is in use via dropbox, because they simply would have no way to tell. If there were a plugin that wrote a lock file on region load, and could stop a region load/save if that lock file existed that would be "enough". It would be great if that mystery plugin also cleaned up it's lock file on save. But that's not a must.

I don't mind writing a plugin to do that (it's pretty simple), but I would rather use one that existed already, or even better, if there is a file that is written in plan old vanilla that would "lock" a region that would be awesome as well.   
Logged

Chaoseed

  • Bay Watcher
    • View Profile
    • Chaoseed Software
Re: Trying to setup a server thingy???
« Reply #5 on: March 25, 2015, 07:21:39 am »

Sounds pretty cool. Well...maybe you should ask in the Modding forum? Or even the Utilities and 3rd Party Applications forum? ;)
Logged
Surprisepalace! Overseers wanted!
But they never would have given up either. And compared to sitting around in this prison for the rest of my life? Losing is fun.

Timeless Bob

  • Bay Watcher
    • View Profile
Re: Trying to setup a server thingy???
« Reply #6 on: March 25, 2015, 06:22:22 pm »

A visual GUI in between might work, with red "X"s over the areas that have been instanced, and making those areas therefore unable to be chosen until the "X" is removed by uploading the save file back to the server.  in-game time would be an interesting challenge to overcome - perhaps every 24 hours the server would embark/retire a 1x1 tile fortress repeatedly, loading save files back into the game at the appropriate points until the entire world was synched to the same date.  Otherwise, one Player's instance of a two-week in-game sojurn in adventure mode and another's meticulous twelve year fortress, both reposted to the server at the same time, would be woefully out of joint on the time-line.
Logged
L33tsp34k does to English what Picasso did to faces.

Dwarfopoly
The Luckiest Tourist EVER
Bloodlines of the Forii

coteyr

  • Bay Watcher
    • View Profile
Re: Trying to setup a server thingy???
« Reply #7 on: March 26, 2015, 05:51:57 am »

The idea is that a region is locked. So you can't adventure  and build in the same region at the same time. Or more correctly I can't adventure while you build in the same region at the same time.

The game already prevents this. If I choose to be in Dwarf mode, I can't start an adventure in that region.

The biggest problem I am having is with locking a region when it's in use. I can write a file on load of a region, but I can't seem to devise a way to display that in game. A quick bash script "could" fix it but that would be pretty rough for windows users. I don't really want to rely on FTP (or similar) to download or upload region folders. I would like it to be rather automatic. Imagen loading the "continue playing" menu and seeing 100 other peoples fortresses you could look at and explore (so long as you didn't save).

Two bits of good news. First I got VNC access to work at a very acceptable rate. Because DF is only 16 colors or so, that can cut out a lot of transfer. Second I stumbled on a way to "hide" folders in save games. If you don't have write permissions to the folder the games doesn't let you see the region. I am investigating this to see if it gets us closer to locking. 
Logged