spiderworm / gamestream

Store, stream, and playback your game state on JS client and server.
MIT License
8 stars 2 forks source link

Is this project alive?) #1

Closed caracal7 closed 5 years ago

caracal7 commented 5 years ago

Gamestream is great and well implemented idea!

I've tried to replicate client-server example in real network environment and everything seem to work as expected but I have strange performance drop after few minutes of simulation. Another branch in this project look like not working yet.

spiderworm commented 5 years ago

Hi Dmitry,

I'm glad you like it!

It's still active, there is a rewrite underway (the branch you specified), but unfortunately I don't have a ton of time to devote to it right now. Let me know tho if you have any specific things you'd like me to address and I'll take a look.

Can you give me more information about this performance drop?

David

caracal7 commented 5 years ago

Hi, David.

Thanks for fast response. I make repo to show the problem: https://github.com/caracal7/gstest

If you open 2 browser windows and will refresh one of them, second window will work slower and slower and finally freeze but refreshed window is working fine and all new clients works fine first few minutes. By this point I think that problem is on the client side. Best way to wakeup freezed browser is stop server)

Sorry for my English...

spiderworm commented 5 years ago

Awesome! I'll take a look tonight and see if I can't figure out what's going on. Have a great day!

spiderworm commented 5 years ago

Well, I definitely can reproduce the issue. I'm trying to debug right now.

I suspect this might be a client issue unrelated to GameStream but in the demo I wrote, but I'll let you know when I have more info.

caracal7 commented 5 years ago

Maybe it's not related with GameStream. Maybe it's a problem with cannon.js or three.js. I tried to add performance meters to render loop and to physics loop. And I think this is more problem with physics. But I am not sure) Maybe bottleneck somewhere between GameStream and client Physics? I think about it because performance problem is disappeared if you stop the server then the browser is close to death.

spiderworm commented 5 years ago

I haven't discovered the root cause yet, but I have figured out that in fact there does appear to be some issue internally with GameStream and how it converts input states. It doesn't seem to be handling dead entities all that gracefully and continues to store (and process) references to the state of those entities long after they're dead, which really bogs things down when there are a lot of short-lived entities in the game.

I'll hopefully have more information tonight. Thanks for raising this issue!

spiderworm commented 5 years ago

I don't have a final fix ready, but I have discovered the source of the problem and have a test fix in place that keeps performance reliable. I'll get a final fix in within the next couple of days.

spiderworm commented 5 years ago

This is too funny. Looking over the project's history, my last commit to master, over two years ago was a fix to this very problem. I just never pushed out a new NPM package!

Doing so now :)

spiderworm commented 5 years ago

Alright @caracal7 , try updating GS to 0.0.22 and see if that fixes your issue.

(note, you may also need to tweak the logic that removes objects from the game when the upstream pipe has set their state to undefined)

caracal7 commented 5 years ago

Ok. Tomorrow I will try. Also I want to try merge GameStream with other physics engine.

Thanks 🙏

spiderworm commented 5 years ago

Hi @caracal7 just wanted to see if the problem has been fixed for you? If so I will close this issue.

caracal7 commented 5 years ago

no problems any more 👍 Thanks)