Skip to content

Use scattered models for the forests of the 3D GTA with a map - #1084

Merged
4ian merged 3 commits into
claude/trusting-brahmagupta-ntfn02-gta-terrainfrom
claude/stoic-archimedes-ovjmdi
Oct 14, 2026
Merged

4ian merged 3 commits into
claude/trusting-brahmagupta-ntfn02-gta-terrainfrom
claude/stoic-archimedes-ovjmdi

Conversation

@4ian

@4ian 4ian commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Replaces the 43 pine trees and 4 bushes of 3D GTA with a map (#1081, on which this is stacked), each a 3D model object, by three scattered models objects of the 3D terrain extension (GDevelopApp/GDevelop-extensions#2306): two pine forests and bushes. That's 247 trees and 152 bushes, drawn with GPU instancing.

The forests

  • The three objects cover the whole terrain with "Copies grow: only where painted". Their Edits property paints the forests: around the hill (between the turns of the road), behind the town, in groves around the farms and along the south of the map. It also erases a clearing at the lookout and the houses of the farms with the space in front of them.
  • They grow on the grass layer only and away from its borders, so there are no trees on roads or sidewalks. There are none on slopes steeper than 28° either. They follow the ground when it's sculpted.
  • The pines keep their collisions: "Trunk collisions" plus the 3D physics behavior (static, same layers as before), with the diameter of the old cylinders.
  • The town trees, street lights and buildings are unchanged. The README has a paragraph on the forests.

Before / after

Left: before (separate objects). Right: after (scattered models). Same cameras, 1280×720, full resolution screenshots of gameplay tests.

Hill
Farms
South-west
North

The forests are denser than the old scattered trees, so the hill and farms look wooded. Close up, a copy and the same model as an object have the same colors and shading. The screenshots were added and removed in two commits of this branch, so they don't stay in the example.

Draw calls (500 trees)

In a test spawning 500 pines as objects at the positions of 500 copies, with the same camera: 245 draw calls with scattered models vs 1525 with objects (shadows on), and 66 vs 1064 with shadows off. The average frame was 7.6 ms vs 22.1 ms with shadows, and 8.5 ms vs 14.9 ms without, in the software renderer of the tests.

Gameplay tests

Three new tests, added to the four of the example (all 7 pass locally with GDevelop master, in 0.3 to 15 s each):

  • The forests grow on the ground, away from roads and cliffs: every copy stands on the terrain, none on asphalt or concrete, none steeper than the maximum slope. The copies are the same after restarting the scene (exact counts: 156, 91 and 152). A tree follows the ground when it's raised. A forest spawned outside the terrain stands at its own Z.
  • Trees stop boxes pushed against them, and can be cut: a physics box pushed against a trunk stays in front of it. Once the tree is erased (at the position of the nearest copy), the box goes through.
  • Trees are added and erased with the brushes of the scene editor: the test uses a stand-in for the editor. Erasing removes the trees under the brush and saves the painted data, undo brings them back, and the saved data gives back the erased forest.

Not checked

  • I couldn't run the database build (it needs a built GDevelop core). The resources are unchanged: the tree and bush models are now used by the scattered models.
  • I haven't played it in the editor or on a phone.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BJr8NHQoc1VdQ5fSM9TPzT


Generated by Claude Code

The 43 pine trees and 4 bushes, each an object, become three "scattered
models" objects of the 3D terrain extension (two pine forests and
bushes): 247 trees and 152 bushes drawn with GPU instancing. They grow
on the grass layer, away from roads, houses and slopes steeper than 28°,
in areas given by their Edits property: around the hill, behind the
town and in groves around the farms. Trees keep their cylinder
collisions as trunk collisions of the 3D physics behavior.

Three gameplay tests are added:
- The forests grow on the ground, away from roads and cliffs (and the
  copies are the same after a restart, follow the raised ground, and
  stand at the object Z where there is no terrain).
- Trees stop boxes pushed against them, and can be cut.
- Trees are added and erased with the brushes of the scene editor.

The 3D terrain extension is updated with the scattered models object.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BJr8NHQoc1VdQ5fSM9TPzT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BJr8NHQoc1VdQ5fSM9TPzT
They stay available in the previous commit, for the description.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BJr8NHQoc1VdQ5fSM9TPzT
@github-actions

Copy link
Copy Markdown
Contributor

Preview the game(s) changed or added in this Pull Request


This is an automatic message displaying links to the games in this PR - double check the JSON in case of doubt.

@4ian
4ian added this pull request to stack #1090 October 14, 2026 08:25
@4ian
4ian merged commit 1e29c4e into main Oct 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants