Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.

Conversation

@tannerdino
Copy link
Collaborator

@tannerdino tannerdino commented Nov 12, 2024

0 xp spawnhitting:

  • Video by keyboardOSRS (patched)
  • Ours with proposed fixes:
tf8sgb_1.mp4
  • ash tweet:

image

Respawn is moved to processNpcs() because:

  • Npc's with hunt rates of 1, will always hunt 1 tick after visibly respawning (which is a total of 2 ticks after being added to the world). If respawns were processed before hunts, npc's with hunt rates of 1 would hunt the same tick it visibly respawns
2024-11-12.13-24-57.mp4
2024-11-12.13-54-54.mp4
  • ai_spawn scripts take a tick to process in early osrs. This is the mechanism, along with pvm bonus xp handled with a varn, that allows 0 xp spawn hitting to work.

Obj/npc/loc hunting was moved to processNpcs() because:

  • In osrs, npc's will only hunt players in the processWorld() part of the tick. This video shows that the npc will hunt the obj the same tick it is dropped (meaning its processed after processPlayerSetup()):
od3gps_2.mp4
  • I'm pretty certain that at gwd the npc's will still hunt you if you unequip a god item in the same tick. Need a video of this though

}
this.resetHeroPoints();
this.queue.clear();
this.vars = new Int32Array(VarNpcType.count);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do this instead:

this.vars.fill(0);
this.varsString.fill(undefined);

idk why they aren't but these should be readonly

    readonly vars: Int32Array;
    readonly varsString: string[];

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I ended up doing this because undefined wouldn't work:
this.vars.fill(0);
this.varsString.fill('');

Copy link
Contributor

@ultraviolet-jordan ultraviolet-jordan Nov 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably bcuz varsString isnt typed properly. this.varsString.fill(''); isn't right either. My original comment is the technical correct way.

Er maybe it is:
https://www.typescriptlang.org/play/?ssl=3&ssc=23&pln=1&pc=1#code/MYewdgzgLgBAhgJwXAngLhgQSagPNBASzAHMA+GAXhjAFMB3LHFACgFYBKAbgChRIQAG1oA6QSBItEyFNz7gIQ0eMnTUAbQAMAXW5A

Idk js doesnt make any sense actually.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah Im pretty sure its this.varsString.fill(undefined);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And do something like this?
readonly vars: Int32Array;
readonly varsString: Array<string | undefined>;

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thank you. Done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it were me, I would do something like varsString.splice(0) and leave it as string[]

example:

const varsString: string[] = [];

for (let i = 0; i < 1000; i++) {
    varsString.push(i.toString());
}

varsString.splice(0); // varsString is back to []

image

Copy link
Contributor

@Pazaz Pazaz Nov 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think explicitly having undefined there is overly verbose. It's not in the strict language rules for a reason. In JS/TS it's also not the array itself storing undefined, but the array access returning undefined.

Is the goal of filling the var array to keep any original references to it? GC is kicking in regardless otherwise, is it so bad to new Array(...);?

If you're really serious about it @ultraviolet-jordan we should turn on noUncheckedIndexedAccess: true in tsconfig.
microsoft/TypeScript#49169
microsoft/TypeScript#39560

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imo indexing out of bounds in an array should be illegal and should crash the program

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lai6xuz2n6ia1

@Pazaz Pazaz merged commit deaee2a into 2004Scape:main Nov 12, 2024
5 checks passed
Pazaz added a commit that referenced this pull request Nov 16, 2024
We've reached 1000 PRs! Sincerest appreciation to all contributors that
are working on this.

## Content Changes

### Features

* #968
* #991

### Fixes

* #989
* #990
* #998
* #1000
* #1003

## Engine Changes

### Features

* #992
* #994
* #996
* #1001
* Automatic image quantization. We use the original packed sprites, so
this code only runs when custom images are added to the data folder.

### Fixes

* #993
* #995
* #1002
* Jagfile decompression could fail using standard libbz2 due to a
packing oversight. The client was unaffected.
* Removed quotes from constants referenced in scripts.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants