yvt / openspades

Compatible client of Ace of Spades 0.75
http://openspades.yvt.jp/
GNU General Public License v3.0
1.13k stars 219 forks source link

Interpolate mouse movements in spectator mode #646

Open NotAFile opened 6 years ago

NotAFile commented 6 years ago

I'm not sure if this requires any special server-side code or more information from other clients, but first-person spectator footage is currently very jerky, it looks like no interpolation or prediction is done. This makes it harder to spot cheaters.

roboman2444 commented 6 years ago

I think this could be improved serverside as well... If you are spectating a player, then the server will send updates at a faster rate for that player to your client.

NotAFile commented 6 years ago

that's difficult internally, since the packets are broadcast at a fixed rate of 60ticks/s

roboman2444 commented 6 years ago

Really? Spectating a player appears to only get view angle updates maybe 5 times a second. Movement is interpolated, so it is hard to estimate how fast that is updated though.

NotAFile commented 6 years ago

The Server broadcasts at 60 updates/second but that does not actually mean that is how often the client updates the player due to a number of reasons. I'm not sure what causes the large difference in visible updates. From the code I have read so far, no interpolation seems to be going on.

xtreme8000 commented 6 years ago

Are those reliable packets? Also @roboman2444 is right, PacketWorldUpdate is sent every 200ms. There is no other way to send a player's orientation to a client.

NotAFile commented 6 years ago

@xtreme8000 how do you come to the 200ms figure? I only see the code to update the world every 1/60th of a second

xtreme8000 commented 6 years ago

@NotAFile Measurements on real servers.

yvt commented 6 years ago

@NotAFile

https://github.com/piqueserver/piqueserver/blob/master/pyspades/constants.py#L58:

NETWORK_FPS = 10.0

https://github.com/piqueserver/piqueserver/blob/master/pyspades/server.py#L182-L192:

    def update(self):
        self.loop_count += 1
        BaseProtocol.update(self)
        for player in self.connections.values():
            if (player.map_data is not None and
                    not player.peer.reliableDataInTransit):
                player.continue_map_transfer()
        self.world.update(UPDATE_FREQUENCY)
        self.on_world_update()
        if self.loop_count % int(UPDATE_FPS / NETWORK_FPS) == 0:
            self.update_network()

https://github.com/piqueserver/piqueserver/blob/master/pyspades/server.py#L194-L212:

    def update_network(self):
        #
        # . . . 
        #
        self.send_contained(world_update, unsequenced=True)
NotAFile commented 6 years ago

Oh okay, looks like I had the UPDATE_FPS in mind.

Either way, 10FPS is pretty meagre, I wonder what happens if you just triple that.

roboman2444 commented 6 years ago

Either way, 10FPS is pretty meagre, I wonder what happens if you just triple that.

10 ups is still more than what the apparent view angle update rate is when spectating a player.... it looks closer to 4 ups.

Either way, would be nice to be able to tell the server that you are spectating a specific player, so it sent you updates about them more often than any other player.