Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 18 19 [20] 21

Author Topic: [Released] Dwarf Fortress Remote for iOS  (Read 71122 times)

mifki

  • Bay Watcher
  • works secretly...
    • View Profile
    • mifki
Re: [Released] Dwarf Fortress Remote for iOS
« Reply #285 on: October 16, 2016, 09:07:40 pm »

Is there something special to do if you log on to a wireless router? I noticed on the IOS app it does not save my router's rather long password.

I have tried every combination imaginable, including my IP, the name of the router and its password. But if it does not save it how can it use it?

The password in the app has nothing to do with the router password, it's the password you set using "remote pwd" command to protect your server. (And the app actually saves it, it just always displays it with ***, I know it's confusing, I will improve this).

Anyway, what you need to do to connect on your wireless network is to specify your computer private IP (not public IP; if you're on Windows, see here https://support.microsoft.com/en-nz/help/15291/windows-find-pc-ip-address). Leave password blank unless you have set it with "remote pwd" command.

If it still does not connect, you may need to add a port exception to your firewall, see here http://www.dummies.com/computers/operating-systems/windows-7/how-to-open-a-port-in-the-windows-7-firewall/

Next, if you want to connect to your server from outside of your network (via cellular), use "remote publish SOME_NAME" command, and specify this name in the app (in addition to the IP).

Valdus92

  • Bay Watcher
    • View Profile
    • My Blog "Scrawls"
Re: [Released] Dwarf Fortress Remote for iOS
« Reply #286 on: October 16, 2016, 09:28:36 pm »

and what about on a mac? I see most of the instructions for pc.

I try putting my local, turned on remote, but it still gives me an error.
« Last Edit: October 16, 2016, 09:38:39 pm by Valdus92 »
Logged

mifki

  • Bay Watcher
  • works secretly...
    • View Profile
    • mifki
Re: [Released] Dwarf Fortress Remote for iOS
« Reply #287 on: October 16, 2016, 09:42:21 pm »

and what about on a mac? I see most of the instructions for pc.

Well, for Mac it's easier of course :) In System Preferences->Network select your network connection and you'll see IP address straight away below "Status: Connected".
Firewall is off by default (System Preferences->Security->Firewall) and if it's on, it will ask you to allow connection when you try to connect to your server.

Valdus92

  • Bay Watcher
    • View Profile
    • My Blog "Scrawls"
Re: [Released] Dwarf Fortress Remote for iOS
« Reply #288 on: October 16, 2016, 09:44:47 pm »

IT WORKED! I just had to name the network, ye gods that was rough.
« Last Edit: October 16, 2016, 09:52:00 pm by Valdus92 »
Logged

Lycake

  • Escaped Lunatic
    • View Profile
Re: [Released] Dwarf Fortress Remote for iOS
« Reply #289 on: October 24, 2016, 07:09:43 am »

First of all, I find it amazing how much you contribute to this community, Mifki. Amazing job!

I played around a bit with your remote server because I was very curious. In your post here you describe a bit how everything works and even though it is a few months old, a lot of it is still accurate and very helpful. However I can't seem to figure out how your (initial) map data works sometimes.

In the basic case you have tile,fg | (bg << 4) which is easy enough to understand, but what confuses me is when graphics (and maybe multi layer?) come into play. Suddenly instead of 2 bytes you have more (a short and a byte? not sure), sometimes dz (what does it do?) comes into play and changes things and also I'm not sure there are alway 8 tiles after a lastinfobyte.

So.. while my coding skills are decent and I don't need a line by line explanation, this part of your code is hard to debug and understand without comments. I would appreciate it very much if you (or anyone who has looked at it too) could briefly explain the general format of your map data if graphics are involved.

Thank you so much!
Lycake
Logged

mifki

  • Bay Watcher
  • works secretly...
    • View Profile
    • mifki
Re: [Released] Dwarf Fortress Remote for iOS
« Reply #290 on: October 25, 2016, 02:50:02 am »

I would appreciate it very much if you (or anyone who has looked at it too) could briefly explain the general format of your map data if graphics are involved.

Both in TWBT and Remote, when rendering, z-level offset (that is, how many levels a tile is below the current z-level) is stored in the brightness byte (bits 1-7). When sending over network, as you noticed, foreground and background colours are packed into one byte, however there can be only 8 background colours, so we have one bit left. When sending tiles, if a tile has different z-level than the previous one, that one bit will be set to 1, and z-level difference will be sent in the next byte. That's how multilevel works.

Now, if graphics is enabled, for creature tiles (and only for them) I need to send two bytes with the texture number instead of one. So, for each 8 tiles I insert a byte indicating which of the following 8 tiles are creature tiles (having 2 byte texture number) and which are normal tiles (having 1 byte tile number).

It may look a bit complicated, but I wanted to optimise the amount of data sent over cellular.

Lycake

  • Escaped Lunatic
    • View Profile
Re: [Released] Dwarf Fortress Remote for iOS
« Reply #291 on: October 25, 2016, 09:01:27 am »

Perfect explanation! Everything makes sense now. It's quite a clever way to do it. Thank you so much!

Now I know this is more of a dfhack question, but since it's a follow up I might aswell ask here. I saw that the way the creature tile IDs are ordered is by alphabetical order of the config files in raw/graphics and then a colored and a grayscale version of each. However in my example with spacefox the starting ID (first file, first tile) for this was 2569. What are all the other tiles in front of it and how does the client know where to start? How does the client know that at ID 2569 (in case of spacefox) creature tiles start?
Logged

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: [Released] Dwarf Fortress Remote for iOS
« Reply #292 on: January 04, 2017, 04:55:34 am »

seen there's a dfhack alpha around for 43.05, does your plugin build with it? wondering if there will be at some point a docker script to build on the latest, for the courageous.
Logged

UrulKahtrum

  • Escaped Lunatic
    • View Profile
Re: [Released] Dwarf Fortress Remote for iOS
« Reply #293 on: April 22, 2017, 12:45:29 pm »

So uh,

I battled with Vultr, VPS, SSH, FTP, dfhack and DF Remote for 24 hours and I don't think anyone needs to have such a hard time again. I mean, most people probably just want to set their things up in 5 minutes tops and get playing, but I accidentally learned to use linux among other things. So thought I'd share with you.

Thorough newb-friendly setup instructions plus troubleshooting for Dwarf Fortress Remote on (fresh installed) Ubuntu 16.04 server (DF43.03)
Code: [Select]
1. Download and extract dfremote-complete-4303-Linux.zip to wherever desired with
unzip. We will download this file straight from mifki's page; it's a full package of
DF 43.03 + DFHack + DF Remote.

These first steps expect that you have a fresh install of Ubuntu that doesn't come
packaged with the unzip application (although there could be an another app for this that
I don't know of.) We will first download that app.

$ sudo apt-get update
$ apt install unzip zip

After that we download the package and extract it.

$ wget http://mifki.com/df/update/dfremote-complete-4303-Linux.zip
$ unzip dfremote-complete-4303-Linux.zip -d directory-of-your-choice/

2. install required libraries. Some/many/all? of these are 32-bit compatibility
libraries since 43.03 is 32-bit but your system is probably 64-bit. Optionally
on a 32-bit system go through these to see which ones you need.

$ sudo apt-get update
$ sudo dpkg --add-architecture i386
$ sudo apt-get install libsdl-image1.2:i386 libsdl-ttf2.0-0:i386 libgtk2.0-0:i386 libglu1-mesa:i386 openssl:i386

3. Dwarf Fortress will not launch yet since by default the game is configured
to run in 2D rendering instead of the text-based terminal. To fix this, open
the Dwarf Fortress init.txt config file located in /data/init/.
Don't overwrite d_init.txt, which is a default init file for backup.

In my example I'm using nano, a terminal text editor application supplied with
Ubuntu. You can always get it by apt-get for another distro or if you don't have
it:

$ sudo apt-get update
$ apt install nano

(then back in the main dwarf fortress directory...)
$ nano data/init/init.txt

Search for (Ctrl+w in nano) PRINT_MODE to find the setting and then change 2D to TEXT.
After fixing it'll look like this:

[PRINT_MODE:TEXT]
        Mode examples:
          PRINT_MODE:2D
          PRINT_MODE:TEXT
          PRINT_MODE:FRAME_BUFFER
          PRINT_MODE:PARTIAL:0

4. You can now run "./dfhack", but you'll soon find out that the dwarf fortress main game
starts instead of dfhack's command line. This, however, is not a problem.

Dwarf Fortress has to be running for you to issue dfhack commands, but instead of
using the dfhack command line, we will be issuing commands with the dfhack-run
application. On graphical linux distros this problem is probably absent; enjoy your
iOs fortress!

In our VPS case, we have to open another SSH session with Dwarf Fortress running in the former.
Do so, then navigate to the dwarf fortress main folder and execute

$ ./dfhack-run remote connect

That's it! From here on, everything is smooth sailing. On a VPS, you'll probably want to set
your server to be accessible over internet and not LAN solely or at all; to do this, execute:

$ ./dfhack-run remote publish "name_of_server"
$ ./dfhack-run remote pwd "password-for-server"
(quotation marks optional unless you have spaces in your name, for instance: "My Server")

5. Your server is now up and running, but when you close your SSH prompt, Dwarf Fortress will quit.
Obviously we don't want that to happen, because that will also close the server and prevent you
from playing.

It should also be noted that unlike PuTTY or other SSH programs, the Vultr's web-based "View Console"
terminal SSH does NOT issue an interrupt signal upon closing the terminal window, because it
doesn't quit the SSH session. That means you can do whatever in that terminal window, then close it
and open it again later to find everything just like they were before. This will NOT be the case
with most (any) other SSH programs.

Now is a good time to (optionally, i guess) reboot your VPN computer by simply telling it to

$ reboot

Now, to run your Dwarf Fortress server, here's how we're going to counter the program quitting.
First of all, navigate to the dwarf fortress folder, then issue the following command:

$ nohup ./dfhack &

The command ./dfhack will just run the game, but the nohup command before it will tell that program
to disobey interrupt signals and the & in the end will tell it to run in the backround. You will be
prompted with something along the lines:

nohup: ignoring input and appending output to 'nohup.out'

and a cursor waiting for input. When you press enter, you will return to the command prompt.
Now we have Dwarf Fortress and DFhack running as a background process. Cool! They won't output
anything to the screen, of course - don't be alarmed by that.

The next thing is to simply start the remote server:

$ ./dfhack-run remote connect

You have already set your server up as published - these settings stick to the server - so
this command will suffice to start the server. It's running right now, actually, if everything
went as should have! You can now close the SSH window (remember to connect the iOs app first if
you use the QR code!) Closing the SSH window now won't interrupt the DF process since we set that
application to run in the backround uninterrupted.

Connect using the QR code or alternatively manually and enjoy!


-----------------------------------------------
TROUBLESHOOTING
i. "I get an error when running the command 'dfhack-run [something] [something else]' etc."

This happens if the dfhack process is not currently running on your VPS. The error will read
"Could not connect to localhost: 5000". This means you have probably set everything up
properly but Dwarf Fortress isn't running, and that's why DFHack can't communicate with it.
To fix this:

1. Make sure you don't have the Dwarf Fortress game running in the foreground,
as in make sure you don't see any Dwarf Fortress graphics in the terminal. If
you do, quit the game to return to the terminal.
1.b) You should probably reboot your VPN system at this point because you are
probably confused about which processes are running and which aren't. Rebooting
quits every program (obviously) and gives you a clean slate that-wise.
2. Go thru step 5 in the installation guide again.


ii. "I get an error while trying to start the game! It says I don't have a display, but I
can totally see the text!"

The full error reads "Display not found and PRINT_MODE not set to TEXT, aborting."

This means you haven't set Dwarf Fortress to run text-based. The default is 2D, which isn't
supported in a server distro that has no graphical libraries or monitors by default. Go back
to the setup guide and read thru step 3 to fix this.


iii. "I get an error './dfhack: line 52: ./libs/Dwarf_Fortress: No such file or directory'"

This means compatbility- or other libraries required to run Dwarf Fortress are not installed in
your system. Go back to step 2 of the install guide.

Obviously this also applies to other linux distros although the exact commands might or might not be different. Tried to make this very, very newb friendly (both linux and dwarf) and all-inclusive.

Docker is another way to download dfremote, but unlike mifki reports on their site, Vultr (which I am using) does NOT include docker by default, so installing that was too much of a pain for me. See the two posts below.

Also I found out when proof-reading that step 4 is unnecessarily complicated. I could have just gone for step 5 straight away without the multiple SSH window nonsense, but that was how I did this at some point of the setup and it unintentionally sticked. I'm too lazy to fix it now - it works, don't touch it.  ;)

 Hope this helps somebody!
