One Hour One Life Forums

a multiplayer game of parenting and civilization building

You are not logged in.

#1 2018-03-13 05:09:38

Bimble
Member
Registered: 2018-03-13
Posts: 29

VirtualBox image with Ubuntu and OHOL test server pre-installed

A friend wanted to fiddle with a custom server, so to help out, I created a VirtualBox image with the test server pre-installed on it.

The username and password are both "ohol", and the build directories are in /home/ohol/ohol-build.

To get started, you'll need to download and install VirtualBox.  It runs on both Mac and Windows, though I only tested these instructions on Windows.  No reason it wouldn't work fine on a Mac (or even Linux, if you want to run in a VM on there for some reason).

In theory, you should be able to run the pullAndBuildTestSystem.sh script located in the ohol-build directory to rebuild the server when the code updates.

When you have VirtualBox installed, you can use the following (overly detailed) steps to set up the VM, launch the server, and set up the networking to let you connect to the server with a client on the host machine.  It's not as involved a process as it looks, I'm just used to thorough documentation.

1. In VirtualBox, Click New.

2. Give the new machine a name (like "Ubuntu-OHOL"), set Type to Linux, and Version to Ubuntu (either 64-bit or 32-bit, depending on the image you downloaded).

3. Allocate memory to the virtual machine.  I have no idea what's good, I used 1024MB to test a single local login.  It might work fine with as little as 512MB in a pinch.

4. For the Hard disk, select "Use an existing virtual hard disk file".  Click the folder icon to the right and you'll get a file selection dialog.  Navigate to the VDI file you downloaded and extracted.

5. Click Create.

6. Double-click the new VM to launch it.

7. You'll eventually see a login page with "ohol" listed as a user.  Click it.  For the password, enter "ohol".

8. In the barebones desktop that comes up, double-click the Terminal icon on the desktop (the one that looks like a black screen with a $ on it) to open a terminal in the OHOL build directory.

9. Type:

ip a

10. Buried in all that gobbledygook, in the second group, the third or so line should start with "inet".  You want the IP address in that line - if it were to start with "inet 10.0.2.15/24", then the part you would need is "10.0.2.15".  Make a note of it.

11. While you're here, let's have the server get the latest code and build it, in case it's updated since I created the image.  Assuming you're still in the build directory (if not, run

cd ~/ohol-build

), run:

sh refreshBuildScript.sh
sh pullAndBuildTestSystem.sh

The first script gets the latest version of the build script, and the second script is the actual build script.  The build will take a minute.

12. When it's done, start the OHOL server.  Run:

cd OneLife/server
./OneLifeServer

The server will start, and that terminal window will now be dedicated to running it.  You can quit the server by typing Ctrl+Z or by closing the terminal window.

13. Now, go back to the VirtualBox main window, select the new VM, and click the Settings button.

14. Go to the Network section and click the arrow next to "Advanced".

15. Click the Port Forwarding button.

16. Click the little green "Add new port forwarding rule" button. Use the following settings, using the VM's IP address for the Guest IP.

  • Name: OHOL (or whatever you like)

  • Protocol: TCP

  • Host IP: 127.0.0.1

  • Host Port: 8005

  • Guest IP: (the IP address from earlier, like 10.0.2.15)

  • Guest Port: 8005

Note: You can leave the "Host IP" and "Guest IP" fields blank if you want to be able to connect to the VM from another computer (thanks, llap!).  If you don't want to connect from another computer, I'd recommend using the settings above to restrict access to the VM's server, just in case.

17. Click OK, then OK again to get out of Settings.

18. Almost there!  Go to the OHOL game directory on the host computer (i.e. Windows or Mac), go into the settings folder, and edit "useCustomServer.ini".  Change the 0 to a 1, and save.  If you haven't changed the custom server files before, that's all you need - if you have, change them to point to "localhost" and port "8005".

19. Launch your OHOL client.  Enter anything for the email address and password, the test server won't care.  If you get a login error, either use Temp Login, or change the email address to something else to force it to re-authenticate.

That should be that.

The pre-installed server uses a rough little test map I made in the editor, created following Jason's instructions here:

