-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webworker clientstream + webrtc datachannels as workers #21
Conversation
If you built for prod then you will see why the reserves for the names are necessary. If this PR goes through it should break the client. |
No it definitely works for me on prod (it's live running on my github pages world 999) and member items work. But haven't tested every reserve. I'm using the same workflow and right clicked the dragon long. It's a bit sus why it works now though as I haven't really changed anything that would avoid it breaking. |
I think the bug comes from when it tries to read the world list specifically, the terser plugin for some reason can mess up some code that it's running through. I think you'd want to check that Free to Play worlds would show Members objects for these members items was the original bug (it wouldnt do that). If it works then we ship |
If that's the case the problem would still be around when connecting to official servers unfortunately. I don't mind the worker client just being a fork because client2 doesn't get many changes at all, but I may look into this more after I finish webrtc stuff. And iirc the problem was members worlds showing |
Don't get me wrong I am totally cool to merge it in I just wanna make sure but yeah let me know and we can merge it in. |
The bzip is also from the server. worker.js+LoginThread.js generated by The wasm files don't change often so I added them directly, the js bundles and data dir are gitignored by default. This is the vision but 2004: https://2003scape.github.io/ |
Completed the webworker stream + webrtc data channel connections which emulate a webworker. It works kind of like https://github.com/2003scape/rsc-client/blob/master/src/lib/net/socket.js#L43 but without using the peer library Updated readme for a quick explanation, basically world 999 for webrtc host and world 998 for peers. The webclient on world 999 will turn into a server where you manually add peers but you can still play on it as well. The SDP message does contain your public ip though. AND it's copied automatically when you click new user. Live on github as well: Final issue I couldn't fix is adding exclude to terserplugin didn't do anything, so I had to comment the reserved properties once again, it kept giving errors about the js bundles even though they should have been ignored... Maybe somebody else knows? |
Ok got terser working again, having the bundles in /public instead of src/public directly worked (it just didn't seem to work as I had the files in both places before). Pull from server branch to get path changes and remove the src/public bundles obviously. Apparently the fix from earlier (not pushed) with only including src/js dir and making server use a bit of cjs to avoid top level awaits actually worked and index.js is supposed to be 373kb, but I prefer this fix anyway as you don't need server changes because terser still gave the top level errors even with |
Note: I commented out reserved mangle properties as they are causing the webworker bundles to break, however I haven't come across issues without them. For example I reported the members property having to be reserved but it's fine right now and am able to use members items.Fixed.data/src
won't be copied to public as it's not needed and embedding LoginThread inside of worker.js was breaking out of the string variable due to string interpolation.From here the only thing that's needed is
npm run bundle
and set world to 999.