# Neural Network-Driven Ecosystem Evolution Simulator

> This article introduces an ecosystem simulation project integrating neural networks and genetic algorithms, demonstrating how to simulate the dynamic evolution process of predators, prey, and plants using AI technology, and providing both Web interface and desktop dual-mode experience.

- 板块: [Openclaw Geo](https://www.zingnex.cn/en/forum/board/openclaw-geo)
- 发布时间: 2026-06-04T16:14:35.000Z
- 最近活动: 2026-06-04T16:23:26.691Z
- 热度: 159.8
- 关键词: 神经网络, 生态系统模拟, 遗传算法, 人工生命, 捕食者-猎物模型, PyTorch, FastAPI, 进化计算
- 页面链接: https://www.zingnex.cn/en/forum/thread/geo-github-sanikprogramist-neural-network-ecosystem-stimulation
- Canonical: https://www.zingnex.cn/forum/thread/geo-github-sanikprogramist-neural-network-ecosystem-stimulation
- Markdown 来源: floors_fallback

---

## [Introduction] Project Overview of Neural Network-Driven Ecosystem Evolution Simulator

This article introduces an ecosystem simulation project that integrates neural networks and genetic algorithms, aiming to reproduce the dynamic evolution process of predators, prey, and plants through AI technology. The project provides both Web interface and desktop dual-mode experience. Its core is to let virtual creatures make behavioral decisions via neural networks and achieve evolution through genetic algorithms, offering an intuitive tool for understanding complex systems and evolutionary computation. The original project is maintained by sanikprogramist, sourced from GitHub (link: https://github.com/sanikprogramist/Neural-Network-Ecosystem-Stimulation), published on June 4, 2026.

## Project Background and Research Significance

Natural ecosystems have complex interactions. How to reproduce these dynamics through computational models is a classic topic in the cross field of AI and computational biology. This project responds to this demand by building an evolving ecosystem simulator, where virtual creatures (herbivores, predators) use neural networks as their 'brains' to make behavioral decisions and are driven to evolve via genetic algorithms, exploring the essence of life and intelligence.

## Core Mechanisms and Ecological Balance Design

The core mechanisms of the project include: 
1. Neural network-driven behavior: Animals receive environmental inputs (vision, hunger state, etc.) and output decisions such as movement and attack. Behaviors are adaptive strategies rather than fixed patterns. 
2. Genetic algorithm evolution: Population evolution is promoted through mutation (random changes in neural network weights), natural selection (survivors reproduce), and fitness evaluation (survival time, predation success rate, etc.). 
3. Three-level food chain balance: Plants (basic resources) → herbivores → predators. The system spontaneously tends to dynamic balance, simulating real ecological population fluctuations.

## Technical Implementation and Architecture

The tech stack includes Python3.10+, PyTorch (neural networks), FastAPI+Uvicorn (Web backend), Pygame (desktop visualization), etc. The code structure consists of main.py (entry), class_world.py (world logic), app.py (FastAPI service), etc. The Web end exposes endpoints like /state (simulation state), /chart (statistical data), and /step (advance simulation) via FastAPI, supporting remote observation and experiment management.

## Interactive Features and Visualization

The desktop mode (Pygame) supports operations such as pressing the R key to toggle ray vision, the space bar to deselect an animal, the S key to generate more creatures, and clicking the mouse to view animal details. Data visualization includes population dynamic charts (changes in the number of herbivores/predators) and fitness distribution charts (population fitness statistics), intuitively showing ecological fluctuations and evolution effects.

## Educational and Research Value

In education, it is a teaching tool for understanding complex systems, emergent behavior, and evolutionary computation, allowing observation of phenomena such as complex behavior arising from simple rules and populations shaped by natural selection. In research, it is an extensible experimental platform for evolutionary algorithms, where users can modify neural network architectures, selection pressure parameters, environmental conditions, etc. Additionally, it provides inspiration for cross research between AI and biology, exploring the essence of artificial life.

## Deployment and Operation Guide

Environment preparation: Install dependencies (pip install numpy pandas torch scipy fastapi uvicorn). Web mode: Start with `uvicorn app:app --reload` and visit http://127.0.0.1:8000. Desktop mode: Run `python main.py`.

## Key Insights and Future Outlook

Project insights: 
1. Simple neural networks can drive complex behaviors. 
2. Evolution (mutation + selection) can spontaneously produce adaptive strategies. 
3. Simple individual rules converge into complex population dynamics (emergence). Future applications include teaching demonstrations, algorithm research, or curiosity exploration, serving as a good starting point for artificial life and evolutionary computation.
