Giter VIP home page Giter VIP logo

agario-client's Introduction

agario-client

Node.js client for agar.io with API.

Outdated!

Agar developers made completely new code for game. Now code runs inside virtual machine that I can not reverse-engineer due to lack of knowledge and experience. Unfortunately its time to say goodbye to agario-client. Initial idea of agario-client was for me to learn websockets, binary protocols, reverse-engineering, github and have fun overall. I believe that I achieved all that. Thanks to all, it was great time!

Instructions

  • Install Node.js
  • Install client using npm install agario-client (ignore python errors)
  • Run node ./node_modules/agario-client/examples/basic.js (for testing purpose)
  • If it works, you're ready to look at API and code

API

There are two types of object that have API:

  • Client - thing that connects to agar.io server and talks to it. If you want to spawn and control your Ball, you need to talk with Client
  • Ball - thing that Client creates. Everything in game is Balls (viruses/food/players...). You can't control Balls objects, only observe what they do.

Both objects have same methods for events from events.EventEmitter:

  • .on('eventName', callback) attach listener to event
  • .once('eventName', callback) attach listener to event but execute only once
  • .removeListener('eventName', callback) remove listener from event
  • .removeAllListeners('eventName') remove all listeners from event
  • .emit('eventName', p1, p2...) emit your own event
  • check more in documentation

Client API

var AgarioClient = require('agario-client');
var client = new AgarioClient(client_name);

client_name is string for client that will be used for logging (if you enable it). It's not your ball name.

Client properties

Properties that you can change:

  • client.debug debug level. 0-5. 0 is completely silent. 5 is super verbose. Default: 1
  • client.server address that was used in client.connect() call
  • client.key key that was used in client.connect() call
  • client.auth_token token to login. See how to get token in additional info.
  • client.agent agent to use for connection. Check additional info.
  • client.local_address local interface to bind to for network connections (IP address of interface)
  • client.headers object with headers for WebSocket connection. Default: {'Origin':'http://agar.io'}
  • client.inactive_destroy time in ms for how long ball will live in memory after his last known action (if player exit from game or ball eaten outside our field of view, we will not know it since server sends action only about field that you see. Original code destroy() Ball when he disappear from field of view. You can do that in client.on('ballDisappear') if you want it for some reason). Default: 5*60*1000 (5 minutes)
  • client.inactive_check time in ms for time interval that search and destroy inactive Balls. Default: 10*1000 (10 seconds)
  • client.spawn_attempts how much we need try spawn before disconnect (made for unstable spawn on official servers). Default: 25
  • client.spawn_interval time in ms between spawn attempts. Default: 200

Properties that better not to change or you can break something:

  • client.balls object with all Balls that client knows about. Access Ball like client.balls[ball_id]
  • client.my_balls array of alive Ball's IDs that client owns and can control.
  • client.score personal score since spawn
  • client.leaders array of leader's Balls IDs in FFA mode. (player can have lots of Balls, but sever sends only one ID of one Ball)
  • client.teams_scores array of team's scores in teams mode
  • client.client_name name that you have set for client (not nickname)
  • client.tick_counter number of tick packets received (i call them ticks because they contains information about eating/movement/size/disappear... of Balls)

