Open ghost opened 5 years ago
IIRC the unstealth transition only happened when the player unstealthed by choice. Even then, I don't recall if other players saw it or if it. Here is a video showing derp unstealthing without the transition when firing.
I think the way it worked on the original server was like this:
This doesn't appear to be correct since we have the teleporting occurring. Unfortunately, without access to the original server I'm at a bit of a loss as to what are the correct packets here. We will probably have to reverse-engineer it from what behaviour we expect and what packets need to be passed to the client to get that.
Looking at some packet captures from the original server, I think you are correct, the difference is the PLAYER_UPDATE packet.
When the prowler fired, other players would see two identical PLAYER_UPDATE packets followed by a PLAYER_FIRE packet, all with the same clock:
PLAYER_UPDATE (12) {
"clock":1387168521,
"id":36670,
"keystate":5,
"upgrades":0,
"posX":-1589.59375,
"posY":-1415.990234375,
"rot":1.633758544921875,
"speedX":4.27978515625,
"speedY":1.3909912109375}
PLAYER_UPDATE (12) {
"clock":1387168521,
"id":36670,
"keystate":5,
"upgrades":0,
"posX":-1589.59375,
"posY":-1415.990234375,
"rot":1.633758544921875,
"speedX":4.27978515625,
"speedY":1.3909912109375}
PLAYER_FIRE (13) {
"clock":1387168521,
"id":36670,
"energy":0.25098039215686274,
"energyRegen":0.006,
"projectiles":[
{"id":38313,
"type":7,
"posX":-1554.5,
"posY":-1413.75,
"speedX":5.9075927734375,
"speedY":0.372314453125,
"accelX":0.069854736328125,
"accelY":0.00439453125,
"maxSpeed":7.0001220703125}
]}
On the new server, the last PLAYER_UPDATE sent for the prowler, and thus its last known position, is prior to EVENT_STEALTH:
PLAYER_UPDATE (12) {
"clock":121264357,
"id":105,
"keystate":9,
"upgrades":0,
"posX":241.658203125,
"posY":-1904.150390625,
"rot":0.35400390625,
"speedX":-0.38818359375,
"speedY":-4.4830322265625}
EVENT_STEALTH (43) {
"id":105,
"state":true,
"energy":0,
"energyRegen":0.008}
PLAYER_FIRE (13) {
"clock":121422715,
"id":105,
"energy":0.011764705882352941,
"energyRegen":0.008,
"projectiles":[
{"id":56,
"type":7,
"posX":442.5,
"posY":-1967,
"speedX":-4.1461181640625,
"speedY":-0.1727294921875,
"accelX":-0.069915771484375,
"accelY":-0.002899169921875,
"maxSpeed":6.99951171875}
]}
PLAYER_UPDATE (12) {
"clock":121424357,
"id":105,
"keystate":9,
"upgrades":0,
"posX":477.162109375,
"posY":-1961.130859375,
"rot":4.8089599609375,
"speedX":-0.73974609375,
"speedY":4.4384765625}
I think what's happening is because PLAYER_FIRE causes the prowler to become visible, a mini-teleport occurs between the positions in the PLAYER_UPDATE packets immediately before EVENT_STEALTH and just after PLAYER_FIRE.
Given a cloaked prowler last seen in position A, when it is uncloaked due to hit at position B, prowler either
In either case, no unstealth transition runs, IIRC such a transition existed in real server
Looks like:
https://github.com/steamroller-airmash/airmash-server/blob/5e096b37aaf6a4b7cc6357a64b945fe466035f10/server/src/systems/specials/prowler/destealth_on_fire.rs#L44-L51
We tell the prowler that it is unstealthed, but we do not tell any other visible plane. I think this means on next random position update, prowler will suddenly reappear.
I'm not sure if it explains why the teleport happens. I'd expect client wants something like one PLAYER_UPDATE prior to EVENT_UNSTEALTH
Will try implementing this for destealth_on_fire / destealth_on_hit and see how it goes