« Last Edit: April 23, 2017, 02:35:57 am by UrulKahtrum »
Logged

mifki

  • Bay Watcher
  • works secretly...
    • View Profile
    • mifki
Re: [Released] Dwarf Fortress Remote for iOS
« Reply #294 on: April 22, 2017, 06:11:50 pm »

Docker is another way to download dfremote, but unlike mifki reports on their site, Vultr (which I am using) does NOT include docker by default, so installing that was too much of a pain for me.

Really?

UrulKahtrum

  • Escaped Lunatic
    • View Profile
Re: [Released] Dwarf Fortress Remote for iOS
« Reply #295 on: April 23, 2017, 02:34:48 am »

Docker is another way to download dfremote, but unlike mifki reports on their site, Vultr (which I am using) does NOT include docker by default, so installing that was too much of a pain for me.

Really?
Okay, that's my bad, but let me elaborate on that, cause I'm sure I had a problem with the Docker distro and a reason to give up and switch to Ubuntu. Let's see...

Ok, so apparently, first of all I missed the "choose Docker" -part of your Vultr instructions and then got pissed when I thought you didn't mention it. In my excitement! Forgive me on that. Actually I created the Vultr VPN way before heading head first into this DFRemote stuff so I just forgot and assumed Vultr sets the server up on CentOS 7 x64 for default - of course that won't include "Docker by default", like I incorrectly mentioned.

