Collision masks on tiles

Godot Version

4.4

Note

Maybe I am just not very smart but after searching and asking every AI for help on how to improve my Tilemaplayer performance, I figured it may be nice to share and make it searchable somewhere:

Deactivate all collision masks on your tilemaplayer! Just give it a collisions layer. Strictly let everything else check for collisions with the ground. Only one of the parties needs to perform this work and this seems to eat away performance. If your entities and RigidBody2D check for collisions, there is no need to make every tile on the Tilemaplayer check as well.

This got me from 7 FPS to > 60 FPS on a medium chunk of about 10,000 tiles.

1 Like

That’s really useful info. Thanks.

1 Like

Ok new intel:
This problem is EXTREME when using Rapier2D. I guess Rapier was poorly optimised for the new Tilemaplayer nodes? I jumped from 1 to >> 60 FPS with maps > 10k tiles easily now by switching to Godot’s native 2D physics… I am doing a sidescroller with digging so not having collisions on tiles at all times would be quite inconvenient.

Long story short:
Try out different physics engines if your tilemap collisions are tanking the FPS.

1 Like

Hi! In my honest opinion… I do NOT recommended AI for GDScript, AI does NOT know the newest way to code in GDScript, It only knows Godot 3 !! And i don’t even think it knows Godot 3 properly too, So.. nicely… Don’t Use AI For Help All The Time.

Sorry for not answering your question! I don’t really know exactly why your tilemaps are ruining your performance… because my tilemaps don’t really lag my game.. And I’m NOT an experienced coder, just a basic coder… so sorry!

1 Like

Agreed. The reason for that is:

  1. LLMs are not constantly updated. They pull information from whatever point in time they are created and no later.
  2. LLMs do not copy-and-paste. They work by breaking things down into tokens and then re-creating their knowledge as an approximation. When LLMs do this, they are recreating through an algorithm what the assimilated. They do not have actual knowledge of any language.
  3. LLMs hallucinate. They make stuff up. Using an AI to program must be trust, but verify. Which means you have to know more about the underlying language than the AI.

AIs can be used to point you in the right direction, teach you about new libraries and plugins. But you’ll have to do the heavy lifting yourself. Which is, incidentally, what @mulksi learned - and came up with some really helpful information.

1 Like

Oh! I didn’t read @mulksi 's post properlyšŸ˜… i thought They were asking a question!

And yes, AI… i tried to use AI for help before and always kept saying ā€œYes this code works for Godot 4ā€ Lies. And the code didn’t even work !! AI? Not recommended for Godot. Maybe for C sharp like Unity? I think it knows more about that than GDScript.

1 Like

:joy: A more appropriate term for ā€œAI hallucinationsā€.

It does because C# has been around for 20+ years so there’s a lot more about it on the internet.

1 Like