Add light playground - #1043
Merged
Merged
Conversation
Four scenes, one per kind of 3D light, so each can be looked at on its own: the scene's directional light and its shadows, three coloured point lights at night, two spot lights aimed at the ground, and twenty-four point lights at once - more than a device should light in one frame. Its gameplay tests read the lights back out of the renderer rather than trusting the look: that each kind arrives as the right kind of light, that it keeps the colour it was given, that it casts a shadow, and - in the crowded scene - that the number of lights of each kind stays the same while lights move, which is what keeps the renderer from compiling a new shader mid-game. Each test also takes screenshots, so a change in how lighting looks shows up as a change in the pictures. Two things the tests pinned down while being written, both noted in the README because they are easy to trip over: - A light's colour, intensity and range belong to the object, not the instance: GDevelop reads only `animation` from an instance's properties for an events-based object, so per-instance overrides are silently ignored. Three colours means three objects. The first version of the point light test placed one object three times and failed with three white lights, which is how this was found. - A spot light shines along its own +X axis, so it needs a Y rotation of 90 to point at the ground. Without it the cones shine off sideways and the scene looks almost unlit. The runner's download directory is also added to .gitignore: it holds the GDevelop build it fetches, which is hundreds of megabytes.
The crowded scene held twenty-four point lights, and its test passed with
the light budget both before and after being fixed - so it guarded
nothing. Two reasons, both now addressed:
A single kind of light is pinned to the cap by any budget, shared or per
kind, so the counts never moved. The scene now mixes point and spot
lights (26 lights, two kinds three.js counts separately), which is the
shape where a shared budget keeps the total pinned while letting the
split drift.
And moving one light at a time barely perturbs the distance ordering. The
test now sweeps the camera across the field, the way a player would,
which reshuffles which lights are nearest entirely.
Checked against both versions of the extension, same project, same run:
v1.0.2 three splits seen - 11/9, 10/10, 11/9 point/spot with
differing shadow counts - 20 of 26 lights lit FAILS
v1.2.1 one split - 14/12 with 4 shadows - 26 of 26 lit PASSES
The assertion is on the counts holding still, not on how many lights are
lit: lighting more of them is an intended consequence of budgeting per
kind, not a defect, so the test reports it rather than requiring it.
The scene dropped the spot lights that project a texture, which would
have been a third kind. Setting that resource property in the object's
content does not reach the property getter at runtime - `_getImage()`
comes back empty while Color and Intensity from the same content arrive
fine - so it could not be set up declaratively here. Not needed to
reproduce the drift, so it is left out.
Contributor
Preview the game(s) changed or added in this Pull RequestThis is an automatic message displaying links to the games in this PR - double check the JSON in case of doubt. |
A new "Crowded Point Lights" scene places eight shadow casting point lights and nothing else, so one kind holds the whole device budget. Its test pins what that scene may lose: all eight lit, at least three casting a shadow - three being the floor across conforming WebGL2 devices - and both counts holding still while the camera sweeps. Note that this assertion cannot fail on hardware reporting 32 fragment texture units, which is what the CI runner has: there the budget never binds below the four casters the game asks for, whether it is split per used kind or three ways. It fails on a device reporting 16, where splitting three ways leaves two. Also correct the mixed scene's description: its spot lights have no projected texture, so it exercises two kinds the shaders count separately, not three. Light3D is synced to 1.3.0, which is what makes the new test pass on a 16 texture unit device. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011chSAxDN9jSEwWkowwzDBm
The previous commit's message says 1.3.0; the extension stays on 1.0.3, since the budget change is a fix to what that version already does rather than a new feature series. Only the version string differs, so the five gameplay tests pass unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011chSAxDN9jSEwWkowwzDBm
Picks up the extension fixes: the three.js renderer is read anew on every budget recomputation instead of being captured once, lists are trimmed when a newly seen light kind shrinks the budget mid frame, and the two "max lights" expressions now say that their limit is per light kind and can be lowered by the device. All five gameplay tests still pass, with the same counts as before: 14 point and 12 spot lights lit with 4 casting a shadow in the mixed scene, and 8 point lights with 4 casting a shadow in the single kind scene. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011chSAxDN9jSEwWkowwzDBm
4ian
marked this pull request as ready for review
August 23, 2026 16:45
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.
No description provided.