From 8e7fdc43a3eb5c4f6b5de7364cf1e4e9a34858ab Mon Sep 17 00:00:00 2001 From: mikebarkmin <2592379+mikebarkmin@users.noreply.github.com> Date: Tue, 21 Jul 2026 21:52:53 +0000 Subject: [PATCH] chore: release v5.0.1 --- .changeset/faster-many-sprites.md | 23 ----------------------- CHANGELOG.md | 27 ++++++++++++++++++++++++++- pom.xml | 2 +- 3 files changed, 27 insertions(+), 25 deletions(-) delete mode 100644 .changeset/faster-many-sprites.md diff --git a/.changeset/faster-many-sprites.md b/.changeset/faster-many-sprites.md deleted file mode 100644 index e44da023..00000000 --- a/.changeset/faster-many-sprites.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -type: patch ---- - -Make stages with hundreds of sprites run at a usable frame rate. - -Four things were costing more than they had to, all of them growing with the -number of sprites: - -- Every sprite's costume ended its draw with `resetShader()`, which flushes the - renderer. That turned what could be a few batched draw calls into one per - sprite. The shader is now only reset when one was actually set. -- `getHitbox()` rebuilt the sprite's collision shape from scratch on every call, - and collision checks call it once per pair - so a stage with 200 sprites built - 40,000 shapes a frame. A sprite that has not moved, turned, resized or changed - costume now reuses the shape it had. -- `Shape.intersects` compared two outlines by building a `java.awt.geom.Area` for - each. Sprite hitboxes are convex, so they are now compared with separating - axes instead, which gives the same answer about 30x faster. -- Building a `Polygon` from a list of corners rebuilt its path once per corner. - -A benchmark of 200 sprites moving, bouncing off the edges and checking collisions -against each other every frame went from 96ms per frame to 25ms. diff --git a/CHANGELOG.md b/CHANGELOG.md index c00ae6c9..d162fe44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,34 @@ --- name: Changelog -index: 66 +index: 62 lang: en --- +## 5.0.1 + + + +Make stages with hundreds of sprites run at a usable frame rate. + +Four things were costing more than they had to, all of them growing with the +number of sprites: + +- Every sprite's costume ended its draw with `resetShader()`, which flushes the + renderer. That turned what could be a few batched draw calls into one per + sprite. The shader is now only reset when one was actually set. +- `getHitbox()` rebuilt the sprite's collision shape from scratch on every call, + and collision checks call it once per pair - so a stage with 200 sprites built + 40,000 shapes a frame. A sprite that has not moved, turned, resized or changed + costume now reuses the shape it had. +- `Shape.intersects` compared two outlines by building a `java.awt.geom.Area` for + each. Sprite hitboxes are convex, so they are now compared with separating + axes instead, which gives the same answer about 30x faster. +- Building a `Polygon` from a list of corners rebuilt its path once per corner. + +A benchmark of 200 sprites moving, bouncing off the edges and checking collisions +against each other every frame went from 96ms per frame to 25ms. + + ## 5.0.0 diff --git a/pom.xml b/pom.xml index 72b5a815..3e9b9ce9 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.openpatch scratch - 5.0.0 + 5.0.1 jar Scratch for Java