-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speed Fix #5
Comments
you have need to change the 9 to 4.8 |
I'm away now but I'll fix it as soon as I get home. Thanks! |
@GrumpyOet When changing 9 to 4.8, the snake is removed from the game. Not sure if this is an error on my side but I'll have a look |
Do hou know why the shake get removed from the map? |
I'm not too sure. The Slither.io Protocol says that there are 6 bytes in the array |
but how do we fix it because you only can do 9 not less or more |
I think we need to fix position.js. The buggy movement (and I'd say speed) are because of sending exact co-ordinates. We need to send both (or a mixture of both) to fix the bugs |
I think we have neem to change THE position.js to 7 and THE movement.js to 7 or 6 |
il gonna try that when i am home |
The G packet is 7 bytes long (last index is 6, but index starts at 0), the g packet is 9 bytes long. |
how they are both Int8 |
and i don't get a error when i change that but the snake goes a little bit slower |
I'm talking about position.js not movement.js. I've just updated the code. Uncomment L126 to use position.js. |
i think the is something wrong in L126 |
Don't think there is. Have you uncommented it? |
yes en there is no other option to change in the position.js because i tried to change the Uint8Array to every thing from 1 to 20 and nothing of that work |
and the error says that's the error is in L126 |
the question is why that:
and why that:
right? |
no wait i think that the error is in the message.js file (maybe?) |
It's in position.js, you're right. The number being sent is 144685. Not sure why this number is being sent though |
Ok, so I think I found the problem. Initially, the body's x and y are sent as Int24's. This means they're gonna be big numbers. position.js is looking for Int8's though. I'm still not sure how I'm gonna fix it but I'll look into it |
Be careful! In the 's' packet the position is an int24, but multiplied by 5. So if the position in the 's' packet is 144685, the snake actually has the coordinates 28937, which fits into an int16. For the 'G' and 'g' packets the coordinates are not multiplied/divided by 5. |
ok, thanks! I'll check if that fixes it! |
Ok, after fixing that, the snake barely moves and when it does, it moves in sudden jerks |
Rowan what did you change? |
I changed |
What client are you using for testing? Does the sudden-movement happen on client side only or also on server side? |
I'm using the original slither.io client. I only see the jerking client-side only although I have no debug statements that would come up server-side |
i tried it to now the snake looks like a retard now |
I don't understand this line:
If the snake moves too slow on the client side, maybe you didn't send the speed correctly. Typically, the speed is between 5 and 6, lets say 5. The speed is sent in int16, but the client is dividing it by 1000, therefore you need to send 5000. If you can read/write Java, you can try the server with my client, it should work well for most basic stuff while it only has 1500 to 2000 lines of code. |
I think with the the speed is fine but now we have need to fix the rotation of the snake |
for what is this code rotation or something |
Rowan i think you must use this code for the next version 0.0.5b2 and fix the retard snake for 0.0.5b2 to |
The angle is 0 @Mat2095 (sorry for late reply) |
That's boring :( so the snake can only go to the right? |
Mat can you make a code for that? |
If we can work from here then we only have need to fix rotation of the snake becaus the speed is good |
Maybe you can take a look at this:
|
For the rotation |
@GrumpyOet make a code for what? |
for rotation of the snake |
I don't speak JS, but this is the general idea: |
There is no snake.scang or snake.spang in my code. Is there a default value for them? |
dont ask me I can read JS script but not code it |
|
/\ Hè use that code /\ |
@Mat2095 Is that the server-side code or do I need to use the opposites of that? |
You only need opposite code when you modify before/after sending, like you have x in your code, but you send data=10*x, then you have to read it with x=data/10. |
Just updated the code. Still getting the jerk bug |
Can iT be this
To
|
no. It's position.js that's the problem |
O ok |
Maybe because you did / 5 you need to do that on a other conn.snake.body.something /5 |
Okay, take a look at the direction-packet ('e'): You make an Uint8Array sized 7 and write 8 bytes in it. That doesn't work. You set the first two bytes to 0. This is very wrong! The documentation says "Time since last message from client". I don't know how to calculate the data you need to send here, but you HAVE to find it out (from the client-code) for the server to work. (Take an official server and client, just set these bytes to 0, and the game is broken) Then you you send the packet-type and id, which is ok. Next you send the current angle. I doubt it is in the right format, but you still haven't answered my question about that, so I don't know. Next you send 104 and 1 (You can't, the array is too short). Is this the wanted-angle and speed? So the snake always goes down-left and its speed is always less than 0.06 ? |
Ok, so about the body x and y, the formula used there is this. The Center_X and Center_Y aren't added as there is no point in adding 0 |
Sorry for the late reply. Ive been busy lately. To answer your question in full.
|
you have need to change this in the movement.js:
instead of this:
The text was updated successfully, but these errors were encountered: