Day: February 24, 2018

Python programming course using Minetest

1 Comment

Do you want to learn at home how to program in python while enjoying the fun of building structures in Minetest? These instructions will help you create your own setup similar to the one used at Coderdojo. First of all, make sure you have finished the instructions for the Minetest client install and the Minetest server install.

The steps to configure your course platform:

  1. Install builder_police mod for Minetest.
  2. Install courses in PyCharm Edu

To configure your course platform you will need Internet access to download builder_police from github, ircbuilder python module from pypi.org, and the courses from this website.

To run the course you will need Internet access to a public IRC server (e.g., irc.rizon.net) which handles the communications between your python program and Minetest.

Minetest mods

The following commands are to be typed into Git-Bash (Windows) or Terminal (Mac, Linux). Change directory to the minetest mods directory. If the directory doesn’t exist you may have to create it.

cd Documents/minetest-0.5.0-6cfd699b-irc-win64/mods  # Windows 64 bit
cd Library/Application\ Support/minetest/mods # Mac
cd .minetest/mods                             # Linux
git clone https://github.com/timcu/builder_police.git

Now that you have installed the builder_police mod, you need to enable it in Minetest by selecting “configure” for the world, selecting the “builder_police” mod and clicking the “enabled” check box.

Install courses in PyCharm Edu

    1. Download the following files without unzipping them. Safari users may have to turn off “Open safe files after downloading” in the “General” tab of the Preferences to stop automatic unzipping.
    2. Open PyCharm Edu and select “Browse Courses” from the “File” menu.
    3. Underneath the list of courses, click on the small rectangle with an arrow pointing into it and select “Import a local course”.
    4. Select the downloaded file “Ninja_2_minetest_course_v5.zip”.
    5. Once it has imported you can click on the “Join” button in the bottom right hand corner. Joining a course takes a while because PyCharm will set up a virtual environment for your python programming which doesn’t affect other python programs on your computer.
    6. The virtual environment will detect that you need the python module ircbuilder version 0.0.5 or later and give you an option to install or ignore this requirement. Choose “Install requirement”.
    7. To do the course there are some details you need to set so that your python programs can connect to IRC and Minetest. These details are all stored in a file called “coderdojo.py”. In PyCharm, go to the File menu and select “Open…”. Navigate to your home folder, the folder “PyCharmProjects”, then the folder “Ninja 2 minetest course v5”, select “coderdojo.py” and click “OK”.
mtuser = ""      # your minetest username
mtuserpass = ""  # your minetest password. This file is not encrypted so don't use anything you want kept secret. Can't have spaces in it

# The following must match your settings in minetest server > Settings > Advanced Settings > Mods > irc > Basic >
ircserver = ""   # same as IRC server
mtbotnick = ""   # same as Bot nickname
channel = ""     # same as Channel to join
    1. You need to fill in the values. Here is an example. Of course, you would need different values for mtuser, mtuserpass and channel.
mtuser = "joe"                   # your minetest username
mtuserpass = "mysecretpassword"  # your minetest password. This file is not encrypted so don't use anything you want kept secret. Can't have spaces in it

# The following must match your settings in minetest server > Settings > Advanced Settings > Mods > irc > Basic >
ircserver = "irc.rizon.net"  # same as IRC server
mtbotnick = "mtserver"       # same as Bot nickname
channel = "##minetest3214"   # same as Channel to join
  1. Save this file and you are ready to do the course.
Categories: CoderDojo, Minetest