https://onehouronelife.com/forums/viewtopic.php?id=112

Those instructions also point out where the editor is located and how to make a test map of your own.

Note that the Guest Addition for VirtualBox are installed on the image, so you can enable the shared clipboard by going to the Devices menu, then Shared Clipboard, then Bidirectional.  That will let you copy text on the host or in the VM and paste it in the other environment.

For quick reference, a section on updating the server later:

Updating

You can update the server to the latest code by going into a terminal and running:

cd ~/ohol-build
sh pullAndBuildTestSystem.sh

To update the client to the latest version, go into the client's "Settings" directory and change the contents of the useCustomServer.ini file from "1" to "0" and save it.  Run the client and and log in to automatically update.  Then quit the client, go back to useCustomServer.ini, and change the contents back to "1" to use the client with your local server again.

Troubleshooting

If you have problems like weird crashes, try updating the server and client using the instructions above.

If you still have problems, or if you try to launch the server and get a "Bad socket bind" error, then the old version of the server might still be running in the background.  The easiest way to resolve this would be to reboot the VM by running the command:

reboot

Or if you want to do it like a Linux pro, run:

ps -ef | grep OneLife

If there's a line with "./OneLifeServer" in it, check the left-most number on the line and kill that process number.  If the number were "12345", you would run:

kill -1 12345

Then you should be able to start the game server again.

You can also try going to the build directory, running the refreshBuildScript.sh script in case the build process has been changed, and then running the pullAndBuildTestSystem.sh script again.

sh refreshBuildScript.sh
sh pullAndBuildTestSystem.sh

If you have an older version of the image that doesn't have the refreshBuildScript.sh script, go to the build directory and run this instead:

wget -N https://raw.githubusercontent.com/jasonrohrer/OneLife/master/scripts/pullAndBuildTestSystem.sh

That's all the refreshBuildScript.sh script does.

Last edited by Bimble (2018-04-12 18:11:55)

Offline

#2 2018-03-13 05:15:28

Uncle Gus
Moderator
Registered: 2018-02-28
Posts: 567

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

Very nice.

Offline

#3 2018-03-16 04:43:21

ETK03
Member
Registered: 2018-03-08
Posts: 18

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

Would there be any chance that you would make one for 32-bit?

Offline

#4 2018-03-17 18:54:02

Bimble
Member
Registered: 2018-03-13
Posts: 29

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

Sure, I'll try to build a 32-bit version soon.

Offline

#5 2018-03-17 21:24:44

33Spectre
Member
Registered: 2018-03-11
Posts: 15

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

Thanks for sharing this!

Offline

#6 2018-03-18 16:58:01

llap
Member
Registered: 2018-03-08
Posts: 97

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

thank you very much! it all works fine for me! unfortunately the game stops if I am eating a gooseberry sad ... can I do something about that?

thx for help!

llap Olli


llap Olli

Offline

#7 2018-03-18 17:10:46

llap
Member
Registered: 2018-03-08
Posts: 97

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

sad ... I guessed .. OK than I don´t eat anything ... but after 5 deaths the game doesn´t work anymore sad

any suggestions? is that a knowing problem?

thx for help again!

llap Olli


llap Olli

Offline

#8 2018-03-18 17:45:09

llap
Member
Registered: 2018-03-08
Posts: 97

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

it says:

"cause: socket write failed"


llap Olli


llap Olli

Offline

#9 2018-03-18 19:58:37

carrotlover
Member
Registered: 2018-03-13
Posts: 6

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

Thanks for sharing this, Bimble!

I have a problem, thou. The cliente starts, I log into the game, but I'm stuck in the "Waiting to be born" screen.

Anyone knows what can I do?

Thanks

Offline

#10 2018-03-19 03:45:08

Bimble
Member
Registered: 2018-03-13
Posts: 29

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

I'll update the instructions, but basically I'd imagine the problems come from the update.  If you use the latest client with the server on the image there are probably Issues.

I'd suggest stopping the server with control-Z (in the terminal you're running it in), then cd your way to the ohol-build directory, then run the pullAndBuildTestSystem.sh.  Basically, that looks like:

