Home▸Society & Economics▸Opinion Dynamics (2D)

💬 Opinion Dynamics (2D): Deffuant Bounded-Confidence Model

2D Deffuant bounded-confidence opinion model: agents only sway each other when their opinions are already close, shifting by a fraction μ of their gap. Watch echo chambers, polarisation and consensus emerge from a live scatter, timeline and distribution histogram.

Society & Economics2DEasy60 FPS📱 Mobile-adapted⇄ 3D version
2d-opinion-dynamics ↗ Open standalone

A flat 2D canvas rendition of the Deffuant bounded-confidence model: every interaction, two randomly chosen agents shift toward each other by a fraction μ of their opinion gap, but only when that gap is already below the confidence threshold ε — agents who disagree too strongly simply ignore each other, exactly as in the 3D version. Watch the population collapse into consensus, split into a handful of stable clusters, or fragment into isolated echo chambers as you move the sliders.

🔬 What It Demonstrates

Each of N agents holds a continuous opinion in [0, 1]. Every step, two agents are picked at random; if their opinions differ by less than ε, both move toward each other by μ of the difference. This simple local rule alone produces global patterns — consensus, polarisation into a few camps, or many fragmented echo chambers — purely as a function of how tolerant (ε) and persuadable (μ) agents are.

🎮 How to Use

Drag Confidence ε to control how open-minded agents are — small ε locks people into echo chambers, large ε pulls everyone toward one shared view. Convergence μ sets how far agents jump toward each other per interaction. Media bias adds a persistent nudge toward one extreme. Switch between the Scatter view (agents as coloured dots with links between close opinions) and the Timeline view (each agent's opinion traced over iterations), and use Reset, Pause and Step ×100 to control the run.

💡 Did You Know?

The number of opinion clusters this model settles into follows the rule of thumb clusters ≈ 1 / (2ε), a pattern documented since Guillaume Deffuant and colleagues first published the model in 2000 — one of the most cited tools for explaining why some societies polarise into rigid camps while others reach broad consensus.

About Opinion Dynamics (2D)

This is a plain 2D canvas rendition of the Deffuant model, one of the classic agent-based models of opinion formation, computed directly with array operations and drawn with the 2D canvas path API rather than a GPU-instanced mesh. Each of N agents holds a real-valued opinion between 0 and 1. At every step two agents are picked at random and, only if their opinions are within the confidence threshold ε, both move toward each other by a fraction μ of their difference.

Small ε values keep agents talking only to like-minded peers, producing echo chambers and polarisation; large ε values let everyone influence everyone, producing global consensus. An optional media bias term adds a constant external nudge on the randomly picked agent toward 0.15 or 0.85 every step, modelling the steady influence of a one-sided broadcaster or a recommendation algorithm. Live readouts track the number of opinion clusters (counted by sorting opinions and finding gaps larger than roughly 1.1×ε), the total iteration count, the maximum opinion spread, and whether the population has converged.

Frequently Asked Questions

How is this different from the 3D version?

Both run the identical Deffuant bounded-confidence update: two random agents shift toward each other by a fraction μ of their opinion gap, but only when that gap is already below the confidence threshold ε. The 3D version renders agents as an instanced WebGL mesh with GPU line segments for links; this version draws the same agents as circles on a plain 2D canvas with a scrolling timeline and a distribution histogram. The dynamics, not just the rendering, are the same.

Why does a small confidence threshold create echo chambers?

When ε is small, agents only interact with others whose opinions are already close to their own. Pairs that start far apart never cross that threshold, so they never converge, and the population splinters into separated opinion clusters that no longer influence each other.

What does the media bias slider do?

A non-zero media bias nudges the randomly picked agent's opinion, every interaction, a little toward 0.15 (negative bias) or 0.85 (positive bias), independent of the normal peer-to-peer rule. It models a broadcaster or recommendation algorithm that consistently favours one side.

How is the number of opinion clusters predicted?

Analysis of the Deffuant model shows the equilibrium cluster count is approximately 1 divided by 2ε. A confidence threshold of ε = 0.25 predicts around 2 clusters, while ε = 0.1 predicts around 5. The live "Clusters" statistic counts groups by sorting all current opinions and counting gaps larger than roughly 1.1×ε.

What is the difference between the scatter and timeline layouts?

The scatter layout places every agent at a fixed random position and colours each dot by its current opinion, drawing faint links between agents close enough to influence one another. The timeline layout plots each agent's opinion as it evolves over successive iterations, making it easier to watch trajectories converge, oscillate, or get pulled toward a media-bias target over time.

⚙ Under the hood

2D Deffuant bounded-confidence opinion model: agents only sway each other when their opinions are already close. Watch echo chambers, polarisation and consensus emerge from a live scatter, timeline and distribution histogram.

opinion dynamicsdeffuant modelbounded confidenceecho chamberspolarisationconsensusagent-based model

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)