What do the F and f numbers written on lens mean? - what is an f number
I’m currently developing a tower defense game and I manage to have 5 000 turrets aiming at the closest of 5 000 targets with really good performance using Unity Physics. And I haven’t tried to optimize in any way for now.
You should definitely try Unity Physics, it’s not that convoluted and really easy to use. I don’t know what kind of algorithm they are running, probably a spatial hashmap or a quadtree of some sort, but it’s for sure better than the “dumb” way.
A 1951 USAF resolution test chart is a microscopic optical resolution test device originally defined by the U.S. Air Force MIL-STD-150A standard of 1951. The design provides numerous small target shapes exhibiting a stepped assortment of precise spatial frequency specimens. It is widely used in optical engineering laboratory work to analyze and validate imaging systems such as microscopes, cameras and image scanners.
What? Why? It is pretty straightforward and the math is pretty lightweight, especially with burst here. Yeah, you can try other approaches like creating grid and make units update their grid position before searching for them, using physics as mentioned or maybe make units talk to turrets about their changed position. Also there is option to slow down a bit by updating every few frames. But all those add unnecessary and possibly slower code. Simple math is simple.
I’m doing an RTS-type thing, and I’m currently looking at patterns to implement simple types of unit AI using DOTS. I’ve been specifically wondering a lot about responding to the position of other entities. For example, consider the case of the AI for a defensive Turret building which needs to fire on the closest opposing unit that comes within range. The dumb way to implement this is basically to have a loop every frame like this:
This is obviously a pretty inefficient algorithm to running every frame, though. Is there a better way to structure this kind of algorithm in an ECS world?
Any more specific examples on how to use Unity Physics for that? (Sorry, I am new to game programming / Unity in general)