Edit: solved: hyperion has a dodgy unregister player process and some offline players still existed within other players' localplayer map.
I am unsure of the cause but have identified something going wrong in the client's player updating.
When I enter a new region, entities which were in the previous region are removed from the client. My problem is a null-pointer occurs when the client tries to null a Player which needs to be removed in the local_players list:
The red code throws a null-pointer, the PID of the entity we want to remove is not in the local_players array.
Spoiler for extra:
Extra: the indicesPendingRemoval variable is declared as:
Code:
static int[] indicesPendingRemoval = new int[1000];
When other player movement is decoded in player updating, firstly this variable is used here:
Code:
int numLocalPlayers = ClientCopy.packetBuffer.readBits(8);
int ptr;
if (numLocalPlayers < ClientCopy.numLocalPlayers) {//we'be been told to update 5 entities but the client contains 6
for (ptr = numLocalPlayers; ptr < ClientCopy.numLocalPlayers ; ++ptr) {//remove the entity at the end of the array
ClientCopy.indicesPendingRemoval[(ClientCopy.removedCounter += 1) - 1] = ClientCopy.playerIndices[ptr];//set the PID to remove
}
}
And as usual, we request an update with bit value '1' - then request them to be removed with bit value '3' :
Code:
if (2 == movetype) {//running
ClientCopy.playerIndices[(ClientCopy.numLocalPlayers -= 1542815315) - 1] = index;//the big number here is some added obfuscation
var5.lastUpdated = ClientCopy.cycle;
var8 = ClientCopy.packetBuffer.readBits(3);
var5.moveInDirection(var8);
var7 = ClientCopy.packetBuffer.readBits(3);
var5.moveInDirection(var7);
int maskUpdate = ClientCopy.packetBuffer.readBits(1);
if (1 == maskUpdate) {
ClientCopy.entitiesRequiringUpdates[(ClientCopy.updateReqCount -= 472402375) * -184592375 - 1] = index;
}
} else if (movetype == 3) {//remove a player
ClientCopy.indicesPendingRemoval[(ClientCopy.removedCounter += 1906858221) * 104842469 - 1] = index;
}
When I did some debugging, the correct senario is:
Update x is the count of how many update packet's we've processed. The new[x,y,req,dir] is when a new player is added to our region. The GPU removal/nulling is removing an entity we no longer can see.
I've identified this senario of what happens which I believe is causing the problem:
As you can see, there is a request to remove 8 entities, however their PID is 0, not possible. I'm therefore lead to assume that there are players stuck in the server-sided local_player list with invalid PIDs.
I'm not sure as to whether the adding and removing entities in the same tick has an effect. The problem is I can't investigate until it happens.
I think but am not sure that the below images are related:
Here is a player we can see, in the Karil's, but we can't right click them. Their animation is also playing super-fast (you can't tell because with low graphics there is not much movement)
If we stand on the player, we can right-click them:
So I'm guessing this entity is only half-removed from the client. It's there visibly but when the client calculates where you're clicking in correlation with any on-screen entities, it doesn't detect them.
So, all in all I think there is a problem with entities being added and removed from regions server-sided. Has anyone experienced this using hyperion?
Edit: I think this is unique to the base I've used.
This is a major problem and I'm really not sure of the cause. I could spend hours trying to figure it out but get nowhere. Do you think I should go as far as to change base, or maybe compare the region system from another hyperion/rs2-server base?
it's setting the player in the array to null anyway...
I haven't tested it but I assume such a modification could damage the updating? It should technically work, but the point is I shouldn't have to hard code the client when it's programmed to work in the first place.
Are you using an OSRS client? The deobfuscating probably broke the client, I would look at the 317 client (one that's refactored well enough) and compare the player updating with the OSRS client's updating, They should be really similar.
I'm not sure if the same glitch of attempting to remove players with pid 0 appears but the other glitch where players are duplicated has happened using the same base on a different revision (464)