Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lesleyrs committed Jul 13, 2024
1 parent d69d669 commit dc2aae7
Show file tree
Hide file tree
Showing 3 changed files with 2,291 additions and 1,994 deletions.
19 changes: 6 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,16 @@ This project is a comprehensive source port of our [Client refactor](https://git

Click [here](https://github.com/2004scape/Client2/tree/gh-pages) to view the current deployment summary. 🚀

## Singleplayer
## Web Worker

Set world=999 in the client url to start a singleplayer server. Locally this takes only a few seconds but on github pages it can take around 3 minutes.
Set `world=999` in the client URL to start a Web Worker server on login. Locally this takes only a few seconds but on github pages it can take around 3 minutes. Saves will load from `data/players` and open save dialog on logout, but you should save them to `src/public/data/players` instead.

Saves will load from `data/players` and open save dialog on logout.

To update server code you have to:
1. run `npm run build` in server, copy `data` dir from server to `src/public` in client (except `src` as it isn't used and quite heavy)
2. run `npm run bundle` in server, this copies worker.js and LoginThread.js to `../Client2/src/public`
3. run `npm run dev` in client for hot reload, otherwise `npm run local` or `npm run prod` for release build

NOTE:
- randomuuid and crc are disabled. crypto.randomuuid() needs secure context and crcs are an http request. Cache and midis are fetched locally.
- bzip2 compression could be used to build from sources, but is also disabled as it would require too many ugly changes to the source and that would slow login times even more, specifically for github pages.
To update server code run the following:
1. `npm run build`, copy `data/pack`, `data/config`, and optionally `data/players` from server to `src/public` in client
2. `npm run bundle`, this copies worker.js and LoginThread.js to `../Client2/src/public`

TODO:
- load dropped save files and autologin, save packs in indexeddb after first login
- save packs in indexeddb after first login
- webrtc p2p multiplayer, possibly login server entrypoint?

## Site Index
Expand Down
16 changes: 13 additions & 3 deletions src/public/LoginThread.js
Original file line number Diff line number Diff line change
Expand Up @@ -42324,7 +42324,6 @@ var require_lib = __commonJS((exports, module) => {
var import_node_forge2 = __toESM(require_lib(), 1);
var {default: fs3} = () => ({});
var {default: fsp2} = () => ({});
var {parentPort} = () => ({});

// src/jagex2/io/Packet.ts
var {default: fs} = () => ({});
Expand Down Expand Up @@ -42743,8 +42742,15 @@ class Packet extends Hashable {
return new Packet(new Uint8Array(type));
}
}
static async load(path, seekToEnd = false) {
const packet = typeof self !== 'undefined' ? new Packet(new Uint8Array(await (await fetch(path)).arrayBuffer())) : new Packet(new Uint8Array(fs.readFileSync(path)));
static load(path, seekToEnd = false) {
const packet = new Packet(new Uint8Array(fs.readFileSync(path)));
if (seekToEnd) {
packet.pos = packet.data.length;
}
return packet;
}
static async loadAsync(path, seekToEnd = false) {
const packet = new Packet(new Uint8Array(await (await fetch(path)).arrayBuffer()));
if (seekToEnd) {
packet.pos = packet.data.length;
}
Expand Down Expand Up @@ -43071,6 +43077,8 @@ var u = new RegExp(
);
var i = {isIP: c, isIPv4: r, isIPv6: o};

// src/lostcity/server/LoginServer.ts

// src/lostcity/server/NetworkStream.ts
class NetworkStream {
queue = [];
Expand Down Expand Up @@ -43137,6 +43145,8 @@ class NetworkStream {
}
}

// src/lostcity/util/Environment.ts

// src/lostcity/util/TryParse.ts
function tryParseBoolean(value, defaultValue) {
if (value === 'true' || value === true) {
Expand Down
Loading

0 comments on commit dc2aae7

Please sign in to comment.