cd ~/ohol-build
sh pullAndBuildTestSystem.sh

That will download the latest server code and compile it.  When it's done, try running the server and see if it works any better.

If you need to update the client to the latest version, change the value in useCustomServer.ini in the client's Settings directory to "0", then launch the client and log in to the game to auto-update, then quit and set that back to "1" to connect to your local server again.

Note that if you see a socket error or the like trying to launch the server, then the old server might still be running (that can happen if you double-click the server in a file browser window).  To fix that, go into the terminal and type:

ps -ef | grep OneLife

If you see a line with "./OneLifeServer" in it, then it's running.  Make a note of the first number in the line so you can kill it.  If that number were 12345, for example, run:

kill -1 12345

That should tell the server to shut down, then you can start the newly-updated server in its place.

Last edited by Bimble (2018-03-19 03:46:35)

Offline

#11 2018-03-19 04:37:15

mikekchar
Member
Registered: 2018-03-19
Posts: 51

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

I wonder if it would be useful to build a docker image instead.  The advantage would be that you can automate all the setup more easily.  If I get some time, I'll try to do it, but anyone feel free to beat me to the punch because I'm notoriously unreliable ;-)

Offline

#12 2018-03-19 06:17:21

Bimble
Member
Registered: 2018-03-13
Posts: 29

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

Sounds good to me, but I won't be the one to do it. wink

I haven't messed with Docker a lot but have been using VirtualBox for a new job, so I ran with that.  I imagine problems will arise less from the image or container than from new server admins needing to get used to the game update cycle.

Offline

#13 2018-03-19 07:58:33

llap
Member
Registered: 2018-03-08
Posts: 97

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

@Bimble:

thank you very much for help and explaining perfectly! I will try it later!

I have one question yet, is there a possibilty to play it in LAN? I have tried to change the networksettings of the VM, but it doesn+´t worked as well.

llap Olli


llap Olli

Offline

#14 2018-03-19 09:08:40

Bimble
Member
Registered: 2018-03-13
Posts: 29

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

The port forwarding I set up in the instructions only accepts connections to localhost (127.0.0.1).  You could try adding another port forwarding rule similar to that, but using the main IP address of your computer for the "Host IP" (with everything else the same).

Another approach would be to shut down the VM, then go to its Network Settings, then enable a second network adapter and set it to "Bridged" mode.  That should let the VM get its own IP address on the local network.  You can check it by starting the VM back up again and running "ip a" to see if there's a new IP address that matches your LAN.

Note that you might need to open port 8005 in your computer's firewall to let the connection through as well.

Offline

#15 2018-03-19 09:18:12

Bimble
Member
Registered: 2018-03-13
Posts: 29

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

Update:  I added a 32-bit version of the image, and also tweaked the 64-bit image a bit.

The main changes are the addition of a GUI text editor (Mousepad) and installing the Guest Additions in the image.  The Guest Additions let you share your clipboard with the VM (handy for copying and pasting) and should let you resize the VM window and have the VM's desktop adjust accordingly.

