Also noticed this during testing around some world generations. It seem to be pretty common for small worlds. Often had this in my own worlds.
According to game code they start to spawn if the enemy npc spawn position height (depth or y coordinate to be correct) is less than worldSurface * 0.45.
For small worlds a common and also the max worldSurface is 337 (tiles below top of world). Times 0.45 would be 151. But harpies will also spawn if the player is deeper than this because they can spawn up to 46 (named spawnRangeY) tiles above the player. If we include this spawn-distance-above-the-player-range in the above equation harpies start to spawn for player positions higher than worldSurface * 0.45 + 46.
So in our test case 151+46 = 197. Scaling this again with our total worldSurface of 337 we will get a ratio of 197/ 337 = 0.585 which is much deeper than the 0.45 factor from above.
Theoretically the worldSurface could be down to 229, multiplied by factor 0.45 would be 103, adding the spawn height 46 will be 149 and with this the ratio would be 149/229 = 0.65 which is much worse than the target ratio 0.45.
(For medium an large worlds the worldSurface is bigger and with this it has less impact)
Fix suggestion: subtract the spawn-above-height from the actual spawn condition.
With this the harpy spawn ratio (player position where harpies start to spawn related to worldSurface) is always 0.45.
So harpies (and wyvern) would spawn if their the y coordinate of their spawn location is less than
(worldSurface)*0.45-46
(instead of less than (worldSurface)*0.45 as it is right now which leads to inconsistent spawn height ratios)
For example here some picture:
Green arrow is the player spawn location.
The dotted line (near the spawn) is the current Harpy-start-to-spawn-height. If the player moves above this Harpy will start to spawn. He has about no chance to avoid this for this world.
If we subtract the spawn-above-height the harpies would spawn if the player moves above the green line instead which gives the player at least some space to build his base of fight some bosses.
Furthermore with this the (player-position-where-harpies-start-to-spawn-height)/worldSurface = would always be 0.45, independent of the worldSurface variable or the world size in general.
(maybe special case for scopes & binoculars)
This could be some small change big impact update
---------------
Some statistics:
Out of 100 generated small world in 21 the harpies start to spawn in 34
or less tiles above the player spawn.
Means with resolution 1920x1080 the player could move
at most that height which is visible at the start of the game without spawning harpies.
This is very limiting for base building and boss fights.