However, Docker doesn't work like magic like it should in any case:
Code: [Select]
[root@vultr ~]# docker run -dtp 1235:1235/udp mifki/dfremote
Unable to find image 'mifki/dfremote:latest' locally
latest: Pulling from mifki/dfremote
8f229c550c2e: Pull complete
8e1fb71e8df6: Pull complete
f75a34586856: Pull complete
8744e322b832: Pull complete
d5165bfce78f: Pull complete
078f44746f68: Pull complete
aae0de372324: Pull complete
cdf184b20c57: Pull complete
d44c6bef0473: Pull complete
6c6121f006ca: Pull complete
3a5f2ac4c46d: Pull complete
8534972fad68: Pull complete
a13ae622044b: Pull complete
d9186770125a: Pull complete
Digest: sha256:6667591571b8b0da528f01f96d59157608219a8ab5c998cb729988041ff379e5
Status: Downloaded newer image for mifki/dfremote:latest
ce9661e158ac5a5a527b25d82fdb5057f0d8e58c0db02d2ddca0bfd4437f3e02
[root@vultr ~]# docker run -dtp 1235:1235/udp mifki/dfremote
346307e657a096330ded3a6f530ea5140d75f3b0c070a92005ebb53f8cb92160
docker: Error response from daemon: driver failed programming external connectivity on endpoint naughty_euclid (23eb2636575ed9f62b4ce9633b397e9baf1edcde98ad1a417b10025975a420ed): Bind for 0.0.0.0:1235 failed: port is already allocated.

