Pryaxis / TShock

☕️⚡️TShock provides Terraria servers with server-side characters, anti-cheat, and community management tools.
GNU General Public License v3.0
2.43k stars 382 forks source link

Pirate Boss not working properly on Tshock #1646

Closed Luysita closed 4 years ago

Luysita commented 6 years ago

Details: Pirate Invasion boss sometimes appears invisible when it's summoned. Cannot hit it at all.

It still fires cannons and mobs though.

Screenshots: terraria 2018-10-28 19-07-58-99

terraria 2018-10-28 19-06-57-78

AxeelAnder commented 6 years ago

It's a bug of Terraria rather than TShock. It happens when there are solid tiles on the top of where it spawn. Just move to other place and it'll be visible.

Luysita commented 6 years ago

It's a bug of Terraria rather than TShock. It happens when there are solid tiles on the top of where it spawn. Just move to other place and it'll be visible.

Oh, because I tried in singleplayer and it worked, weird.

AxeelAnder commented 6 years ago

It's a bug of Terraria rather than TShock. It happens when there are solid tiles on the top of where it spawn. Just move to other place and it'll be visible.

Oh, because I tried in singleplayer and it worked, weird.

It happens only in multiplayer game. Terraria only sync an npc when it's velocity bigger than a value. When the ship get stuck in rising process, it's velocity is 0. And for some reasons I don't know, clients judge its cannons are died, so it died in clients. Without syncing, players can never see it.

Luysita commented 6 years ago

Ah alright, thanks anyway.

hakusaro commented 6 years ago

Can we just work around this in TShock?

On Mon, Oct 29, 2018 at 1:23 PM Luysita notifications@github.com wrote:

Closed #1646 https://github.com/Pryaxis/TShock/issues/1646.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Pryaxis/TShock/issues/1646#event-1933354231, or mute the thread https://github.com/notifications/unsubscribe-auth/AAggp5VdCSaGRdK4DrgDdHB5ersA7KOJks5up2OygaJpZM4X-K20 .

Luysita commented 6 years ago

Can we just work around this in TShock?

Wonder the same.

bartico6 commented 6 years ago
        if (Main.npcStreamSpeed > 0 && !this.townNPC && (double) Math.Abs((float) this.velocity.X) + (double) Math.Abs((float) this.velocity.Y) > 1.0) <<<<<<<<<
        {
[...]
        }

First thought is that you can try patching the NPC class to optionally skip the velocity check based on a configuration value, or you can emulate this behavior every tick by forcing an update if the NPC's velocity vector axis sum is <= 1.0.

Olink commented 5 years ago

Depends on who is doing the killing of the npc, but if all the client cares about is a non-zero velocity just have the server modify any incoming/outgoing packets for npcs that are the pirate ship and set the velocity component to something that gets past the client bug?

Ofc if the issue is that the server is not sending out updates then sending out a packet on our own also works.

Also, changing the spawn position of the Ship to not be in a block also makes sense...

bartico6 commented 5 years ago

According to the bug report the NPC vanishes clientside, since its interactions with the world still occur (spawning NPCs, cannonballs).

I am not sure if and what causes the disappearing issue. I think it could be a "unstuck" method in the game kicking in for the clientside prediction. I'm sure I've seen ships despawning in vanilla due to getting stuck in a roof...

AxeelAnder commented 5 years ago

I think the key is why cannons disappear. Probably the network delay. First frame the ship update and generate 4 cannons, then second frame cannons update. If there's delay that is enough for client to update, client would be unable to find the cannons, so the ship blow up Just my conjecture.

sr229 commented 5 years ago

Sounds like a spawn state error IMHO, this can be rectified in TShock's side by checking if the client's view has the mob NPC entity is existent between clients. If it does then draw the entity with the sprite for all connected clients then despawn when there's conditions met for it to be de-spawned, then update to clients about it

bartico6 commented 4 years ago

This has now been fixed in 1.4.1, apparently.

Fixed an issue where Flying Dutchman would desync and behave oddly or die spontaneously