python-airmash
python-airmash copied to clipboard
Projectiles and players not despawning properly
There is something a bit wrong with despawning - projectiles and players aren't being cleaned up properly. I made a really simple gui using pygame which draws all players and projectiles with online=True, and you can see lots of stationary objects. I tried changing the code to just remove them which helps a bit but it's still a problem. Is there some reason for keeping projectile and players around with online=False, why not just delete them? See PR #7
Actually I've just realised that Mob is using active and online while Player is using online - I've tried changing them both to use .active but there's still problems. Perhaps mob despawn isn't being recieved because it's being done on the backup websocket or something.
I think mob despawns for missiles are implicit; ie the speed, range, max speed, direction, etc for missiles are all known to the client. What remains is for the client to plot the missile trajectory and despawn it when it has run its course.
I think mob despawns are only sent for "unexpected" events, ie: if a missile hits another player. (although in that case I think that's sent as a hit anyway)
That makes sense, it explains why some missiles get deleted and some don't. A workaround for now would be to do it on missile age.