[KongchangAI]
· 2 min read· 1,134 words

Neuroevolution AI Plays Super Mario, Outperforms Human Players

Neuroevolution AI Plays Super Mario, Outperforms Human Players

Open-source project uses neuroevolution to train AI to play 3D Super Mario, surpassing human level with 3D visualization.

The article introduces an open-source project that uses neuroevolution to train AI to play 3D Super Mario. Neuroevolution does not rely on gradient descent; instead, it maintains a population of neural networks, lets each individual try the game, and uses level progress and score as fitness for selection, crossover, and mutation, eliminating poor strategies generation by generation. Ultimately, the AI can perform consecutive jumps, avoid enemies, and land precisely, with movement approaching or even exceeding that of an average human. The project's biggest highlight is an interactive 3D visualization that allows rotating and zooming the network structure and observing changes in weights and activations between the input, hidden, and output layers during training—for example, when facing a cliff, the jump output strengthens. The article also analyzes neuroevolution's advantages of simple implementation and easy parallelism, as well as its limitations of lower training efficiency than gradient-based reinforcement learning and slow convergence with high-dimensional inputs, and points out its potential applications in robot control, game testing, and other scenarios.

Neuroevolution is a method of training neural networks using evolutionary algorithms. A recent open-source project demonstrated how this approach works in the 3D environment of Super Mario: the AI not only learned to complete levels, but even outperformed human players. The project also provides an interactive 3D visualization that allows you to directly observe the neural network's internal decision-making process.

How Neuroevolution Teaches AI to Play Mario

Traditional reinforcement learning relies on gradient descent and reward signals to update network parameters, but neuroevolution takes a different path: it maintains a population of neural networks, lets each individual play through the game once, and then performs selection, crossover, and mutation based on scores, eliminating poor-performing strategies generation by generation.

This is exactly the core logic of the project. Each generation of networks plays in the 3D Mario environment, with fitness determined by level progress and score. High-performing networks are retained and produce offspring, and after several generations of iteration, the overall level of the population rises rapidly. Compared to gradient-based methods, neuroevolution does not require a differentiable environment model and is more robust to sparse rewards and long-sequence decision-making, which is why it is well-suited for platformer games.

According to discussions in the Reddit community, the project's demo video shows that the AI can perform consecutive jumps, avoid enemies, and land precisely, with movement smoothness approaching or even exceeding that of an average human player.

Selection, Crossover, and Mutation in Neuroevolution

These three operations correspond to the core loop of evolutionary algorithms. Selection picks parents from the population based on fitness—common strategies include tournament selection and roulette wheel selection—with the goal of making it more likely for the genes of high-fitness individuals to be passed on. Crossover exchanges and combines the weights or topological structures of two parent networks in some manner, producing offspring that carry traits from both parents. Mutation, meanwhile, perturbs weight values or adds/removes connections with a small probability, injecting diversity into the population and preventing premature convergence to a local optimum. Working together, the three maintain a balance between "exploiting existing good solutions" and "exploring new solutions."

Sparse Rewards and Differentiable Environment Models

Sparse rewards mean that the agent only receives feedback when it completes a key objective (such as clearing a level or collecting an item), with almost no signal in intermediate steps, making it difficult for gradient-based methods to determine which action is worth reinforcing. A differentiable environment model requires that the environment's state transitions can be described by differentiable functions, so that gradients can be backpropagated from rewards to network parameters. In platformer games, when a character lands or whether it hits an enemy is often determined by discrete collision detection—the environment itself is not differentiable, which is precisely where neuroevolution's advantage lies: it does not need environment gradients and relies only on the final score.

3D Visualization: Opening the Neural Network's "Black Box"

The most appealing part of the project is the interactive 3D neural network visualization. Players can rotate and zoom the network structure and observe how the connection weights between the input layer (game screen features), hidden layers, and output layer (actions such as movement and jumping) change with training.

This kind of visualization is very valuable for understanding the evolutionary process. You can see which neurons are activated in specific scenarios—for example, when facing a cliff, the jump output is noticeably strengthened. For teaching and debugging, this is far more intuitive than simply looking at score curves.

Connection Weights and Neuron Activation

Connection weights are learnable numerical values between neurons in adjacent layers of a neural network, determining the strength of influence a neuron's output has on the next layer; neuron activation is the output value after input data is weighted and summed and passed through a nonlinear function. Visualization tools draw weights as line thickness or color intensity and map activation values to node brightness. As a result, observers can intuitively see: when facing a cliff scene, the output node controlling jumping and its upstream neurons become noticeably brighter, indicating that the network has learned to associate specific visual features with actions.

The Strengths and Limits of Neuroevolution

Neuroevolution is not new to the game AI field, but in recent years, with the combination of 3D environments and visualization tools, its practicality and interpretability have both improved. Its advantages lie in being simple to implement and easy to parallelize—each individual in the population can run independently, making it naturally suited for multi-core or distributed training.

Its limitations are equally obvious: training efficiency is usually lower than gradient-based reinforcement learning, and with high-dimensional inputs, the required population size is large and convergence is slow. The project performs impressively in games like Super Mario where the state space is relatively manageable, but transferring it to more complex open-world tasks still needs verification.

According to the project repository, both the code and visualization tools are open source, and interested developers can reproduce the training process themselves and adjust the evolutionary parameters.

Implications for Game AI and Broader Scenarios

The significance of this project goes beyond "AI playing games." Neuroevolution demonstrates a learning path that does not rely on backpropagation, with potential applications in robot control, automated game testing, level design assistance, and other scenarios. The interactive visualization lowers the barrier to understanding, allowing more people to intuitively experience how evolutionary algorithms work.

Judging from community feedback, projects like this often inspire developers to try things out for themselves. If you are interested in evolutionary algorithms or game AI, this repository is a good starting point: the environment is clear, the feedback is intuitive, and the visualization is well done.

One-line Summary

An open-source project uses neuroevolution to train AI to play 3D Super Mario, surpassing human level and including 3D visualization.

Paragraph Summary

The article introduces an open-source project that uses neuroevolution to train AI to play 3D Super Mario. Neuroevolution does not rely on gradient descent; instead, it maintains a population of neural networks, lets each individual try the game, and uses level progress and score as fitness for selection, crossover, and mutation, eliminating poor strategies generation by generation. Ultimately, the AI can perform consecutive jumps, avoid enemies, and land precisely, with movement approaching or even exceeding that of an average human. The project's biggest highlight is an interactive 3D visualization that allows rotating and zooming the network structure and observing changes in weights and activations between the input, hidden, and output layers during training—for example, when facing a cliff, the jump output strengthens. The article also analyzes neuroevolution's advantages of simple implementation and easy parallelism, as well as its limitations of lower training efficiency than gradient-based reinforcement learning and slow convergence with high-dimensional inputs, and points out its potential applications in robot control, game testing, and other scenarios.

#neuroevolution#Super Mario#game AI#3D visualization#neural network#evolutionary algorithm
Share:

Related articles