In this series we’ll be working on a 3D game, Slugrace 3D, where players will put bets on racing slugs. Now that we know what we want to do, the question is: how to do it and what software to use? We will need a minimum of two things: the Panda3D game engine and a text editor or IDE where we can edit our code. This is all we need for our environment setup. So, let’s start with installing Panda3D.
Table of Contents
Installing Panda3D
Let’s start the environment setup with Panda3D. There are a couple ways you can install Panda3D. Here I’m going to describe the two most common ones: using the installer and pip installation.
Panda3D installer
Panda3D is a 3D engine: a library of subroutines for 3D rendering and game development. The library is C++ with a set of Python bindings. Game development with Panda3D usually consists of writing a Python or C++ program that controls the Panda3D library.
Well, this is what you can read on panda3d.org, in the manual, not my words. So, I suggest you visit the website and read more about Panda3D if you’re interested and when you are ready, we can install Panda3D.
This may change, but at the time of writing this is what it looks like when you go to panda3d.org. Now click on Get the SDK:
If you’re on a Windows machine, like I am, you can get the installer here:
If you work on a different system, scroll down to find more installers. Anyway, download your installer and run it to install Panda3D.
pip installation
You can also install Panda3D using pip. This is very easy, just type the following command in your terminal:
pip install panda3d
and it will do the job for you. If you want, you can also specify the version of the engine that you want to install. At the time of writing this the current version is 1.10.6, so you could specify it like so:
pip install panda3d==1.10.6
This method can be used if you already have Python installed on your computer, which is very probable. If you don’t, using the installer would be more appropriate as it will install a Python interpreter as well.
Whichever method you choose, for the next steps I assume you have Panda3D installed on your system.
The Visual Studio Code Text Editor
The next thing we’re going to need for our environment setup is a text editor. I’m going to use Visual Studio Code. You can use any editor or IDE of your choice, but if you want to follow along and use the exact same editor as I do, just feel free to download and install it from their website (code.visualstudio.com). The installation is pretty straightforward.
Now, with Visual Studio Code installed, open it. Now, your Visual Studio Code editor will probably have a dark theme, with which it comes as a default. I like the light theme better, so I changed it in the settings, but you can choose any theme you like.
Extensions
In order to use Panda3D and Python in Visual Studio Code, we’ll need at least the Python extension. Click on Extensions (A) and then type in ‘python’ in the search box (B). Then install the first extension in the results list by clicking on the Install button. You can’t see the button here on the screenshot because the extension is already installed on my machine.
That’s it. You’re ready to start coding. In the next lecture we’ll write our first basic Panda3D app.
Here’s the video version of this article: