DND_Reborn
The High Aldwin
We run it a bit more complex than that.For ranged creatures they just need to run behind trees, bushes, walls, anything providing heavy obscurement to qualify as being out of line of sight and to use their action or bonus action to Hide. Once they are have done so, they are allowed to use their action / next action to lean out and fire their ranged weapon while Hidden, and thus their attacks are with advantage.
If the group is outside you'd need to be on open plains or something to have nothing to hide behind. And in dungeons usually you have corridors, stalactites, giant rocks, or even just out at a far enough distance to get out of the darkvision's dim light radius to qualify being out of line of sight.
If a DM doesn't allow for PCs to do this... I'd say they were being stingy personally.
First, your target can't see you in the act of hiding. If they do, they know where you are and your "hiding" is really just taking cover--a completely different thing.
Second, your Dexterity (Stealth) check has to stand up against their Wisdom (Perception) check to show you have successfully "hidden".
After that, as long as you don't need to move more than 5 feet (as per JC's "ruling") you are still effectively hidden and gain advantage on your next attack.
But gaining advantage is not simply a matter of stepping out from behind cover, shooting, and moving back behind cover--at least not at our tables.

Otherwise, yeah one of the best ways to gain advantage is to be outside their range of darkvision, in which case they are blind and automatically fail their Wisdom (Perception) checks based on sight. Easy to gain advantage then.
None of us find those rules "stingy", but YMMV.
