itch.io is community of indie game creators and players

Devlogs

Major performance improvements

3D Collisions in GameMaker
A browser project made in HTML5

Given some recent experiments with sprite atlasing and conversations with Juju Adams, I decided to have a go at using GameMaker instances as a broadphase for collision detection, rather than something like an octree. It turns out that works REALLY well. In the test project it’s up to ten times (!!!) faster than the alternatives.

So, ColWorldGameMaker has been added as an alternative to quadtrees, octrees, and spatial hashes. In most cases I’d recommend using these over the alternatives. The documentation has been updated with a bit more information on them.

There are some things to keep in mind while using these, although I doubt they’d be a major hurdle in most games:

  • You can only have one instance of ColWorldGameMaker in use at once, as the GameMaker instances used as a proxy for hit detection exist globally and will be picked up by every overlap test (although you can still use the shapes’ groups/masks as usual)
  • Raycasts have a hard cap of 100,000 on the distance they can cover on the XY plane, but they can still be functionally infinite on the Z axis
  • Collecting objects inside a view frustum is slower than using a quadtree or octree if you collect a large number of instances. It’s still pretty much always faster than drawing everything all the time, but if you have very dense collision worlds, it may be worth using a quad or octree in parallel just to run frustum operations on

This is in addition to the optimizations I talked about last time. In that post I said I’d wait until LTS 2026 is out before making this update official, but LTS2026 is taking longer than expected, so I’m just going to kick it out the door now.

If there are any issues, let me know.

Files

  • 3DCollisionTestWorld-Web.zip 2.1 MB
    1 day ago
  • 3dcollisions.yymps 46 kB
    1 day ago
  • 3DCollisionTestWorld-Windows.zip 3.4 MB
    1 day ago
Download 3D Collisions in GameMaker
Leave a comment