Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

Oh, I see! Just throwing it out there but  "Each knight checks every footstep for overlapping hearing range" seems weird to me, in a technical way. Are you using Area2D for this? Maybe this is what you have already, ignore if it is the case but I would try to have something like:

  1. Knights have an Area2D that only checks footstep's Area2Ds (selecting only the knight's mask layer)
  2. Footsteps have an Area2D that only checks for Knight's Area2D (selecting only footstep's mask layer) (if you really need to, check the item below)
  3. Footsteps don't need to check for Knights, so you can disable the "Monitoring" and keep only "Monitorable" for the Footstep's Area2D
  4. Knights are the ones who should check if they are overlapping with a Footstep's Area2D, so you can maybe disable "Monitorable" for it

If the knights are meant to chase you when they hear a footstep within their ranges, you could only call it one time when the Knight/$Area2D.area_entered signal is emitted.

Again, you can totally ignore this thought, I don't know exactly about your internal rules so it may not make sense, just wanted to share if it can help you in any case.

(+1)

Nope! Works a lot simpler than that. No signals, no overlapping Area2Ds. A knight will find the distance to a footstep, and check if the distance is greater or not greater than the radius in which a footstep can be heard. I have an Area2D on the footstep but its only used to visually store the radius in a way I can play around with in editor. The Area2D has no collision layers or masks it listens to. I expect this calculation is a lot cheaper than 2 overlapping polygons (even if rectangle and circle are faily simple), but I suppose 30 knights * how ever many footsteps you can make in 15 seconds, is just too much for some browsers to handle. Once the Game Jam is over, my GF has pointed out to me it would be a lot better if its not the footsteps the knights will compare to, but just the player character himself (as long as he’s making footprints). Footprints should remain visual only