![]() |
| A screenshot of DemoForwardJumpingAgent.py |
1. Download MarioAI.zip from:
http://code.google.com/p/marioai/downloads/list
2. In your MarioAI directory open
src/amico/python/PyJava/Makefile.Linux
3. Edit the file to make it look like the following (I highlighted the changes I made)
CC = g++4. Now open a terminal in this directory (PyJava), and run make
MKDIR = mkdir
SRCDIR = src
BUILDDIR = build
CFLAGS = -shared -Wl,-soname,libAmiCoPyJava.so.1 -fPIC
INCLUDES = -I/usr/include/python2.7 -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux
LFLAGS = -L/usr/lib/jvm/default-java/jre/lib -L/usr/lib/jvm/default-java/jre/lib/i386/server
LIBS = -lpthread -lz -lutil
MAIN = $(BUILDDIR)/libAmiCoPyJava.so
all: $(MAIN)
$(MAIN):
${MKDIR} -p $(BUILDDIR)
$(CC) $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -o $(MAIN) $(SRCDIR)/PythonCallsJava.cc -ljvm
.PHONY: clean
clean:
rm -f $(MAIN)
# DO NOT DELETE THIS LINE
5. This will generate libAmiCoPyJava.so under the PyJava/build directory
6. Copy libAmiCoPyJava.so into your_mario_ai_directory/bin/AmicoBuild/PyJava directory.
7. Open a terminal in this directory and add the jvm path in your LD_LIBRARY_PATH with the following command:
export LD_LIBRARY_PATH=/usr/lib/jvm/default-java/jre/lib/i386:/usr/lib/jvm/default-java/jre/lib/i386/client:$LD_LIBRARY_PATH
You can make this automatic if you add the line above at the end of you .bashrc file.
8. Now try
python DemoForwardJumpingAgent.py
9. That's it. You should see a small window popping-up with our little friend Mario jumping and running in it
