Logo
Overview

Three-MLAgents: Unity ML-Agents for Three.js

November 23, 2025
1 min read

Overview

Browser-based reinforcement learning framework porting Unity ML-Agents architecture to Three.js. Enables RL agent training and deployment in WebGL environments.

Architecture

Agent-Environment Interface

Replicates Unity ML-Agents API in JavaScript:

  • Observation collection
  • Action application
  • Reward processing
  • Episode management

Training Pipeline

  • Policy networks in TensorFlow.js
  • Browser-based training option
  • Server-side training with model export
  • Policy deployment to browser

Three.js Integration

ML-Agents concepts adapted to Three.js scene graph:

  • Agent entities as Three.js objects
  • Physics-based environments
  • Sensor raycasting
  • Action space mapping

Use Cases

Browser-Based Robotics Simulation

Train manipulation and navigation policies directly in browser. No installation required for distributed training or demonstration.

Game AI Development

Rapid prototyping of game AI behaviors with visual feedback. Immediate deployment to web-based games.

Educational Applications

Accessible RL training platform requiring only web browser. Visual feedback aids understanding of policy learning dynamics.

Technical Features

  • TensorFlow.js backend
  • WebGL rendering via Three.js
  • PPO, SAC algorithm support
  • Model serialization for deployment
  • Multi-agent environments

Performance

CPU training viable for simple environments. GPU acceleration via WebGL enables training of visual policies in browser.

Deployment

Trained policies bundle with Three.js application for zero-dependency web deployment. Models run entirely client-side.

GitHub Repository