So then I'm feeling like putting the startup script to use since both have the word allocate in them. That leads to no output on the terminal after reboot, and trying my luck in the iOs app, it fails to connect.

So the problem in Docker is I don't know if Remote is running, where is it located and how do I issue DFHack commands to the game now. I'll download atop to first of all see if it's running in the background, and that tells me:
Code: [Select]
[root@vultr ~]# atop
-bash: atop: command not found
[root@vultr ~]# sudo yum install atop
Loaded plugins: fastestmirror
base                                                     | 3.6 kB     00:00
docker-ce-stable                                         | 2.9 kB     00:00
extras                                                   | 3.4 kB     00:00
updates                                                  | 3.4 kB     00:00
(1/5): docker-ce-stable/x86_64/primary_db                  | 4.8 kB   00:00
(2/5): base/7/x86_64/group_gz                              | 155 kB   00:00
(3/5): extras/7/x86_64/primary_db                          | 151 kB   00:00
(4/5): base/7/x86_64/primary_db                            | 5.6 MB   00:01
(5/5): updates/7/x86_64/primary_db                                                            | 4.8 MB  00:00:11
Determining fastest mirrors
 * base: ftp.osuosl.org
 * extras: repos-va.psychz.net
 * updates: mirrors.lga7.us.voxel.net
