Setting up the Unity3D world for Ubuntu

From OpenCog



This page describes the steps to set up OpenCog in such a way that they can run the Embodiment module together with the Unity world in a single native (or virtualized) Ubuntu 12.04 environment. Users wishing to set up their environment in a virtual environment (VMWare) should be aware that 3D graphics are not fully supported for all graphics cards in VMWare, or Ubuntu for that matter.




Once your Ubuntu environment is ready, you may proceed here.

The steps we need to take next are:

  • Installing and building OpenCog in the right way for Embodiment
  • Getting the Unity standalone player for Ubuntu
  • Setting up Embodiment on the OpenCog side
  • Running Embodiment
  • Running the Unity player
  • Connecting to Embodiment
  • Interacting with the AGI

Installing and building OpenCog in the right way for Embodiment

The main difference in this tutorial is that we'll be building OpenCog in a folder called 'build' within the source folder. In order to do this, we have to run the OCPKG script in a slightly different way.

Open a Terminal window inside Ubuntu as shown below.

Installing CogBuntu Start Terminal.png

The terminal window will start in your home directory (~). This process will take a while, and will leave you with a folder called 'opencog' inside your home folder and dependencies necessary to compile and run OpenCog installed.

git clone

It should ask you for your root password, which you defined when you installed Ubuntu in VMWare. It may take a while for it to download and install everything.

Next we go into the folder:

cd opencog

And create a build folder:

mkdir build

Go into the build folder:

cd build

And run cmake to prepare the build:

cmake ..

Before we call the make command, think about how many processors you gave to VMWare (maximum is 4 with the free version) and pass that number as a -j parameter as shown below:

make -j$(nproc)

It should now start building OpenCog, which can take anywhere from 5-20 minutes depending on the speed of your system.

Getting the Unity standalone player for Ubuntu

The Unity player is automatically built every time there is a commit to the master branch on GitHub.

You can download the player here:

You will need both the executable and the entire data folder:


You can use wget to download it (using -r and --no-parent options). After downloading, you need to mark Unity3DGameWorldPlayer_Linux64 as an executable file.

If you're not sure how to achieve the above, try this:

cd ~
mkdir UnityPlayer
cd UnityPlayer
wget -m -np
chmod +x Unity3DGameWorldPlayer_Linux64

Setting up Embodiment on the OpenCog side

To run embodiment, we need to run a script. So go to the scripts/embodiment folder:

cd ~/opencog/scripts/embodiment

And run it:


This will copy the required files to your ~/opencog/build/dist/embodiment folder.

Running embodiment

To run Embodiment, we need to go back to the Ubuntu VM. In the terminal window, go to the right folder:

cd ~/opencog/build/dist/embodiment

And start the Embodiment server:


You should see the output shown below, or something similar. Don't worry about the processes that aren't found, these are just check to kill / restart processes.

learningServer_CogServer: no process found
oac: no process found
router: no process found
learningServer: no process found
spawner: no process found
LSMocky: no process found
pbTester: no process found
pvpSimulator: no process found
Listening on port 17001
spawner 8675 alex    7u  IPv4  17895      0t0  TCP *:16313 (LISTEN)

Now you have Embodiment up and running!

Running the Unity player

We're almost ready, we just need to find out the IP address of your machine so we can pass that to the player. To find out the IP address of your Ubuntu VM, open a terminal window in Ubuntu and type:


The item circled below is the IP address of your Ubuntu VM.


To start the Unity standalone player, go back to the folder we downloaded it to earlier:

cd ~/UnityPlayer


cd ~/UnityPlayer/

You may need to make it executable first, so type

chmod +x ./Unity3D-Standalone-Player-Ubuntu.x86


chmod +x ./Unity3D-Standalone-Player-Ubuntu.x86_64

And start it up, passing the ip address you just found as a parameter ( in the example below).

./Unity3D-Standalone-Player-Ubuntu.x86 ROUTER_IP:


./Unity3D-Standalone-Player-Ubuntu.x86_64 ROUTER_IP:

After the Unity splash screen, choose 'Start game' and 'Blockset 1', to make the game screen come up.

You should see some characters and a Unity terrain.

Use the mouse and WASD keys to move around the world. You may need to give it a few seconds to generate more terrain from time to time, unless you are using a pre-defined map of course.

Connecting to Embodiment

Press tilde (`) (the key under your Esc key) to bring up the console. You can use this to execute some commands.

For now, type /load npc (or press the up arrow) and hit Enter to start loading the AGI controlled character and connecting to Embodiment. The panel should state the IP address it's trying to connect to, make sure this matches the IP address of your embodiment running machine.

If all goes well, a robot should appear as well as the OpenPSI panel in the bottom right corner of the screen which indicates the AGI's simulated physiological and emotional states. As time goes by, the energy level will go down, so the AGI needs to find some energy in the form of batteries.

Interacting with the AGI

To feed the AGI, you need to create battery blocks for it to find and consume. Press the 'E' button to bring up the block selection panel (similar to Minecraft) and click on the last block in the set (the purple one). Press 'E' again to close the panel.


Now point at the ground somewhere and hit the right mousebutton to create a battery. After a few moments, the robot will detect the block and make a plan to reach its position. You can experiment with some hard to reach blocks, that require block destruction or creation, to test how smart the AGI's planner is.


Keep an eye on the log on the OpenCog side of things to see what is being planned and executed. Then just sit back and watch the robot find (or if necessary: create) a path to the battery! Have fun!


Any questions?

Then please leave them here.