Freeciv-Web WebGL/Three.js prototype

Web version of freeciv at play.freeciv.org
louis94
Hardened
Posts: 225
Joined: Thu Apr 25, 2013 10:17 pm
Location: Belgium

Re: Freeciv-Web WebGL/Three.js prototype

Postby louis94 » Wed Nov 23, 2016 7:35 pm

I didn't have much time finally, but the few hours I could find were taken trying to get back control over the VM. Because it crashed once again, and then once more :cry: I don't know why, but it's really unstable. It will suddenly close all remote connections and enter a loop trying to write to an offline device (or at least that's what's displayed on the VBox screen), then panic(). Even rebooting doesn't help.
So… How do you run freeciv-web ? Or could you help me getting it up and running in a VM of my own ?

Louis

User avatar
AndreasR
Elite
Posts: 701
Joined: Thu May 02, 2013 10:26 pm
Location: Norway

Re: Freeciv-Web WebGL/Three.js prototype

Postby AndreasR » Wed Nov 23, 2016 8:33 pm

I run Freeciv-web using the default Vagrant setup, so I hope that we can get it running for you also.

If you have issues with the VM then I would suggest you setup the VM again, and try to adjust the amount of memory allocated to the VM.
I have 8 GB of RAM on my laptop, and the Freeciv-web VM is currently assigned 5,3 GB of RAM. This is done in the Vagrantfile.
Earlier you said that you assigned 2 GB of RAM, this sounds like too little. I recently changed the Vagrantfile to use 2/3 of the available RAM in the
system since you reported issues with memory. Perhaps you could try different memory settings in the Vagrantfile? Search for --memory in the Vagrantfile. How much RAM does your computer have, and how much memory is VirualBox reporting that the VM has assigned?

To start with a fresh system, run 'vagrant destroy', then check the source code out from Github, and run 'vagrant up'.

After some time with many development updates, my Freeciv-web VM also seems to run out of memory. This can then be fixed either with a restart of the VM, or the stop-freeciv-web.sh and start-freeciv-web.sh commands.

I have released the latest version to the production server now.

I hope that we can fix your VM issues, since I think the WebGL version of Freeciv-web would be much better if we could cooperate on this!

Andreas

louis94
Hardened
Posts: 225
Joined: Thu Apr 25, 2013 10:17 pm
Location: Belgium

Re: Freeciv-Web WebGL/Three.js prototype

Postby louis94 » Wed Nov 23, 2016 8:47 pm

Thanks for your quick answer !

I did set the memory to 1.5 GB (Plasma+Akonadi+Firefox need lots of memory), but it didn't really change anything -- I had the same problem with more RAM. And the kernel should kill() processes when low on memory, not panic(), right ? And going out of memory wouldn't make the machine unusable when restarted…

I used `vagrant destroy' a few times already, but it's not enough to (temporarily) solve the issue. I have to `vagrant remove' the box too, download it again, then `rm -r *; git checkout --; vagrant up' :(

Louis

User avatar
AndreasR
Elite
Posts: 701
Joined: Thu May 02, 2013 10:26 pm
Location: Norway

Re: Freeciv-Web WebGL/Three.js prototype

Postby AndreasR » Wed Nov 23, 2016 9:11 pm

Are you running the host OS on Windows or Linux? I'm running on Windows 10. I tested Freeciv-web running on Linux on Vagrant a few months back and it worked.

The memory should be set to about 5 Gb for good performance.

Sveinung also had some issues running Vagrant. It is also possible to install Freeciv-web manually directly on a Linux machine. You could follow these steps manually (but it could take hours): https://github.com/freeciv/freeciv-web/ ... t-build.sh
Are you running the latest version of VirtualBox?

What is the output of the dmesg command? The top command? The uptime command?
Do you find any error messages in the Freeciv-web logs subdirectory? There is also a Vagrant log file in the Freeciv-web git base dir.

I find that closing the browser running WebGL while compiling speeds up compulation.

Feel free to email me directly on andreas.rosdal at gmail.com

User avatar
AndreasR
Elite
Posts: 701
Joined: Thu May 02, 2013 10:26 pm
Location: Norway

Re: Freeciv-Web WebGL/Three.js prototype

Postby AndreasR » Thu Nov 24, 2016 5:19 pm

Also, please make sure that you are running the latest versions of Vagrant and VirtualBox.
https://www.vagrantup.com/
https://www.virtualbox.org/

louis94
Hardened
Posts: 225
Joined: Thu Apr 25, 2013 10:17 pm
Location: Belgium

Re: Freeciv-Web WebGL/Three.js prototype

Postby louis94 » Thu Nov 24, 2016 6:36 pm

AndreasR wrote:Are you running the host OS on Windows or Linux? […] Also, please make sure that you are running the latest versions of Vagrant and VirtualBox.

I'm on Arch Linux (rolling-release distro), outdated versions shouldn't be the problem.

AndreasR wrote:The memory should be set to about 5 Gb for good performance. […] What is the output of the dmesg command? The top command? The uptime command? Do you find any error messages in the Freeciv-web logs subdirectory? There is also a Vagrant log file in the Freeciv-web git base dir.

Last time I checked, top was clean, with memory available, not swapping. I didn't check dmesg, and uptime is biased by the host machine sleeping a lot… The machine is dead right now. No error message in logs/, and the Vagrant log does't look very useful.

AndreasR wrote:I find that closing the browser running WebGL while compiling speeds up compulation.

Speed of build-js.sh isn't a problem when the VM has access to the 8 CPU cores…

I'll try to setup a minimal Arch-based qemu VM. I'll let you know if I have problems running the server there, or share my installation script :)