No package atop available.
Error: Nothing to do

Oh, there's no repo including it.
Code: [Select]
[root@vultr ~]# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
--2017-04-23 07:14:21--  http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
Resolving dl.fedoraproject.org (dl.fedoraproject.org)... 209.132.181.25, 209.132.181.24, 209.132.181.23
Connecting to dl.fedoraproject.org (dl.fedoraproject.org)|209.132.181.25|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14704 (14K) [application/x-rpm]
Saving to: ‘epel-release-7-9.noarch.rpm’

100%[===========================================================================>] 14,704      93.9KB/s   in 0.2s

2017-04-23 07:14:22 (93.9 KB/s) - ‘epel-release-7-9.noarch.rpm’ saved [14704/14704]

[root@vultr ~]# rpm -ivh epel-release-7-9.noarch.rpm
warning: epel-release-7-9.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:epel-release-7-9                 ################################# [100%]

After installing atop and running it I then find that the startup script isn't working as I expect it to because there is no Dwarf Fortress process listed - and I have no idea what that script supposed to, other than run the dwarf fortress game, so I try manually once more:
EDIT: It is unclear to me whether a startup script can be allocated for a server AFTER that server has been created. Vultr doesn't explain this very clearly; as far as I understand startup scripts don't need to do anything else other than exist in the first place. In my case I missed it and just created the script afterwards.That could be a problem?
Code: [Select]
[root@vultr ~]# docker run -dtp 1235:1235/udp mifki/dfremote
9624f1616f93fa0870475ecec86b036e53f8141eb0c2e659ab5b55fa70665b7a
[root@vultr ~]#

Wait a minute. That gives no errors. Let's see...
Code: [Select]
  PID   TID  RUID     EUID       THR SYSCPU  USRCPU  VGROW   RGROW  RDDSK   WRDSK ST  EXC S  CPUNR  CPU  CMD        1/1
 2376     -  root     root         6  0.04s   0.08s     0K      0K     0K      0K --    - S      0   1%  Dwarf_Fortress

Yes, it's running now. Apparently the startup script works as in it setups something I don't understand to allow DF to run.