Client methods

  • client.connect(server, key) connect to agar.io server. Check Servers part in this readme to see how to get server IP and key. ProTip: each server have few rooms (if it is not party), so you may need connect few times before you will get in room that you want (but you need new key each time and agar.io can ban your IP for flooding with requests). You can look client.once('leaderBoardUpdate') to know if you're connected to correct room
  • client.disconnect() disconnect from server
  • client.spawn(name) will spawn Ball with nickname. client.on('myNewBall') will be called when server sends our Ball info. Will return false if connection is not established.
  • client.spectate() will activate spectating mode. Look at client.on('spectateFieldUpdate') for FOV updates. Will return false if connection is not established.
  • client.spectateModeToggle() switching spectate mode in spectating mode (Q key in official client). Use client.moveTo() to move your "camera" around. Look at client.on('spectateFieldUpdate') for movement updates. Will return false if connection is not established.
  • client.moveTo(x,y) send move command. x and y is numbers where you want to move. Coordinates (size) of map you can get in client.on('mapSizeLoad'). Your Balls will move to coordinates you specified until you send new coordinates to move. Original source code do this every 100ms (10 times in second) and before split and eject. Will return false if connection is not established.
  • client.split() will split your Balls in two. Ball will be ejected in last direction that you sent with client.moveTo(). client.on('myNewBall') will be called when server sends our Balls info. Will return false if connection is not established.
  • client.eject() will eject some mass from your Balls. Mass will be ejected in last direction that you sent with client.moveTo(). Ejected mass is Ball too (but we don't own them). So client.on('ballAppear') will be called when server sends ejected mass Balls info. Will return false if connection is not established.

Client events

In this list on.eventName(param1, param2) means you need to do client.on('eventName', function(param1, param2) { ... })

  • on.connecting() connecting to server
  • on.connected() connected to server and ready to spawn
  • on.connectionError(err) connection error
  • on.disconnect() disconnected
  • on.message(packet) new packet received from server (check packet.js)
  • on.myNewBall(ball_id) my new Ball created (spawn/split/explode...)
  • on.somebodyAteSomething(eater_id, eaten_id) somebody ate something
  • on.scoreUpdate(old_score, new_score) personal score updated
  • on.leaderBoardUpdate(old_highlights, new_highlights, old_names, new_names) leaders update in FFA mode. names is array of nicknames of leaders and highlights is array of numbers 0 or 1 corresponded to names where 1 means nickname should be highlighted in leader board (for example your nickname)
  • on.teamsScoresUpdate(old_scores, new_scores) array of teams scores update in teams mode
  • on.mapSizeLoad(min_x, min_y, max_x, max_y) map size update (as update 16.02.2016 this called then new virtual size of map received)
  • on.reset() when we delete all Balls and stop timers (connection lost?)
  • on.winner(ball_id) somebody won and server going for restart
  • on.ballAction(ball_id, coordinate_x, coordinate_y, size, is_virus, nick) some action about some Ball
  • on.ballAppear(ball_id) Ball appear on "screen" (field of view)
  • on.ballDisappear(ball_id) Ball disappear from "screen" (field of view)
  • on.ballDestroy(ball_id, reason) Ball deleted (check reasons at the bottom of this document)
  • on.mineBallDestroy(ball_id, reason) mine (your) Ball deleted (check reasons at the bottom of this document)
  • on.lostMyBalls() all mine Balls destroyed/eaten
  • on.merge(destroyed_ball_id) mine two Balls connects into one
  • on.ballMove(ball_id, old_x, old_y, new_x, new_y) Ball move
  • on.ballResize(ball_id, old_size, new_size) Ball resize
  • on.ballRename(ball_id, old_name, new_name) Ball set name/change name/we discover name
  • on.ballUpdate(ball_id, old_update_time, new_update_time) new data about ball received
  • on.spectateFieldUpdate(cord_x, cord_y, zoom_level) coordinates of field of view in client.spectate() mode
  • on.experienceUpdate(level, current_exp, need_exp) experience information update (if logined with auth token)
  • on.packetError(packet, err, preventCrash) unable to parse packet. It can mean that agar changed protocol or issue #46. By default client will crash. But if you sure this is not protocol change and it don't need new issue then you need to call preventCrash() before callback execution ends. I highly recommend to disconnect client if this error happens.
  • on.debugLine(line_x, line_y) the server sometimes sends a line for the client to render from your ball to the point though don't expect to see it.
  • on.gotLogin() server authorized you. Missing in original code, check issue 94
  • on.logoutRequest() server forces client to call window.logout()

Ball API

var ball = client.balls[ball_id]; ball_id is number that you can get from events

Ball properties

Properties that you can change:

  • None. But you can create properties that don't exists for your needs if you want

Properties that better not to change or you can break something:

  • ball.id ID of Ball (number)
  • ball.name nickname of player that own the Ball
  • ball.x last known X coordinate of Ball (if ball.visible is true then its current coordinate)
  • ball.y last known Y coordinate of Ball (if ball.visible is true then its current coordinate)
  • ball.size last known size of Ball (if ball.visible is true then its current size)
  • ball.mass mass of ball calculated from ball.size
  • ball.color string with color of Ball
  • ball.virus if true then ball is a virus (green thing that explode big balls)
  • ball.mine if true then we do own this Ball
  • ball.client Client that knows this Ball (if not ball.destroyed)
  • ball.destroyed if true then this Ball no more exists, forget about it
  • ball.visible if true then we see this Ball on our "screen" (field of view)
  • ball.last_update timestamp when we last saw this Ball
  • ball.update_tick last tick when we saw this Ball

Ball methods

  • ball.toString() will return ball.id and (ball.name) if set. So you can log ball directly
  • Other methods is for internal use

Ball events

In this list on.eventName(param1, param2) means you need to do ball.on('eventName', function(param1, param2) { ... })

  • on.destroy(reason) Ball deleted (check reasons at the bottom of this document)
  • on.move(old_x, old_y, new_x, new_y) Ball move
  • on.resize(old_size, new_size) Ball resize
  • on.update(old_time, new_time) new data about Ball received
  • on.rename(old_name, new_name) Ball change/set name/we discover name
  • on.appear() Ball appear on "screen" (field of view)
  • on.disappear() Ball disappear from "screen" (field of view)

Servers

When you do var AgarioClient = require('agario-client'); you can access AgarioClient.servers Functions need opt as options object and cb as callback function.

Servers options

All functions can accept: opt.agent to use for connection. Check additional info opt.local_address local interface to bind to for network connections (IP address of interface) opt.resolve set to true to resolve IP on client side (since SOCKS4 can't accept domain names) opt.ip if you resolved m.agar.ip IP by other way (will cancel opt.resolve).

  • servers.getFFAServer(opt, cb) to request FFA server.
    Needs opt.region
  • servers.getTeamsServer(opt, cb) to request teams server.
    Needs opt.region
  • servers.getExperimentalServer(opt, cb) to request experimental server.
    Needs opt.region
    Use at your own risk! Support of experimental servers are not guaranteed by agario-client!
  • servers.getPartyServer(opt, cb) to request party server.
    Needs opt.party_key
  • servers.createParty(opt, cb) to request party server.
    Needs opt.region

Check region list below in this file.

Servers callbacks

Callback will be called with single object that can contain:

  • server - server's IP:PORT (add ws:// before passing to connect())
  • key - server's key
  • error - error code (WRONG_HTTP_CODE/WRONG_DATA_FORMAT/REQUEST_ERROR/LOOKUP_FAIL)
  • error_source - error object passed from req.on.error when available (for example when REQUEST_ERROR happens)
  • res - response object when available (for example when WRONG_HTTP_CODE happens)
  • data - response data string when available (for example when WRONG_DATA_FORMAT happens)

LOOKUP_FAIL can happen only if opt.lookup was set to true and will have only error_source

You can check how examples/basic.js uses this.

Additional information

agario-devtools

If you want record/repeat or watch in real time what your client doing through web browser, you might want to check agario-devtools

Regions list

  • BR-Brazil
  • CN-China
  • EU-London
  • JP-Tokyo
  • RU-Russia
  • SG-Singapore
  • TK-Turkey
  • US-Atlanta

Ball destroy reasons list

  • {'reason': 'reset'} when client destroys everything (connection lost?)
  • {'reason': 'inactive'} when we didn't saw Ball for client.inactive_destroy ms
  • {'reason': 'eaten', 'by': ball_id} when Ball got eaten
  • {'reason': 'merge'} when our Ball merges with our other Ball
  • {'reason': 'server-forced'} when server commands to delete all balls

Auth token

To login into your account you need to request token. You can check example in examples/auth_token.js First create new AgarioClient.Account

var account = new AgarioClient.Account();

Then you need to login through facebook on http://agar.io then go to http://www.facebook.com/ and get cookies c_user,datr,xs. Here is list of properties of account:

  • account.c_user - set to cookie "c_user" from http://www.facebook.com/
  • account.datr - set to cookie "datr" from http://www.facebook.com/
  • account.xs - set to cookie "xs" from http://www.facebook.com/
  • account.agent - agent for connection. Tests shows that you can request token from any IP and then use it on any IP so you don't need SOCKS/Proxy.
  • account.debug - set 1 to show warnings, otherwise 0. Default: 1
  • account.token_expire - contains timestamp in milliseconds when token will expire. Tokens are valid for 1-2 hours. If (+new Date)>account.token_expire then you need to request new token and use it in new connection to agar.

Then you call

account.requestFBToken(function(token, info) {
	//If you have `token` then you can set it to `client.auth_token` 
    // and `client.connect()` to agar server
});

If token is null, then something went wrong. Check info which can contain:

  • info.error - Error of connection error
  • info.res - response's http.IncomingMessage object
  • info.data - content of page

SOCKS/Proxy support

You can change default agent for AgarioClient and AgarioClient.servers to use for connections. You can use libs to do it. For testing and example i used socks lib. Execute node ./node_modules/agario-client/examples/socks.js to test it and read examples/socks.js file to see how to use SOCKS. For proxy you will need to use some other lib.

Adding properties/events

You can add your own properties/events to clients/balls. var AgarioClient = require('agario-client');

  • Prototype of Client is located at AgarioClient.prototype.
  • Prototype of Ball is located at AgarioClient.Ball.prototype.

For example:

AgarioClient.Ball.prototype.isMyFriend = function() { ... };  //to call ball.isMyFriend()
AgarioClient.prototype.addFriend = function(ball_id) { ... }; //to call client.addFriend(1234)

Events:

client.on('somebodyAteSomething', function(eater_id, eaten_id) {  #eat event
    if(client.balls[eaten_id].isMyFriend()) { //if this is my friend
        client.emit('friendEaten', eater_id, eaten_id); //emit custom event
    }
});
client.on('friendEaten', function(eater_id, friend_id) { //on friend eaten
    client.log('My friend got eaten!');
});

Check full example in examples/basic.js

Feedback

If something is broken, please email me or create issue. I will not know that something is broken until somebody will tell me that.

License

MIT

agario-client's People

Contributors

boogheta avatar cr4xy avatar drsdavidsoft avatar geoffreyfrogeye avatar henopied avatar jashman avatar kosak avatar ogarunite avatar pulviscriptor avatar rouxrc 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

Watchers

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

agario-client's Issues

IP Binding?

Is there a way to bind the use of a separate ip on a server? I have multiple ips and don't really want to use the server's main ip when using this! It would also be a nice feature all together anyways

Thanks!

How do you have make this script...

Hello ! I want to make an userscript for cursors.io but I don't know how capture, decrypt and repeat websocket traffic...
Can you help me ?

Thanks :D

Facebook Broken with Agar.io Update

The Facebook key system has been broken due to the new update of Agar.io. The Facebook login system, i think, has changed, and the way the client is using the Facebook keys no longer works.

Client don't respawn ball

Sry, but i have problem with client, if someone eat me my ball don't respawn. I don't know why ;/ can you help me ?

worker: closest 3537658, distance 85.70880934886448
worker: closest 3537658, distance 54.45181356024793
worker: I ate 3537658, my new size is 44
worker: closest 3539285, distance 549.626236637226
worker: closest 3539285, distance 532.2593352868506
worker: closest 3539285, distance 486.64257931257924
3529797(Alan PL) ate my ball
i lost my ball 3539702, 0 balls left
worker: lost all my balls, respawning

And nothing more .... just stay

5 connections Limit

Hey, just opened 8 tabs and played on the same server - why does your framework only allow 5 simultanious connections?

Websocket throwing error

So, i have created bots that will go inside you, agario minions. Whenever i connect to a server on browser, it sends websocket to server saying ip and key, then one bot is created and then disconnected.

Image:
image

connection error: connection timed out

hi pulviscriptor :-),

i have a problem in my script, hopefully you can help me.

I use socks.js, just replaced:

AgarioClient.servers.getFFAServer(get_server_opt, function(srv) {
    if(!srv.server) {
        console.log('Failed to request server (error=' + srv.error + ', error_source=' + srv.error_source + ')');
        process.exit(0);
    }
    console.log('Got agar.io server ' + srv.server + ' with key ' + srv.key);

    //Here we already have server and key requested through SOCKS server
    //Now we will create agario-client
    var client = new AgarioClient('worker');
    client.debug = 2;

    //Create new agent for client
    client.agent = createAgent();

    client.once('leaderBoardUpdate', function(old, leaders) {
        var name_array = leaders.map(function(ball_id) {
            return client.balls[ball_id].name || 'unnamed'
        });

        client.log('Leaders on server: ' + name_array.join(', '));
        console.log('[SUCCESS!] Example succesfully connected to server through SOCKS server and received data. Example is over.');
        client.disconnect();
    });

    //Connecting to server
    client.connect('ws://' + srv.server, srv.key);
});

with:

AgarioClient.servers.createParty({ region: 'EU-London' }, function (srv) {
        if (!srv.server) {
            console.log('Failed to request server (error=' + srv.error + ', error_source=' + srv.error_source + ')');
            process.exit(0);
        }
        console.log('Got agar.io server ' + srv.server + ' with key ' + srv.key);

        //Here we already have server and key requested through SOCKS server
        //Now we will create agario-client
        var client = new AgarioClient('worker');
        client.debug = 2;

        //Create new agent for client
        client.agent = createAgent(ip, port, type); 

        client.once('leaderBoardUpdate', function (old, leaders) {
            var name_array = leaders.map(function (ball_id) {
                return client.balls[ball_id].name || 'unnamed'
            });

            client.log('Leaders on server: ' + name_array.join(', '));
            console.log('[SUCCESS!] Example succesfully connected to server through SOCKS server and received data. Example is over.');
            client.disconnect();
        });

        //Connecting to server
        client.connect('ws://' + srv.server, srv.key);
    });

getting the error: 'worker: connecting error: Error: Connection timed out'

New agar.io version (550) disconnects agar.io client

Looks like key length has changed. It was working perfectly yesterday, they made a new version.

Here's the example.js stack trace.

$ node ./node_modules/agario-client/example.js
worker: client created
Requesting server in region EU-London
HTTP request answer: 139.162.198.65:443
36XyMmbZ

Connecting to ws://139.162.198.65:443
worker: connecting...
worker: connected to server
worker: disconnected
worker: spawning
c:\projects\nodejs\agario-dinner-bot\node_modules\agario-client\node_modules\ws\lib\WebSocket.js:214
    else throw new Error('not opened');
               ^
Error: not opened
    at WebSocket.send (c:\projects\nodejs\agario-dinner-bot\node_modules\agario-client\node_modules\ws\lib\WebSocket.js:214:16)
    at Object.Client.send (c:\projects\nodejs\agario-dinner-bot\node_modules\agario-client\agario-client.js:130:17)
    at Object.Client.spawn (c:\projects\nodejs\agario-dinner-bot\node_modules\agario-client\agario-client.js:415:14)
    at Object.<anonymous> (c:\projects\nodejs\agario-dinner-bot\node_modules\agario-client\example.js:55:12)
    at Object.emit (events.js:104:17)
    at null._onTimeout (c:\projects\nodejs\agario-dinner-bot\node_modules\agario-client\agario-client.js:88:20)
    at Timer.listOnTimeout (timers.js:110:15)

Auth token broken

Developing of client will be freezed for a while

I got some problems, doctors says i need surgery. I am going to hospital now. I will be away for about two weeks (i hope not more that month).
For that time i will not be able to fix agario client if it breaks.
Bye.

A few things

This is a list of a few features I would like implemented.

  • ball.mass being served via a getter with cache and the cache would be set to 0 when the size is changed like:
get mass() {
  if(this.masscache) {
    return this.masscache;
  }
  var ball_mass = Math.pow(this.size/10, 2);
  this.masscache = ball_mass;
  return ball_mass;
}

(note that this requires the ball.masscache to be defined)

  • I would like to see better packet error handling because the callback is async so if the person using the lib were to wait a bit before calling the callback it would still throw the error.
  • Decreased default destroy inactive check time. This would dramatically reduce memory usage for people that run > 15 bots on the same server.

If you want me to make a pr for any or all of these I would gladly do such.

Index out of range

Basicly when I run my bot I get this:

C:\Users\Name\node_modules\agario-client\agario-client.js:415
// If you need that server support, you may create issue https://github.com/pulviscriptor/agario-client/issues
^

RangeError: index out of range
at checkOffset (buffer.js:642:11)
at Buffer.readUInt16LE (buffer.js:688:5)
at Object.Packet.readUInt16LE (C:\Users\Name\node_modules\agario-client\packet.js:51:29)
at Client.processors.49 (C:\Users\Name\node_modules\agario-client\agario-client.js:342:39)
at Object.Client.onMessage (C:\Users\Name\node_modules\agario-client\agario-client.js:140:9)
at WebSocket.onMessage (C:\Users\Name\node_modules\agario-client\node_modules\ws\lib\WebSocket.js:414:14)
at emitTwo (events.js:87:13)
at WebSocket.emit (events.js:172:7)
at Receiver.onbinary (C:\Users\Name\node_modules\agario-client\node_modules\ws\lib\WebSocket.js:804:10)
at C:\Users\Name\node_modules\agario-client\node_modules\ws\lib\Receiver.js:533:18

Packet Errors

when i run 70 132 mass bots this is the packet error i get

Packet error detected for packet: 10 0c 00 a5 88 28 00 e2 a7 29 00 5c d5 28 00 8d a5 29 00 59 a9 29 00 e5 a2 29 00 f1 57 29 00 ef a8 29 00 e5 97 29 00 80 a7 29 00 ca 87 00 00 00 47 a6 29 00 71 0b 00 00 3b ec ff ff 39 00 07 ff 71 00 00 00 4d a6 29 00 cd 0e 00 00 bc e9 ff ff 72 00 fe ff 07 00 00 00 00 a7 29 00 3c 0e 00 00 8e f0 ff ff 20 00 07 79 ff 00 00 00 d0 a7 29 00 56 05 00 00 e9 ec ff ff 0b 00 74 ff 07 00 00 00 e1 a7 29 00 9e fe ff ff a1 ed ff ff f6 04 20 07 ff 00 00 00 f9 a7 29 00 ee 08 00 00 c6 ed ff ff 39 00 07 ff 71 00 00 00 fa a7 29 00 5c 09 00 00 3a ee ff ff 39 00 07 ff 71 00 00 00 fb a7 29 00 e8 08 00 00 3a ee ff ff 39 00 07 ff 71 00 00 00 3a a8 29 00 e3 0d 00 00 c9 eb ff ff 43 00 ff 07 9c 00 00 00 00 00 00 00 02 00 00 00 29 90 29 00 22 94 29 00 82 7e 01 97 10 0c 00 45 a7 29 00 85 9d 29 00 f1 57 29 00 f3 a8 29 00 75 5a 29 00 db 9b 29 00 97 8a 29 00 88 a2 29 00 78 71 29 00 67 a5 29 00 86 94 29 00 78 a9 29 00 86 94 29 00 7b a9 29 00 5a 9c 29 00 7a a9 29 00 3d 1f 29 00 6f a9 29 00 3d 1f 29 00 6e a9 29 00 3d 1f 29 00 70 a9 29 00 1b a4 29 00 33 a8 29 00 5c d5 28 00 b8 07 00 00 5f f2 ff ff b6 02 07 ff df 00 00 00 c1 68 29 00 ca 07 00 00 0e ec ff ff 8f 00 82 07 ff 00 00 00 26 8e 29 00 8a 06 00 00 12 ee ff ff ec 00 76 07 ff 00 00 00 c6 9c 29 00 6f 0d 00 00 fe f0 ff ff 74 00 54 07 ff 00 00 00 5d 9d 29 00 38 08 00 00
35 says: Crash will be prevented, bot will be disconnected
C

This really needs to get fixed because it happens all the time. I think its internet because it doesnt happen when I run it on vps

question about nickname

hey Dude !

your script is very usefull for me, but i really tried hard to get the nickname from the other balls around
, adding sth to the appear in agario-client.js....is there a way to get the nickname of a ball, or is it anywhere stored in the packet? (i don't mean the nickname of your bots) i want them to go into sb, when appear

thanks,
David

Advanced AI bot

So this is more of a question for people rather than issue but is there any nice clean examples of an advanced AI written for this? I can't seem to find many examples except for the 4 included. Thanks! :)

Disconnect() error

Whenever you try to pass the disconnect() function it gives this error:

   this.ws.close();
           ^

TypeError: Cannot read property 'close' of undefined
at Object.Client.disconnect (C:\Users\clock\node_modules\agario-client\agario-client.js:61:16)
at Object.<anonymous> (C:\Users\clock\node_modules\agario-client\examples\basic.js:130:8)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:475:10)
at startup (node.js:118:18)
at node.js:952:3

All i did was, after doing npm update to be sure, add a client.disconnect(); to the basic.js; it returned this error, so its NOT my api, its a problem with the lib. I have looked, and i don't see anything to be causing this in the lib. I tried this.close(); instead of this.ws.close() because i saw other this.send(); things. That did not work, and ws.close(); obviously would not work.

Fetch mouse coordinates to make feeder bot

So i'm able to connect to my server and test out the API a bit. How would i go forth to fetching my
mouse coordinates, and setting the client.moveTo to my mouse coords?

client.moveTo(myMouse.x, myMouse.y);

Also, to spawn several bots, would i have to open several instances of CMD?
Thanks.

New packet ID : 102

Hello guys, just to notice there is a new packet, id 102, it seems that you receive it when you die.
ex of data :
[102, 8, 1, 18, 41, 8, 62, -14, 3, 36, 10, 13, 8, 10, 82, 9, 8, -70, 19, 16, 3, 24, 22, 32, 0, 18, 19, 8, 30, 16, -50, -33, 4, 24, -6, -101, 1, 32, -90, 85, 40, -69, 2, 48, -25, 5]�

code corresponding in js :
case 102:
u = a.buffer.slice(d);
p.core.proxy.forwardProtoMessage(u);
break;

type in console : agarApp.core.proxy
it looks like it's an API "Se.MiniclipAPI" to wss://web-live-v3-0.agario.miniclippt.com/ws

maybe some stats ?

Multiple Clients

What is the best way of going about spawning multiple clients off of one script?

Merged balls are not removed from memory

I was testing example.js and found that when you eat your own ball, it's not removed from array and not destroyed, so when all your balls eaten, you stuck.
Merge was removed here and I need time to investigate how it works in new protocol.
If you have/had this bug, this is it.

Multiple clients think they share balls.

If I create more than one client ('main' and "extra") then spawn them both into the game (I am putting them into the same game via a http request loop) calling main.my_balls returns ['xxxx','yyyy'] while calling extra.my_balls also returns ['xxxx','yyyy'], I believe one should be returning ['xxxx'] and the other ['yyyy'].

Sorry if there is a method implemented to get around this that I have missed.

Free spectator mode

The official agar.io client has a free spectate mode when you hit the 'q' key, allows you to roam around as a spectator, similar to moving your ball around via moveTo(). Is this on the horizon planned for implementation?

When I try to spawn more than 30 bots on party

buffer.js:788
throw RangeError('Trying to write outside buffer length');
^
RangeError: Trying to write outside buffer length
at RangeError ()
at checkInt (buffer.js:788:11)
at Buffer.writeUInt8 (buffer.js:794:5)
at Object.Client.onConnect (/opt//bots/agario-client.js:93:17)
at .onOpen (/opt//node_modules/ws/lib/WebSocket.js:432:14)
at .EventEmitter.emit (events.js:92:17)
at .establishConnection (/opt//node_modules/ws/lib/WebSocket.js:862:8)
at ClientRequest.upgrade (/opt//node_modules/ws/lib/WebSocket.js:753:25)
at ClientRequest.g (events.js:180:16)
at ClientRequest.EventEmitter.emit (events.js:106:17)
at socketOnData (http.js:1612:11)

Is it because I updated ws?

Is there a way to get more than 5 clients on the same server

Is it possible to get more than 5 clients to be on the same server? I have tried vanessa socket pipe, and socks 5. They both didn't work. I have access to a vps and multiple ips are on the adapter. I was researching about some localAddress thing. Is there some alternative way to get more than 5 clients connected to the same server.

ALSO IMPORTANT: if you change the token to null it works on ffa,experimental,and teams :D

Agar

Hi

I have some problem and need some help

Please add me on skype sir

live:Pro_Sauron

Im a noob how do i make this run?

I want to use this so my bots from agarpowerups will have face book mass. I put my access token in agario-client.js and put my facebook cookie info in auth_token.js When i go on to agar.io and run my bots it dosnt work. Any help??

getPartyServer can't request a proper `getToken`

I am trying to use

AgarioClient.servers.getPartyServer({party_key: player.party_key}, function(srv){...})

But I get this error from AgarioClient :

Failed to request server(error = WRONG_HTTP_CODE, error_source = null,
    res = {
        "readable": false,
        "httpVersionMajor": 1,
        "httpVersionMinor": 1,
        "httpVersion": "1.1",
        "complete": true,
        "_pendingIndex": 0,
        "upgrade": false,
        "url": "",
        "statusCode": 404,
        "statusMessage": "Not Found",
        "_consuming": true,
        "_dumped": false
    })

My party_key looks like this #Q4THE.

Agar.io devs probably changed something..

init key has changed

You should change the init key to 2200049715 I don't know if this has caused problems yet but it may lead to instability.

Tests

Just wondering do you have any code tests for this client, if so could you please use travis with this project? I would love to have tests so I could add my own features with confidence.

Connecting more than 5 Bots

If I'm trying to connect more than 5 bots with socks, the first 5 are connecting fine but the next bots are displaying this error:
Failed to request server (error=REQUEST_ERROR, error_source=Error: Negotiation Error (5))
Failed to request server (error=REQUEST_ERROR, error_source=Error: Socket Closed)

one question

I am currently trying to make the ogar bot work with your client but I am wondering is ball.zise the zise (radius) or mass and if it is zise would Math.Pow(ball.zise,2)/100 work to get mass?

Using stocks.

I'm trying to include your stock5/proxy example into my project but I'm getting errors.

Bot : client created
using agent [object Object]
Connecting to ws://151.80.96.51:1507 with key X2TBE
Bot : connecting...
Bot : connection error: Error: connect ECONNREFUSED 151.80.96.51:1507

In other words the bot isn't connecting to the stock proxy.

code:

    bots[bot_id] = new ExampleBot(bot_id);
    bots[bot_id].agent = createAgent();
    console.log('using agent ' + bots[bot_id].agent)
    bots[bot_id].connect('ws://' + srv.server, srv.key);

getPartyServer in server.js

Hello !:-),

can you give me an example how to use the getPartyServer function, if i want to join: agar.io/#JTR7N?

greets,
david

Returns Error On Party Mode Connect

Greetings,
Whenever i connect to a party mode server using this script, specifying the ip AND key, after a bit of time, i get this error:

buffer.js:582
throw new RangeError('Trying to access beyond buffer length');
^
RangeError: Trying to access beyond buffer length
at checkOffset (buffer.js:582:11)
at Buffer.readUInt16LE (buffer.js:609:5)
at Object.Packet.readUInt16LE (/home/mrsonic/agarclient/packet.js:51:29)
at Client.processors.16 (/home/mrsonic/agarclient/spawnIn().js:234:39)
at Object.Client.onMessage (/home/mrsonic/agarclient - FINAL/AgarioClient.js:129:9)
at WebSocket.onMessage (/home/mrsonic/agarclient FINAL/node_modules/ws/lib/WebSocket.js:418:14)
at WebSocket.EventEmitter.emit (events.js:98:17)
at Receiver.onbinary (/home/mrsonic/RSAgarBots - FINAL/node_modules/ws/lib/WebSocket.js:823:10)
at /home/mrsonic/agarclient/node_modules/ws/lib/Receiver.js:537:18
at Receiver.applyExtensions (/home/mrsonic/agarclient/node_modules/ws/lib/Receiver.js:364:5)
at /home/mrsonic/agarclient/node_modules/ws/lib/Receiver.js:531:14

Any help is appriciated!

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.