You can install Mousepad on an existing VM (so you don't have to download a new image) with:

sudo apt-get install mousepad

And the Guest Additions can be installed on an existing VM by going to the Devices menu and selecting the last item (Insert Guest Additions CD image), then going into a terminal and running these commands:

sudo mount /dev/cdrom /media
/media/VBoxLinuxAdditions.run

When it's done, reboot the VM and you should be able to enable the shared clipboard via the Devices menu.

I doubt I'll have occasion to make more changes to the images, from here it should just be a matter of running the pullAndBuildTestSystem.sh script when the game updates.

Offline

#16 2018-03-19 09:18:58

katastic
Member
Registered: 2018-03-01
Posts: 42

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

That's actually really neat. I might spin up a Ubuntu VM in VMWare (what I normally use) for server testing and post it.

Offline

#17 2018-03-19 18:15:45

llap
Member
Registered: 2018-03-08
Posts: 97

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

Bimble wrote:

The port forwarding I set up in the instructions only accepts connections to localhost (127.0.0.1).  You could try adding another port forwarding rule similar to that, but using the main IP address of your computer for the "Host IP" (with everything else the same).

Another approach would be to shut down the VM, then go to its Network Settings, then enable a second network adapter and set it to "Bridged" mode.  That should let the VM get its own IP address on the local network.  You can check it by starting the VM back up again and running "ip a" to see if there's a new IP address that matches your LAN.

Note that you might need to open port 8005 in your computer's firewall to let the connection through as well.

At first, updating the server in the VM helped with the problems of eating the berries smile thx, now I understood!

But unfortunately I don´t get the connecting in my LAN. I tried both ways , I even deactivated the firewalls of both computers, but if I type "ip a" it doen´t show me the actual IP of the windows-computer. It is 192.168.178.64 (with the VM) and the second has 192.168.178.50 ... the ports are open via firewall. After typing "ip a" it shows me always the same, but if I open a second or a third network-adapter it only  opens a new number (3, 4 ...) but without the IP .. sad

Do you have an idea for help? Thx for your time!

llap Olli


llap Olli

Offline

#18 2018-03-19 19:39:07

Cryptodream
Member
Registered: 2018-03-12
Posts: 43

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

Nice, i was too lazy to do a guide like this.

(I have been to lazy to do any mods too, we need an artist that can draw mods materials with the style of the game)

Thanks you very much for your contribution, this will help the community/mods/servers grow.

Offline

#19 2018-03-19 19:46:43

Bimble
Member
Registered: 2018-03-13
Posts: 29

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

The "ip a" command should show you the network adapters configured on the VM, so it won't show your computer's IP address there - just the addresses being used by the VM.  The adapter in "bridged" mode should be asking your router for its own IP address on the LAN, which is why that's different.

If you have more than one network adapter on your computer (a wired connection and a wireless adapter, for example), you might make sure the bridged adapter is using the right adapter (click the name to see a drop-down menu).

If you haven't already, I'd try pinging one computer from the other, or seeing if you can mount a share from the other, just to make sure that the computers can actually connect to each other on the LAN.

Otherwise...yeah, I'm not sure what else could be going on.  You can try searching for "virtualbox LAN connection" to see what you can find in the way of tutorials or explanations on StackExchange.  You might find answers from people with more experience troubleshooting it than I do.

Offline

#20 2018-03-19 21:57:47

llap
Member
Registered: 2018-03-08
Posts: 97

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

I got it !!!!!!!  The problem was that I wanted to be too good smile

Here is the solution (show at your point 16)

16. Click the little green "Add new port forwarding rule" button. Use the following settings, using the VM's IP address for the Guest IP.

    Name: OHOL (or whatever you like)

    Protocol: TCP

    Host IP:

    Host Port: 8005

    Guest IP:

    Guest Port: 8005

Thats it. You have to leave "Host IP:" and "Guest IP" blank, than it works fine! I already have connected 3 computers via LAN with the VM-Server.

Thanks a lot !!!!!

llap Olli


llap Olli

Offline

#21 2018-03-19 22:05:22

Bimble
Member
Registered: 2018-03-13
Posts: 29

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

I'll add a note about that.  Thanks!

Offline

#22 2018-03-19 22:18:33

llap
Member
Registered: 2018-03-08
Posts: 97

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

I also are able to connect from the VM-host computer with these settings smile

and I have more to thank you than you to me smile

llap Olli


llap Olli

Offline

#23 2018-03-27 17:07:34

llap
Member
Registered: 2018-03-08
Posts: 97

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

Thank you very much again for posting the server, to have the possibility to test all the things!  It works fine!

llap Olli


llap Olli

Offline

#24 2018-04-02 05:02:30

Lexyvil
Member
Registered: 2018-03-23
Posts: 107

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

After getting to step #6, I get a Kernel-Panic issue. Is that normal?

Offline

#25 2018-04-02 11:13:10

Bimble
Member
Registered: 2018-03-13
Posts: 29

Re: VirtualBox image with Ubuntu and OHOL test server pre-installed

Not normal.  Are you sure you got the right architecture (64-bit for a 64-bit OS, or 32-bit for a 32-bit OS)?

Offline

Board footer

Powered by FluxBB