Actually to my amazement, the iOs app now is able to connect to the server too. Allright! I was sure I'd have to publish it first to make it work over internet. Although now I don't know how to setup a password etc. because I have no idea where those docker files are. But I guess that's one google search away, too. Anyway, it works now.

What I'm saying is, I'm a huge fan of your work but I'm a Windows user to the heart and I fought for 2 days trying to set all this up. I gave up on the Docker distro (I now realise) because I didn't understand a thing it was doing and it still didn't work. And I take the "challenge" wholehearted because I do want to learn linux, but this is a lot of steps that were unnecessary and only came up because I was kinda confused about what is and isn't going on.

It's a whole wall of text but what I really have to say is I love the huge effort you put into these plugins and the whole huge impact you have on the community and modding. I'm not really looking for anyone to address any of this, unless they find something I missed or misinterpreted of course. I just wanted all this out in the open for further troubleshoot help because I'm quite sure there will be a lot of my kind asking the same basic questions all over and over again. So now it's all here laid out with both the problems and the solutions documented.

By the way, the "Read about required libraries" link is dead in http://mifki.com/df/setup/ but the info is there, you just have to access it thru http://mifki.com/df/support/. That I can stand behind!!  :P

Cheers!

Edit: I toned it down a little at the end. It's a first post thing and writing ahead of thinking thing. Don't know why I took it that personally.
« Last Edit: April 23, 2017, 05:19:29 am by UrulKahtrum »
Logged

mifki

  • Bay Watcher
  • works secretly...
    • View Profile
    • mifki
Re: [Released] Dwarf Fortress Remote for iOS
« Reply #296 on: April 23, 2017, 05:39:51 am »

Startup script needs to be created first, and then you choose it when you create your server. The script then configures swap file, downloads and runs Remote server container. This takes some time so if you try to connect right after creating a server, it will fail, as well as you won't see DF process and even a Docker container if you SSH to the server right after creating it (this is also mentioned on my website btw).

Thanks for pointing out that the required libraries link is broken.

Overall, while I appreciate the effort on providing instructions how to run Remote server without Docker, it's completely not required in most cases. Recently I (for different reasons) tried starting a server on Digital Ocean, Vultr and Amazon Lightsail and can guarantee that it works - just create a server supplying the provided startup script, wait, and connect. If it doesn't work, just contact me and I'll help and most important fix the documentation if needed.

I somehow removed instructions how to set a password for your server when using Docker, I'll update the docs soon to include this.

UrulKahtrum

  • Escaped Lunatic
    • View Profile
Re: [Released] Dwarf Fortress Remote for iOS
« Reply #297 on: April 23, 2017, 05:54:27 am »

Startup script needs to be created first, and then you choose it when you create your server. The script then configures swap file, downloads and runs Remote server container. This takes some time so if you try to connect right after creating a server, it will fail, as well as you won't see DF process and even a Docker container if you SSH to the server right after creating it (this is also mentioned on my website btw).

Thanks for pointing out that the required libraries link is broken.

Overall, while I appreciate the effort on providing instructions how to run Remote server without Docker, it's completely not required in most cases. Recently I (for different reasons) tried starting a server on Digital Ocean, Vultr and Amazon Lightsail and can guarantee that it works - just create a server supplying the provided startup script, wait, and connect. If it doesn't work, just contact me and I'll help and most important fix the documentation if needed.

I somehow removed instructions how to set a password for your server when using Docker, I'll update the docs soon to include this.
Sure. Thanks for your time!
Logged

Leelu

  • Bay Watcher
    • View Profile
Re: [Released] Dwarf Fortress Remote for iOS
« Reply #299 on: July 10, 2017, 11:52:58 pm »

Hi Mifki,

Is there any plan for sound in the game?  It feels a bit empty without any audio, and of course it's a lot easier to catch unforeseen activities when the sounds of swords clashing interrupts you.

Thanks!
Logged
Pages: 1 ... 18 19 [20] 21