0 votes

i am currently using raycast2D for guns in my game and i am thinking about using raycast2D for bot navigation . I will be using 4 raycasts for each bot and there will be at least 24 bots at at time.

Will there be any performance drop?
Target platforms are android and PC.

asked Apr 8 in Engine by supper_raptor (719 points)

1 Answer

–1 vote
Best answer

Raycasts should be reasonably fast, but the best way to know if they are fast enough in your particular game is to profile it.
Check on your computer if 24 bots perform well enough, and then test the same thing on device. You may have to use the Godot profiler to check where the bottlenecks might appear: https://docs.godotengine.org/en/stable/tutorials/debug/overview_of_debugging_tools.html

answered Apr 8 by Zylann (27,004 points)
selected Apr 9 by supper_raptor

How well do they perform when compared to Area2d ?

It really depends on the shape used. I'd say raycasts can be faster, but you may need more to reproduce the same functionality some Area2D setups can solve better.
The best answer remains profiling. Measure how it performs, find bottleneck, then act on it.

Yeah they are efficient , even working with 100 bots !

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.