Closed lesleyrs closed 3 months ago
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.
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 members item
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. Also do the added wasm files have to be included as well? I can understand just having the bzip one generated from assemblyscript there, not sure about the rsmod one, rsmod should only have to be server only.
The bzip is also from the server. worker.js+LoginThread.js generated by npm run bundle
in server is the app entrypoint of 2004scape (minus cache packing, compiling runescript, http server) running as a webworker in the browser. The bundles need rsmod+server bzip to run, client bzip could've been used but didn't want to add another bzip lib to the server. It's essentially a no install, offline, singleplayer server until webrtc is added for peer to peer play.
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: Host: https://lesleyrs.github.io/Client2/?world=999 Peer: https://lesleyrs.github.io/Client2/?world=998
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 module: true
as that only applies to files that are included.
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.