Get started with deep reinforcement learning by training agents to play Volleyball.


If you’re new to reinforcement learning (RL), there’s some great introductory courses out there. Just to name a few:

But if you’re anything like me, you might prefer a ‘learning by doing’ approach. With hands-on experience upfront, it may be easier for you to grasp the theory and math behind the algorithms later.

In this series, I’ll walk you through how to use Unity ML-Agents to build a volleyball environment and train agents to play in it using deep RL. For a…

Train reinforcement learning agents to play Volleyball

Image by Author

Inspired by Slime Volleyball Gym, I built a 3D Volleyball environment for training reinforcement learning agents using Unity’s ML-Agents toolkit. The full project is open-source and available at: 🏐 Ultimate Volleyball.

In this article, I share an overview of the implementation details, challenges, and learnings from designing the environment to training an agent in it. For a background on ML-Agents, please check out my Introduction to ML-Agents article.

Versions used: Release 18 (June 9, 2021)
Python package: 0.27.0
Unity package: 2.1.0

🥅 Setting up the court

Having no previous experience with game design or 3D modeling, I found Unity’s wide library of free assets and…

What we’re building over at Coder One to make AI/ML more accessible to all. Launching late 2021.

In March 2016, DeepMind’s AlphaGo beat Lee Sedol 4–1 in a televised match viewed by over 200 million people. There was a global shortage in Go boards, and AlphaGo’s victory is seen as a landmark moment for artificial intelligence.

Shortly after in April, OpenAI launched its Gym toolkit to help researchers develop and benchmark reinforcement learning algorithms. Reinforcement learning was a key technique used in the training of AlphaGo, along with deep learning.

Today, interest in artificial intelligence and machine learning is at an all-time high.

These aren’t your average data science competitions.

Photo by Marko Blažević on Unsplash

AI game competitions are also known as AI programming competitions or bot programming competitions. They’re different from your average data science competition. In an AI game competition, you aren’t given a data set. Instead, you get a game or simulation and your job is to program an agent that can compete in it (sometimes head-to-head against other players’ agents).

They can be a great place to practice programming, algorithms, and AI/ML. The competitions vary widely in their difficulty, prizes, languages available, and feasible strategies. …

A step-by-step walkthrough on how to add reinforcement learning agents to an environment in Unity.

This article is part 3 of the series ‘A hands-on introduction to deep reinforcement learning using Unity ML-Agents’. It’s also suitable for anyone new to Unity interested in using ML-Agents for their own reinforcement learning project.


Recap and overview

In part 2, we built a 3D physics-based volleyball environment in Unity. …

An introductory tutorial on how to build a physics-based 3D volleyball environment for reinforcement learning.

This article is part 2 of the series ‘A hands-on introduction to deep reinforcement learning using Unity ML-Agents’. It’s also suitable for anyone new to Unity interested in using ML-Agents for their own reinforcement learning project.


Part 1: Getting started with Unity ML-Agents
Part 2: Building a volleyball reinforcement learning environment (this post)
Part 3: Design reinforcement learning agents using Unity ML-Agents
Part 4: Training an agent using PPO (Coming soon)

Recap and overview

In my previous post, I went over how to set up ML-Agents and train an agent.

In this article, I’ll walk through how to build a 3D physics-based volleyball…

Looking for a place to ask questions, share projects, or join discussions on the latest in AI/ML and data science?

Photo by Leon on Unsplash

Whether you’re a beginner or veteran in machine learning and data science, you might be interested in a place to ask questions, share projects, or join discussions on the latest developments.

There are many great communities out there for this, but it can be difficult to choose which one (and some may no longer be active or well-maintained).

To help you, I’ve compiled an up-to-date list of 20+ active machine learning and data science communities grouped by platform.

1. Reddit

Reddit is a powerhouse for many active forums dedicated to all areas across AI, machine learning, and data science.

Here’s a list:

Getting started with Unity ML-Agents and training an agent to push around blocks.

In this tutorial, you’ll learn how to get set up with Unity’s ML-Agents toolkit and train your own agent using reinforcement learning. No previous experience with Unity will be needed.

What’s Unity ML-Agents?

ML-Agents is an add-on for the existing Unity platform. It provides researchers and game developers with the ability to build complex 3D environments and train intelligent agents in them — all while leveraging the powerful Unity engine and UI.

Build an agent in Python that uses the A* pathfinding algorithm to find treasure.

This is part 3 of a series on bot programming originally published on the Coder One blog.
Part 1:
Getting started with the game environment
Part 2:
Creating our first agent

The A* pathfinding (or A* search) algorithm is a popular technique for finding the shortest path between two points in an environment.

In this tutorial, we’ll implement an A* pathfinding algorithm in Python to help our agent navigate to a target destination in the Dungeons and Data Structures environment. Make sure you check out Part 1 to get set up (and optionally Part 2 to create a simple bot).

The shortest path

In this tutorial series, we’ll build a bot in Python that can play in a Bomberman-inspired game called Dungeons and Data Structures. We’ll start off simple, and add advanced strategies in the later parts of the series.

Photo by Lorenzo Herrera on Unsplash


Make sure you check out part 1 of this bot programming tutorial series first. So far we’ve covered:

  • Setting up the game environment Dungeons and Data Structures
  • Working with a starter Python agent that makes random moves
  • Getting familiar with the game environment’s objects and methods

In part 2, we’ll show you how to build a simple agent called the ‘Wanderer Agent’ that implements some scripted logic to explore and navigate the world. More specifically, it:

  1. Looks at its immediate surroundings
  2. Checks which directions are valid ones to move in
  3. Chooses a random valid direction to take

If you’re more…

Joy Zhang

Building Coder One: sandbox environments and competitions for machine learning (

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store