Skip to content

Conversation

hex-agon
Copy link
Contributor

Adds support for damage2 update flag present in the future 244 revision. A few notes:

  • Haven't tested this as I'm not sure how, suggestions are welcome.
  • This should probably target a 244 branch and not 225.
  • This should increase the cargo & npm package version.

@ultraviolet-jordan
Copy link
Contributor

Adds support for damage2 update flag present in the future 244 revision. A few notes:

  • Haven't tested this as I'm not sure how, suggestions are welcome.
  • This should probably target a 244 branch and not 225.
  • This should increase the cargo & npm package version.

I am currently working on #3 so we can package individual wasm modules per RuneScape version, and make the engine more agnostic to that. Once this is done (will be soon), we can cut a 244 branch and pump out every packet, and so on for other versions.

For the engine, all we will have to do is change the package.json file to pick which one we want.

@ultraviolet-jordan
Copy link
Contributor

ultraviolet-jordan commented Jun 3, 2025

@hex-agon There is one change you will have to make on this here:
https://github.com/2004Scape/rsbuf/blob/225/src/renderer.rs#L18

And here for npcs:
https://github.com/2004Scape/rsbuf/blob/225/src/renderer.rs#L247

This will need to be + 1 length to be able to hold the additional mask.

This program does a bunch of pre-calculating and caching that's why it runs so fast.

@ultraviolet-jordan
Copy link
Contributor

@hex-agon You will have to modify lib.rs to set the new damage types in computePlayer and computeNpc which is called from the TypeScript host:

player.damage_taken = damageTaken;

npc.damage_taken = damageTaken;

@hex-agon
Copy link
Contributor Author

hex-agon commented Jun 8, 2025

Fixed per comments

@ultraviolet-jordan
Copy link
Contributor

ultraviolet-jordan commented Jun 9, 2025

Fixed per comments

Testing this is very easy to do, but the problem is:

  1. Need to use the 244 client.
  2. Need the server to support said 244 client.

Once you have these requirements completed then:

  1. Need to install wasm-pack on computer and then can compile this rust project to webassembly wasm-pack build --target nodejs --out-dir dist --out-name rsbuf
  2. This creates files in the project where you can just copy and copy and replace them into node_modules/2004scape/rsbuf on the engine, to test the changes out before publishing. You will have to fix the errors created by computePlayer and computeNpc additional args. And create a way on the engine to do 2nd hits.
  3. When ready to publish to npm, delete the .gitignore file that was generated by wasm-pack and then Pazaz or myself or etc can do npm publish. Also need to bump the versions in the toml and json files. You can resync your local engine project by deleting the pasted node_modules and do npm install again. Or bun or whatever it's all the same shit.

It is worth noting that as-is, rsbuf supports npc ids 0-8191. Just increase this number in the project 8191 and 8192 and nothing else needs to be touched unless the actual player_info and npc_info protocol itself changes. Could be a constant made somewhere so these numbers only exist in 1 place. Could just be set to 32767/8 and just never think about it again. Just beware the bigger the number the more memory that is used. Could just see what's the highest npc id before the protocol was changed into the more modern GPI solution.


But I am pretty confident the code will work as-is.

@Pazaz Pazaz merged commit 1defefb into 2004Scape:225 Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants