GithubHelp home page GithubHelp logo

slither.io-protocol's People

Contributors

circa94 avatar coder-256 avatar daviscodesbugs avatar dickbalaska avatar gegy avatar issy123 avatar joery1337 avatar josefkuchar avatar kogs avatar mat2095 avatar mzer0ne avatar rowanharley avatar sitano avatar thundergemios10 avatar tomsmeets avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slither.io-protocol's Issues

How data is read

Hey,

I saw you had some questions on Reddit, I'm not sure if this will help but atleast I tried.

Variable c is the byte array.

(c[b] << 8 | c[b + 1]) / 100 for example is a 2 bytes number with 3 decimal places.

grd = c[b] << 16 | c[b + 1] << 8 | c[b + 2]; = the game radius, this is a 3 byte number.

Server side, you just need to do the opposite.

https://gist.github.com/joery1337/6eae1e90f47be9d4431e12fbec3fed3e, line 4462

Get Sectors

Are Sectors meant to be at certain places or can these be put at random positions

Food spawn packet

Hello. What can you say about this packet?

0000   00 00 46 06 3b 6b 2f 42 1a 06 3b 20 2f 30 1a 07  ..F.;k/B..; /0..
0010   3b 92 30 09 20 07 3b 94 2f b4 13                 ;.0. .;./..

In your protocol explanation you say that "F" packet should be 2+1+1+2+2+1 = 9 length, but there is 27, not 9. What should I do with remaining 18 bytes?

Android App

Anyone has already decompiled the air app on android ?

Protocol 10: connect

Protocol version 10 is out, there are basically no big changes expect one:
connecting is way harder.

Before v10:

  • client sends init-packet
  • server sends init-packet
  • game starts

Now:

  • client sends "c"
  • server sends serverVersion, a ~165-character string
  • client generates a 24-character random string
  • client manipulates this string with
    • a built-in, but highly obfuscated routine (stored as byte-values, evaluated at strange points, ...)
    • a second built-in obfuscated routine is used to decode and evaluate serverVersion, which was just a third hidden routine
  • client sends the manipulated string
  • client sends init-packet
  • server checks if the manipulated string is a possible result from the two routines
  • server sends init-packet
  • game starts

These are just my guesses, I could be completely wrong.
I'm currently trying to reverse-engineer the new way. If anyone has any information that might be useful, please share it.

Serverbound / clientbound

"Serverbound" means messages heading to the server.
In your spec, the first section you label "Serverbound". This is incorrect, as these are messages from the server to the client.

Help

i found a project from @RowanHarley for a slither.io server but what the problem is when you load it the snake go really fast and if you take a look at the /src/messages/movement.js file.
take a look in that file an you see this
var arr = new Uint8Array(9);

the 9 is for the speed but when i change it to any thing else the snake get removed from the game.

Packet 'v' doesn't work on it's own

It seems like the packet 'v' doesn't seem to work on it's own. Is it meant to be paired with another packet. Note: I'm trying to send the packet 'v' at random times. Does the snake have to actually die for me to send this packet?

Weird ip when parsing from i33628.txt

@ThunderGemios10 @Mat2095
Hello,

When I parse the data using this function :

var client = http.createClient(80, "slither.io");
var request = client.request("GET", "/i33628.txt");
request.on('response', function( res ) {
    res.on('data', function( data ) {
        var charArray = data.toString().split('');
        charArray.splice(0, 1);
        for(var i=0;i<charArray.length;i++){
            var code = charArray[i].charCodeAt(0) - 97;
            charArray[i] = ((code - 7*i) % 26 + 26)%26;
        }
        var byteArray = [];
        for(var i=0;i<(charArray.length-1)/2;i++){
            byteArray[i] = charArray[i*2] * 16 + charArray[i*2 + 1];
        }
        for(var i=0;i<(byteArray.length-1)/11;i++){
            var ip = byteArray[i*11+1]+'.'+byteArray[i*11+2]+'.'+byteArray[i*11+3];
            var port = byteArray[i*11+4]*65536+byteArray[i*11+5]*256+byteArray[i*11+6];
            console.log(ip+':'+port);
        }
    } );
} );
request.end();

I got weird ip like :

21.79.248:444
191.154.40:444
191.154.88:444
191.155.104:444
191.155.105:444
191.154.89:444
21.79.249:444
191.154.41:444
251.227.233:444
251.227.234:444
191.154.42:444
191.155.106:444
21.79.250:444
202.217.64:444
202.210.80:446
202.210.168:444
202.197.192:446
202.217.65:444
202.216.25:444
202.204.145:444
202.216.9:475
202.210.169:444
202.210.90:475
202.216.146:446
202.210.170:446
202.217.50:444
202.216.122:446
202.216.98:443
202.217.58:446
202.210.66:444
202.210.74:443
202.210.171:444
202.210.163:446
202.216.43:444
202.216.99:443
202.216.155:475
202.217.67:475
202.210.83:446
202.216.100:446
202.210.164:446
9.47.136:446
9.91.40:446
9.19.112:475
9.42.40:475
9.63.208:446
9.107.136:446
9.106.104:446
4.113.16:446
46.107.144:444
9.93.233:444
9.112.209:444
9.42.185:446
9.72.105:444
9.41.145:475
4.72.81:475
9.136.177:444
9.133.146:444
9.2.98:444
9.16.170:475
9.46.234:444
9.50.226:444
4.92.130:446
9.137.138:446
9.28.194:446
9.101.115:444
4.89.211:444
58.124.90:444
58.123.178:446
58.117.178:444
221.191.82:444
243.43.154:444
221.181.242:444
58.125.106:444
221.178.242:444
243.43.178:444
221.185.138:444
93.107.122:444
93.100.58:444
222.96.170:444
58.115.162:444
243.41.194:446
93.105.50:444
221.182.210:444
58.112.250:444
93.106.82:444
56.20.72:446
56.20.136:444
56.20.137:444
56.20.74:444
56.20.138:444
56.20.139:444
56.18.131:444
56.20.69:446
69.124.61:444
56.20.77:444
56.18.110:446
58.183.136:446
254.153.160:447
254.153.145:443
58.183.193:446
58.183.129:444
58.183.130:444
58.183.194:444
58.183.131:444
58.183.139:446
58.183.195:444
58.182.155:443
58.183.140:444
58.183.196:444
58.183.132:444
249.39.220:444
58.183.133:444
249.37.129:444
249.37.201:444
249.36.233:444
249.37.146:444
249.36.234:446
249.36.235:444
249.37.147:444
249.36.236:444
249.36.237:444
249.37.22:444
249.37.54:444
249.36.238:444
249.37.135:444
249.37.55:444
249.37.129:443
249.37.201:446
249.36.233:446
249.37.146:446
249.36.234:475
249.36.235:446
249.37.147:446
249.36.236:446
249.36.237:446
249.37.22:446
249.37.54:446
249.36.238:446
50.104.184:446
50.104.168:444
57.142.80:444
50.104.152:444
50.104.177:446
50.104.185:446
50.104.169:444
57.145.121:444
50.104.153:444
50.104.170:444
50.104.186:444
50.104.154:444
50.104.178:444
50.104.171:444
50.104.155:444
93.111.74:444
195.100.194:446
93.111.170:444
195.101.106:444
195.100.138:444
93.110.226:444
195.101.178:444
195.100.98:446
93.110.210:444
121.144.249:444
121.158.41:444
121.158.193:444
121.144.251:444
121.144.243:444
121.150.53:444
121.144.249:446
121.158.41:446

The port seems to be fine but none of these ip refers to known slither servers.
Idea?
Thanks!

How to inspect websocket packets to decode protocol

I'm trying to understand y'all are figuring out the Slither.io protocol.

I have Wireshark running and I'm looking for websocket packets sent to the slither.io server, but they all seem to have a payload of length 0 or 1.

How is it that you guys are able to figure out what you have about the protocol? I would love to be able to help.

protocol version

Hi,

I have some additional information (regarding the "w" and "W" packages), but they only apply to protocol version 8 (and above, most likely).
The documentation has a big heading saying "Protocol Version 6", are you only interested in version 6 or is this just not updated yet? In case you are interested in newer versions, do you want to keep the documentation about version 6 (e.g. in another branch)?

buffer question.

If I want to move a snake in my own script with buffer it would be "var random = new Buffer(g) {}" ??

Movement packet "g", how does it work?

How do that packets "g" and "G" work? I've been debugging slither.io's client code but I don't see patterns in the way they're sent. The only difference I see is that the packet "g" isn't sent too often in the game so I can guess that this is for lag simulation.

Protocol question

On your protocol.md the client packet Ping you specify a int8 that is always 251

But int8 only goes from -128 to 127

So is there a typo on the protocol.md file?

Thanks

The Position of the snake is not updating in my debug userscript and other question

When you play for a while, the position from the packet will start showing the same position but I am still moving. (You can see my userscript at the end)

ScreenShot

My Questions
Question 1: How to simply fix that problem?

-- If you can answer number one then you can ignore question 2 --

Question 2: Is there anyway to measure the position by adding what will the snake will go every minisecond
for example: snake.xx = xx + Math.sin(snake.angle) * **the Speed

** <-- Is there any way to know the speed, it will be a lot easier.

link to UserScript!

Please Help

Diep.io Protocol

Hey,
I love what you've done with this project for slither.io, and I actually started something
similar for a different .io game (diep.io). I could use your expertise in terms of
deciphering the protocol (I've not been having much luck with analyzing the
server-to-client packets).

The project is available here: https://github.com/firebolt55439/Diep.io-Protocol

How to build basic client to connect to slither.io server? Do I need to establish WSS connection?

Hey guys,

I'm trying to use the Net module of Node.js to talk to a slither.io server. However, I've only gotten as far as opening the connection. The server won't respond to anything I send it.

I've tried something like this:

var packetSetUsernameAndSkin = new Buffer([115, 7, 0, 115]);
var packetPing = new Buffer([251]);

client.write(packetSetUsernameAndSkin);
client.write(packetPing);

Yet the server still doesn't respond. I must be missing something. Do I need to establish a SSL connection or something? Wireshark seems to indicate that the connection is over websockets, so I guess I do have to establish a secure websocket connection. Any advice on doing that?

(I'm sorry if this isn't the right place to ask!)

P.S. Love the work you guys are doing. Looking at the protocol is fun!

Understanding Datatype and Coordinates

I'm unsure of what the intX data types mean. Are they just indicating how big the number potentially is by indicating the number of bytes? E.G. int8 would be one byte, int16 is 2 bytes, etc?

I'm asking because I'm trying to derive my snake's coordinates from the "s" packet when it spawns. I also don't know what "value / 5" means. Does it literally mean the x value is the given value divided by five? Could someone give me the layout of the game coords? Is negative y up? Is negative x left? I probably have to derive the bounds from the setup packet, right?

Also, is the first byte of the coordinates indicating the sign? Is 0 negative?

Thanks!

Custom skin colors?

Has anyone worked out what the colors are in the custom skin data?

It is incredibly tedious to try to run two clients and keep the official custom skin snake alive so I can look at it (and receive its data) with my client.

Protocol version 11 / custom skins

Current clients use protocol version 11, we should update to it.

  • Skin-information sent from client to server during login
  • Skin-information sent from server to client ('s'-packet?)
  • Check for other changes

How to get gameradius

I see gameradius mentioned a few times in the protocol.md. How is this calculated or from what object can it be read?

Calculating fpsls and fmlts on server

Can I use:

function setMscps(b) {
    if (b != mscps) {
        mscps = b;
        fmlts = [];
        fpsls = [];
        for (b = 0; b <= mscps; b++) b >= mscps ? fmlts.push(fmlts[b - 1]) : fmlts.push(Math.pow(1 - b / mscps, 2.25)), 0 == b ? fpsls.push(0) : fpsls.push(fpsls[b - 1] + 1 / fmlts[b - 1]);
        var f = fmlts[fmlts.length - 1],
            c = fpsls[fpsls.length - 1];
        for (b = 0; 2048 > b; b++) fmlts.push(f), fpsls.push(c)
    }
}

on my server to get fpsls and fmlts or do I need other code?

Update to protocol 12

Current protocol is 12, the documentation should be adjusted to that.
However, protocol 11 is working with the current live servers.

Sectors

What are sectors actually mean? In 'a' packet(initial setup) third and fourth values are describing something named "sectors". But what it really are?

Is fpsls and fmlts client-side?

I am trying to create a server for slither.io but I am stuck getting the player's score. Is Math.floor(15 * (fpsls[snake.sct] + snake.fam / fmlts[snake.sct] - 1) - 5) / 1 client-side and if so, how do I convert it to be server side. If not, can I just stick this code in to get the score. I can't seem to find any docs for fpsls and fmlts online so I don't know what to do with it

Not getting all websocket messages

Howdy,

Title says it all. I'm not getting all the web socket packets. I'm not getting p, W, G (so far that I have noticed) but I get all the others (seemingly) fine.

I should get a, s, g, W, F, W, F, W, F, W, F, W, F (this is what the game itself does); after all the W and F packets, the client shoots over the first ping.

I get a, s, g, F (so no W), just F, F, F, F, F, F, F, etc.

Then I never get any G packet updates; so I can't correctly determine my x, y.

Then I noticed after I send the preInitResponse, it's like the server doesn't take anymore of my packets but continued to send me stuff. So I can watch my snake in game but it won't move (but I can see my server pushing the speed up packet, but nothing happens). As soon as I disconnect the websocket, the snake starts moving around like there is a player behind it but it's the game's AI taking over.

Ideas? The protocol version, I've tried, 10, 11, and 12.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.