DEV Community

Cover image for From Lab to Code #07 — Building an Interactive Network Simulation Playground
Ertugrul
Ertugrul

Posted on

From Lab to Code #07 — Building an Interactive Network Simulation Playground

Understanding how computer networks behave is one thing. Actually watching packets move through a network, observing congestion, and seeing routing protocols respond to failures is something entirely different.

For the seventh project in my From Lab to Code series, I built an interactive network simulation playground inspired by my Computer Engineering laboratory experiments at RWTH Aachen University.

The goal was to transform theoretical networking concepts into an interactive, reproducible, and accessible software environment.

Introducing Network Simulation Playground

Network Simulation Playground is an open-source educational environment for exploring computer networks, transport protocols, wireless communication, routing, mobility, and Quality of Service (QoS).

Instead of working exclusively with terminal outputs and static performance tables, users can configure network scenarios, execute simulations, and visually explore how network behavior changes over time.

The application combines a lightweight Python-based simulation engine with an interactive browser interface.

Five Interactive Simulation Modules

1. TCP/UDP Bottleneck Simulation

What happens when multiple traffic flows compete for limited bandwidth?

This module explores:

  • TCP congestion control
  • UDP traffic behavior
  • Network bottlenecks
  • Bandwidth allocation
  • Packet loss
  • Throughput and traffic fairness

Users can modify network parameters and observe how different transport protocols respond to congestion.

2. Wireless Channel Simulation

Wireless communication introduces additional challenges that are not present in conventional wired networks.

This module explores the relationship between wireless channel allocation, shared transmission capacity, and network performance.

Users can compare different channel configurations and investigate how channel reuse affects throughput.

3. Routing and Network Failover

Networks are not static systems. Connections can fail, devices can become unavailable, and communication paths can change.

This module introduces controlled network failures and visualizes how routing behavior affects communication recovery.

It provides an interactive way to explore:

  • Link failures
  • Alternative communication paths
  • Routing recovery
  • Packet loss during network disruptions
  • Network resilience

4. Mobile Network Simulation

How does communication change when network devices are constantly moving?

The mobility module simulates dynamic network environments with up to 100 nodes in its predefined scenario.

Users can observe moving devices, changing network connectivity, and the impact of mobility on communication performance.

This provides an introduction to concepts relevant to mobile ad hoc networks, distributed robotic systems, and wireless communication infrastructures.

5. VoIP and Quality of Service

Not every application has the same network requirements.

Voice communication is particularly sensitive to latency, jitter, and packet loss.

This module demonstrates how background traffic and traffic prioritization affect communication quality through metrics such as:

  • End-to-end latency
  • Jitter
  • Packet loss
  • Estimated Mean Opinion Score (MOS)
  • Quality of Service

The objective is to understand why traffic management matters in real-time communication systems.

Making Network Behavior Visible

One of my main priorities was to make the simulation results visually understandable.

The playground includes a Canvas-based animation system that replays events recorded by the simulation engine.

Rather than displaying only final statistics, the interface allows users to observe:

  • Animated packet transmission
  • Network congestion and packet drops
  • Dynamic routing behavior
  • Moving wireless nodes
  • Changing network connections
  • Time-dependent performance metrics

The replay system also supports playback controls, adjustable animation speed, and interactive timeline navigation.

These visualizations are based on recorded simulation events, with interpolated movement and adjusted visual timing to make network behavior easier to observe.

Technical Architecture

The project follows a lightweight, modular architecture:

  • Python — Simulation engine and experiment management
  • HTTP API — Communication between the simulation engine and frontend
  • HTML, CSS, and JavaScript — Interactive user interface
  • HTML5 Canvas — Network visualization and animation
  • JSON and CSV — Experiment results and data export
  • Python unittest — Automated testing
  • C++ / ns-3 — Additional native simulation example

The main application requires no external Python dependencies, Docker containers, or Node.js installation.

The built-in Python engine is intentionally designed as a simplified educational network model. It is not intended to replace research-grade network simulators such as ns-3. A separate C++ example is included for further experimentation with native ns-3 simulations.

Reproducibility and Experiment Analysis

Beyond visualization, the project focuses on reproducible experimentation.

Users can modify simulation parameters, compare different configurations, and export results for further analysis.

The project also includes automated tests covering simulation behavior, parameter validation, reproducibility, network failures, mobility, QoS, and API functionality.

Getting Started

Clone the repository:

git clone https://github.com/Ertugrulmutlu/from-lab-to-code.git
Enter fullscreen mode Exit fullscreen mode

Navigate to the project directory:

cd from-lab-to-code/07-network-simulation-playground
Enter fullscreen mode Exit fullscreen mode

Start the application:

python -m networklab --serve
Enter fullscreen mode Exit fullscreen mode

Open the following address in your browser:

http://127.0.0.1:8000
Enter fullscreen mode Exit fullscreen mode

Run the automated tests:

python -m unittest discover -s tests -v
Enter fullscreen mode Exit fullscreen mode

From Lab to Code

This project is the seventh installment in my ongoing From Lab to Code series, where I transform academic engineering concepts and laboratory experiences into independent open-source software projects.

The philosophy behind the series is simple:

Learn the theory. Build the system. Experiment with it. Share the results.

Previous projects have explored computer vision, spatial audio, robotics, neural network efficiency, real-time robot control, and SystemC architecture modeling.

This time, the focus is on understanding the communication systems that connect modern computing infrastructure.

Source Code

The project is open-source and available as part of the From Lab to Code repository.

GitHub: https://github.com/Ertugrulmutlu/from-lab-to-code

Feedback, suggestions, contributions, and discussions are always welcome.

Thanks for reading!

Top comments (0)