---
title: "2D raycasting vision simulator"
url: "https://tristan-kennedy.com/index/2d-raycasting/"
description: "A light, some walls, and a title that casts a shadow. Every frame it sends out rays and works out what it can see."
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://tristan-kennedy.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

[$ cd ..](https://tristan-kennedy.com/index/) 2026-03 experiment code

# 2D raycasting vision simulator vision simulator

rays

550

show rays reset walls

Move your mouse over it, or leave it alone and watch the light wander. Drag the grey bars to change the room. On a phone, tap where you want the light to go.

Every frame the light sends out rays in all directions. Each one stops at the first thing it hits, and whatever the rays reached is what the light can see. A lot of games decide what a guard notices, how far a flashlight reaches, and where the fog of war lifts this same way.

Nothing here is really being lit. It’s a list of distances that happens to look like a shadow.

Slide the rays down and the edges go blocky. Slide them up and they go smooth, and it costs more. A game has to pay that for every light and every enemy at once, so the slider is really a budget.

[$ cd ..](https://tristan-kennedy.com/index/)
