q3olegka
Remove 1.333 from scale abs(180/(3Dbill.d+distance(camH,0,3Dbill.ZElevation,0))) for 45fov and should be fine, maybe not perfect but much better.
Then you need also to adjust the 3Dshape sky height and camera H on mouse wheel.
Optimization in this case depends on many factors, I made simple self picking distance variable without for each loop beacuse self is faster(and actualy is a loop too). When the distance is bigger than 0 then objects are at front of the camera then do tranformations etc But this is not the best solution when you have a lot of objects because engine must calculate every tick the distance for each sprite to compare them.
If you want to have a lot of objects then you should consider to lock camera angle to avoid visible horizon (like in Don't Starve game) and then sort and transform only visible objects after picking them. You can pick those instances on 3D layer using square invisible sprite which follows camera but can't rotate with it(rotation will impact collision performance). 3D sprite that is in 3D layer and have 2D sprite in container should also have square collision shape like 4 corner only and can't rotate(this is the fastest picking on overlap event) Check out that post from page 1 to 2 that is exacly about this method: https://www.construct.net/en/forum/construct-3/general-discussion-7/picking-performance-132709
Another method is to store objects in a Array and create them when camera or player is around and unload objects that are far away(many games do this). Then you can create very big worlds but this is more complex to achieve.
You should then consider things like:
- Storing static objects and its state variables for animation frame, life etc
- to not create all of them from a array when needed in one tick(creating and destroing a lot of objects at once have performance impact)
- Storing moving objects with variables and behaviours
- And many more things that depend on the game design
You can even instead of Array handle map cluster checking on which tilemap the player is and spawn objects designed for this biome and unload those far away.
Good Luck!