halftheopposite / TOSIOS

The Open-Source IO Shooter is an open-source multiplayer game in the browser
MIT License
369 stars 77 forks source link

The other player can't see the bullet #43

Open a7210232 opened 3 years ago

a7210232 commented 3 years ago

why The other player can't see the bullet self can

tabakd commented 2 years ago

Hi! I'm also running into this issue. I'd like to try to fix it. Any ideas what may be causing this? @halftheopposite @LukeWood Great boilerplate btw!!

LukeWood commented 2 years ago

Really not sure honestly. maybe a colyseus API changed with a major version?

tabakd commented 2 years ago

Ah I found it. Issue with the bullet re-use on server side. I’ll PR a fix when I can :)

On Mar 9, 2022, at 1:26 AM, Luke Wood @.***> wrote:

 Really not sure honestly. maybe a colyseus API changed with a major version?

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.

halftheopposite commented 2 years ago

@tabakd That'd be great if you can fix it and submit a PR 👍

wheresthebeefy commented 2 years ago

@tabakd Could you post a quick fix here in the meantime? I'm able to get it working if I comment out the bullet recycling code on the server-side so it only pushes new bullets, and also if I just push the recycled bullet onto the existing bullets array. But if I delete the bullet from the array and re-push, no go. My guess is Colyseus isn't detecting the array change because it thinks it is the same item, and could probably fix it by adding a new ID like this monsters array does for new entries

Yacine-YA commented 2 years ago

So ?

tabakd commented 2 years ago

@tabakd Could you post a quick fix here in the meantime? I'm able to get it working if I comment out the bullet recycling code on the server-side so it only pushes new bullets, and also if I just push the recycled bullet onto the existing bullets array. But if I delete the bullet from the array and re-push, no go. My guess is Colyseus isn't detecting the array change because it thinks it is the same item, and could probably fix it by adding a new ID like this monsters array does for new entries

That sounds like a plausible fix. I simply disabled the bullet re-use logic for my purposes but can look into fixing it.

colus001 commented 1 year ago

It is actually happening since Bullet.reset can trigger neither onAdd, onRemove nor onChange event from Colyseus server. I don't know why Bullet instance has to be remain inactive without destroying them. But #62 fixes it without too much hassle.