Louis

User avatar
AndreasR
Elite
Posts: 701
Joined: Thu May 02, 2013 10:26 pm
Location: Norway

Re: Freeciv-Web WebGL/Three.js prototype

Postby AndreasR » Thu Nov 24, 2016 9:24 pm

I just tested setting up Freeciv-web using Vagrant on a fresh install of Ubuntu 16.04.1, and that worked without any problems. So I would recommend you try installing Ubuntu as the host OS. (I began installing Arch Linux to test, but found there was no graphical installer, then I stopped)

We also need updated Blender models for all units, cities and specials. There are 3d models created for Freeciv called Cimpletoon (http://opengameart.org/content/blender- ... eciv-units), but these needs updating, and removal of lights and armatures, and export to Collada format. This will take many days, and is something that would be really benefitial to the project, if you are interested in helping.

louis94
Hardened
Posts: 225
Joined: Thu Apr 25, 2013 10:17 pm
Location: Belgium

Re: Freeciv-Web WebGL/Three.js prototype

Postby louis94 » Fri Nov 25, 2016 3:04 am

I followed vagrant-install.sh, adapting things to Arch on the way. Right now I'm at the end, all services start, but all tests fail :( I saw freeciv-web doesn't like to be run as root, hopefully that's the cause of everything.

AndreasR wrote:So I would recommend you try installing Ubuntu as the host OS.

I dropped Ubuntu years ago, and swore I would never come back. So there's a no-go theorem on the way. Arch is much better once it's configured. (Btw, the command-line install procedure is quite instructive if you've never done that before.)

AndreasR wrote:We also need updated Blender models for all units, cities and specials.

Unfortunately I'm not a 3D artist… just a script kiddie :D I tried to "bake" bones into the mesh, didn't find the right button, and went back to my VM issues.

Louis

User avatar
AndreasR
Elite
Posts: 701
Joined: Thu May 02, 2013 10:26 pm
Location: Norway

Re: Freeciv-Web WebGL/Three.js prototype

Postby AndreasR » Sat Nov 26, 2016 7:35 pm

Development update: Freeciv-web is now able to render all units in WebGL mode.

Image

louis94
Hardened
Posts: 225
Joined: Thu Apr 25, 2013 10:17 pm
Location: Belgium

Re: Freeciv-Web WebGL/Three.js prototype

Postby louis94 » Sun Nov 27, 2016 6:14 pm

I did it ! My Arch-based fcweb is up and running ! Proof :
Spectacle.X25621.png
Spectacle.X25621.png (138.46 KiB) Viewed 10619 times


Here is a patch to speed up compilation of the C freeciv:

Code: Select all

diff --git a/freeciv/prepare_freeciv.sh b/freeciv/prepare_freeciv.sh
index 704e250..ada21f5 100755
--- a/freeciv/prepare_freeciv.sh
+++ b/freeciv/prepare_freeciv.sh
@@ -29,5 +29,5 @@ fi
 
 ( cd freeciv
 
-  ./autogen.sh CFLAGS="-O3" --with-project-definition=../freeciv-web.project --enable-fcweb --enable-json --disable-delta-protocol --disable-nls --disable-fcmp --enable-freeciv-manual=html --disable-ruledit --enable-ai-static=classic,threaded --prefix=${HOME}/freeciv/ && make -s
+  ./autogen.sh CFLAGS="-O3" --with-project-definition=../freeciv-web.project --enable-fcweb --enable-json --disable-delta-protocol --disable-nls --disable-fcmp --enable-freeciv-manual=html --disable-ruledit --enable-ai-static=classic,threaded --prefix=${HOME}/freeciv/ && make -s -j$(nproc)
 )

I had to hardcode the db hostname in freeciv-web/src/main/webapp/meta/php_code/fcdb.php:

Code: Select all

diff --git a/freeciv-web/src/main/webapp/meta/php_code/fcdb.php b/freeciv-web/src/main/webapp/meta/php_code/fcdb.php
index d1a37b3..f8f096a
--- a/freeciv-web/src/main/webapp/meta/php_code/fcdb.php
+++ b/freeciv-web/src/main/webapp/meta/php_code/fcdb.php
@@ -21,7 +21,7 @@ function fcdb_metaserver_connect() {
   return fcdb_connect($fcdb_metaserver_db, $fcdb_username, $fcdb_pw);
 }
 
-$dbhost = '';
+$dbhost = 'localhost';
 
 function fcdb_connect($db, $un, $pw) {
   global $fcdb_sel, $fcdb_conn;

The php-fpm socket has yet another location on Arch:

Code: Select all

diff --git a/publite2/nginx.conf b/publite2/nginx.conf
index 399c3d0..a5b8875 100644
--- a/publite2/nginx.conf
+++ b/publite2/nginx.conf
@@ -91,8 +91,8 @@ http {
             return 404;
           }
 
-          # Located at /var/run/php/php7.0-fpm.sock on some systems.
-          fastcgi_pass unix:/var/run/php7-fpm.sock;
+          # Located at /var/run/php/php/php/php7.0.0.0-fpm.sock on some systems.
+          fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
           fastcgi_index index.php;
           include fastcgi.conf;
         }

The systemd services also have different names on Arch:

Code: Select all

diff --git a/scripts/dependency-services-systemd-start.sh b/scripts/dependency-services-systemd-start.sh
index f5e70eb..9aaea13
--- a/scripts/dependency-services-systemd-start.sh
+++ b/scripts/dependency-services-systemd-start.sh
@@ -4,9 +4,9 @@
 # in configuration.sh's DEPENDENCY_SERVICES_START variable to use it.
 
 # Just in case it didn't start at boot time
-systemctl is-active --quiet mysql.service || systemctl start mysql.service
+systemctl is-active --quiet mariadb.service || systemctl start mariadb.service
 
 # Is stopped and (re)started with Freeciv-web
 systemctl is-active --quiet nginx.service || systemctl start nginx.service
-systemctl is-active --quiet php7.0-fpm.service || systemctl start php7.0-fpm.service
+systemctl is-active --quiet php-fpm.service || systemctl start php-fpm.service
 systemctl is-active --quiet tomcat8.service || systemctl start tomcat8.service
diff --git a/scripts/dependency-services-systemd-stop.sh b/scripts/dependency-services-systemd-stop.sh
index e7dc5ba..ab4fb09
--- a/scripts/dependency-services-systemd-stop.sh
+++ b/scripts/dependency-services-systemd-stop.sh
@@ -7,8 +7,8 @@ if systemctl is-active --quiet nginx.service ; then
   systemctl stop nginx.service
 fi
 
-if systemctl is-active --quiet php7-fpm.service ; then
-  systemctl stop php7-fpm
+if systemctl is-active --quiet php-fpm.service ; then
+  systemctl stop php-fpm
 fi
 
 if systemctl is-active --quiet tomcat8.service ; then

Other things I changed weren't in files indexed by git (ie with a .dist prefix).

Louis