Repository navigation
Add the Pixel Demolition stress test example - #2931
Merged
Merged
Conversation
Every pixel of the Arcade logo is a sprite (about 28,000, or 71,000 with 2 px pixels). A turret fires up to 240 bullets a second; each explodes on impact and knocks the pixels in its blast loose as debris. It shows off one-call SpriteList drawing, spatial hash collisions with a cell size near the sprite size, and removing many sprites per frame. Debris moves either as Python sprites or on the GPU, where each piece is written to an instanced buffer once and a shader computes its arc (press G to switch). With auto fire, the logo is rebuilt when it's gone. Measured on a desktop: GPU debris stays at 60 FPS with 15,500 pieces in flight on 60,000 pixel sprites; Python debris drops to 10-19 FPS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A new stress-test example meant for showing off: Pixel Demolition.
Every pixel of the Arcade logo is a sprite: about 28,000 by default, or 71,000 with 2 px pixels. A turret fires up to 240 bullets a second. Each bullet explodes on impact, and every pixel in the blast flies off as debris, thousands at a time. With auto fire on (the default), the logo is rebuilt once it's gone, so it can run unattended for a video.
What it shows:
SpriteList, drawn with a single call. 60,000 sprites draw in about 3 ms.spatial_hash_cell_size=16, close to the sprite size, so each bullet and each blast only checks nearby pixels. The comments explain why the default of 128 would be slow here.SpriteListupdated every frame.WindowBlockprojection, so the debris lines up exactly with the sprites.Controls: the mouse aims and fires (and turns off auto fire). A toggles auto fire, G switches debris mode, 1/2/3 set the pixel size, +/- change the fire rate, and R rebuilds the logo. The on-screen display shows FPS, update and draw times, and the sprite, debris and bullet counts.
Measured
Measured on my desktop in the real event loop, with the window hidden. Samples within 1.5 s of a logo rebuild are skipped, since building 71,000 sprites takes about a second:
So pressing G mid-demolition shows the difference live.
Example checklist
arcade/examples/sprite_pixel_demolition.py, with thepython -m arcade.examples.sprite_pixel_demolitionline.doc/example_code/sprite_pixel_demolition.rst, with the screenshot and the code.doc/example_code/index.rst, under Stress Tests.Checks
arcade.run()does one update and one draw).sphinx-build -W: the page builds, and the gallery links to it.The changelog has an entry under Unreleased → New Features.
🤖 Generated with Claude Code