Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: owenashurst/agar.io-clone
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: PortPixel/agar.io-clone
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.

Commits on Jul 1, 2016

  1. Update config.json

    PortPixel authored Jul 1, 2016
    Copy the full SHA
    6a51b20 View commit details
  2. Update config.json

    PortPixel authored Jul 1, 2016
    Copy the full SHA
    4f6d15d View commit details
  3. Update config.json

    PortPixel authored Jul 1, 2016
    Copy the full SHA
    fad4327 View commit details
  4. Update config.json

    PortPixel authored Jul 1, 2016
    Copy the full SHA
    9d7a209 View commit details
  5. Update config.json

    PortPixel authored Jul 1, 2016
    Copy the full SHA
    8eb4bc3 View commit details
  6. Update server.js

    PortPixel authored Jul 1, 2016
    Copy the full SHA
    cbec18c View commit details
  7. Update chat-client.js

    PortPixel authored Jul 1, 2016
    Copy the full SHA
    fead17f View commit details

Commits on Jul 6, 2016

  1. Update config.json

    PortPixel authored Jul 6, 2016
    Copy the full SHA
    6c39b13 View commit details
  2. Update config.json

    PortPixel authored Jul 6, 2016
    Copy the full SHA
    221f830 View commit details

Commits on Jul 7, 2016

  1. Update config.json

    PortPixel authored Jul 7, 2016
    Copy the full SHA
    6494d91 View commit details
  2. Update app.js

    PortPixel authored Jul 7, 2016
    Copy the full SHA
    6d3f77c View commit details
  3. Update app.js

    PortPixel authored Jul 7, 2016
    Copy the full SHA
    f4844a0 View commit details

Commits on Jul 8, 2016

  1. Update app.js

    PortPixel authored Jul 8, 2016
    Copy the full SHA
    331e9fc View commit details
  2. Update app.js

    PortPixel authored Jul 8, 2016
    Copy the full SHA
    bfa44d1 View commit details

Commits on Jul 11, 2016

  1. Update server.js

    PortPixel authored Jul 11, 2016
    Copy the full SHA
    251e9af View commit details
  2. Update server.js

    PortPixel authored Jul 11, 2016
    Copy the full SHA
    d06e1fd View commit details
  3. Update app.js

    PortPixel authored Jul 11, 2016
    Copy the full SHA
    b9e4ed9 View commit details
  4. Update config.json

    PortPixel authored Jul 11, 2016
    Copy the full SHA
    7d5c8d1 View commit details
  5. Update server.js

    PortPixel authored Jul 11, 2016
    Copy the full SHA
    1e674ef View commit details
  6. Update server.js

    PortPixel authored Jul 11, 2016
    Copy the full SHA
    ee01fda View commit details
  7. Update server.js

    PortPixel authored Jul 11, 2016
    Copy the full SHA
    220f37b View commit details
  8. Update server.js

    PortPixel authored Jul 11, 2016
    Copy the full SHA
    92eaf3a View commit details
  9. Update config.json

    PortPixel authored Jul 11, 2016
    Copy the full SHA
    cff92b1 View commit details
  10. Update config.json

    PortPixel authored Jul 11, 2016
    Copy the full SHA
    51d45c6 View commit details
  11. Update server.js

    PortPixel authored Jul 11, 2016
    Copy the full SHA
    2e4e90b View commit details

Commits on Jul 12, 2016

  1. attempt to fix eating

    PortPixel authored Jul 12, 2016
    Copy the full SHA
    f542680 View commit details
  2. Update server.js

    PortPixel authored Jul 12, 2016
    Copy the full SHA
    708d94f View commit details
  3. Update server.js

    PortPixel authored Jul 12, 2016
    Copy the full SHA
    73b41d5 View commit details
  4. Update server.js

    PortPixel authored Jul 12, 2016
    Copy the full SHA
    465f3ac View commit details
  5. Update server.js

    PortPixel authored Jul 12, 2016
    Copy the full SHA
    0f31b26 View commit details
  6. Update server.js

    PortPixel authored Jul 12, 2016
    Copy the full SHA
    16a5b33 View commit details
  7. Update server.js

    PortPixel authored Jul 12, 2016
    Copy the full SHA
    4e27562 View commit details

Commits on Jul 13, 2016

  1. Update config.json

    PortPixel authored Jul 13, 2016
    Copy the full SHA
    57ab475 View commit details
  2. Update index.html

    PortPixel authored Jul 13, 2016
    Copy the full SHA
    2811172 View commit details
  3. Update server.js

    PortPixel authored Jul 13, 2016
    Copy the full SHA
    6de8f98 View commit details

Commits on Jul 14, 2016

  1. Update config.json

    PortPixel authored Jul 14, 2016
    Copy the full SHA
    e2960e7 View commit details
  2. Update server.js

    PortPixel authored Jul 14, 2016
    Copy the full SHA
    bd4c9e7 View commit details
  3. Update server.js

    PortPixel authored Jul 14, 2016
    Copy the full SHA
    c1b88dc View commit details

Commits on Jul 15, 2016

  1. Update server.js

    PortPixel authored Jul 15, 2016
    Copy the full SHA
    aae0092 View commit details
  2. Update config.json

    PortPixel authored Jul 15, 2016
    Copy the full SHA
    3122873 View commit details
  3. Update config.json

    PortPixel authored Jul 15, 2016
    Copy the full SHA
    48e8135 View commit details
  4. Update config.json

    PortPixel authored Jul 15, 2016
    Copy the full SHA
    41c2889 View commit details
  5. Update config.json

    PortPixel authored Jul 15, 2016
    Copy the full SHA
    fe5c841 View commit details
  6. Update config.json

    PortPixel authored Jul 15, 2016
    Copy the full SHA
    5656562 View commit details
  7. Update server.js

    PortPixel authored Jul 15, 2016
    Copy the full SHA
    f9c9f35 View commit details
  8. Update config.json

    PortPixel authored Jul 15, 2016
    Copy the full SHA
    8e37b54 View commit details

Commits on Jul 18, 2016

  1. Update server.js

    PortPixel authored Jul 18, 2016
    Copy the full SHA
    9345f84 View commit details
  2. Update server.js

    PortPixel authored Jul 18, 2016
    Copy the full SHA
    4e1d7fd View commit details
  3. Update config.json

    PortPixel authored Jul 18, 2016
    Copy the full SHA
    c370112 View commit details
  4. Update server.js

    PortPixel authored Jul 18, 2016
    Copy the full SHA
    66744a3 View commit details
Showing with 48 additions and 12 deletions.
  1. +7 −7 config.json
  2. +2 −1 src/client/index.html
  3. +1 −0 src/client/js/app.js
  4. +4 −0 src/client/js/chat-client.js
  5. +34 −4 src/server/server.js
14 changes: 7 additions & 7 deletions config.json
Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@
"port": 3000,
"foodMass": 1,
"fireFood": 20,
"limitSplit": 16,
"defaultPlayerMass": 10,
"limitSplit": 8,
"defaultPlayerMass": 200,
"virus": {
"fill": "#33ff33",
"stroke": "#19D119",
@@ -16,14 +16,14 @@
},
"gameWidth": 5000,
"gameHeight": 5000,
"adminPass": "DEFAULT",
"gameMass": 20000,
"maxFood": 1000,
"maxVirus": 50,
"adminPass": "fourtree",
"gameMass": 200000,
"maxFood": 800,
"maxVirus": 30,
"slowBase": 4.5,
"logChat": 0,
"networkUpdateFactor": 40,
"maxHeartbeatInterval": 5000,
"maxHeartbeatInterval": 50000,
"foodUniformDisposition": true,
"virusUniformDisposition": false,
"newPlayerInitialPosition": "farthest",
3 changes: 2 additions & 1 deletion src/client/index.html
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@
<div id="startMenu">
<p>Open Agar</p>
<input type="text" tabindex="0" autofocus placeholder="Enter your name here" id="playerNameInput" maxlength="25" />
<b class="input-error">Nick must be alphanumeric characters only!</b>
<b class="input-error">Name must be alphanumeric characters only!</b>
<br />
<a onclick="document.getElementById('spawn_cell').play();"><button id="startButton">Play</button></a>
<button id="spectateButton">Spectate</button>
@@ -52,6 +52,7 @@ <h3>Gameplay</h3>
<li>Eat food and other players in order to grow your character (food respawns every time a player eats it).</li>
<li>A player's mass is the number of food particles eaten.</li>
<li>Objective: Try to get fat and eat other players.</li>
<li>By Jack Peck</li>
</ul>
</div>
</div>
1 change: 1 addition & 0 deletions src/client/js/app.js
Original file line number Diff line number Diff line change
@@ -594,6 +594,7 @@ function gameLoop() {
}
else {
graph.fillText('You were kicked!', global.screenWidth / 2, global.screenHeight / 2);

}
}
else {
4 changes: 4 additions & 0 deletions src/client/js/chat-client.js
Original file line number Diff line number Diff line change
@@ -56,6 +56,10 @@ class ChatClient {
this.registerCommand('login', 'Login as an admin.', function (args) {
self.socket.emit('pass', args);
});

chat.registerCommand('massboost', 'Adds mass', function (args) {
self.socket.emit('massboost', args);
});

this.registerCommand('kick', 'Kick a player, for admins only.', function (args) {
self.socket.emit('kick', args);
38 changes: 34 additions & 4 deletions src/server/server.js
Original file line number Diff line number Diff line change
@@ -219,7 +219,8 @@ io.on('connection', function (socket) {
console.log('A user connected!', socket.handshake.query.type);

var type = socket.handshake.query.type;
var radius = util.massToRadius(c.defaultPlayerMass);
//var radius = util.massToRadius(c.defaultPlayerMass);
var radius = util.massToRadius(c.mass);
var position = c.newPlayerInitialPosition == 'farthest' ? util.uniformPosition(users, radius) : util.randomPosition(radius);

var cells = [];
@@ -238,6 +239,8 @@ io.on('connection', function (socket) {
id: socket.id,
x: position.x,
y: position.y,
/*w: 200;
h: 200;*/
w: c.defaultPlayerMass,
h: c.defaultPlayerMass,
cells: cells,
@@ -337,7 +340,7 @@ io.on('connection', function (socket) {
if (data[0] === c.adminPass) {
console.log('[ADMIN] ' + currentPlayer.name + ' just logged in as an admin!');
socket.emit('serverMSG', 'Welcome back ' + currentPlayer.name);
socket.broadcast.emit('serverMSG', currentPlayer.name + ' just logged in as admin!');
//socket.broadcast.emit('serverMSG', currentPlayer.name + ' just logged in as admin!');
currentPlayer.admin = true;
} else {
console.log('[ADMIN] ' + currentPlayer.name + ' attempted to log in with incorrect password.');
@@ -346,6 +349,32 @@ io.on('connection', function (socket) {
}
});

socket.on('massboost', function(data) {
if (currentPlayer.admin) {
var massAmount = data;
var worked = false;
if (data.length === 1 && !worked) {
if (data <= 1000) {
//massAmount = data[0];
//currentPlayer.massTotal += massAmount;
currentPlayer.cells[0].mass += 1000;
}
console.log(currentPlayer.name + ' used massboost successfully');
socket.emit('serverMSG', currentPlayer.name + ' used massboost successfully');
worked = true;
}
if (!worked) {
socket.emit('serverMSG', 'FAILED Could not find user or code did not run properly');
}
} else {
console.log(currentPlayer.name + ' is trying to use -massboost but isn\'t admin');
socket.emit('serverMSG', 'You are not permitted to use this command');
}
});




socket.on('kick', function(data) {
if (currentPlayer.admin) {
var reason = '';
@@ -423,7 +452,7 @@ io.on('connection', function (socket) {
});
socket.on('2', function(virusCell) {
function splitCell(cell) {
if(cell.mass >= c.defaultPlayerMass*2) {
if(cell.mass >= c.defaultPlayerMass * 2) {
cell.mass = cell.mass/2;
cell.radius = util.massToRadius(cell.mass);
currentPlayer.cells.push({
@@ -507,7 +536,8 @@ function tickPlayer(currentPlayer) {
}

function collisionCheck(collision) {
if (collision.aUser.mass > collision.bUser.mass * 1.1 && collision.aUser.radius > Math.sqrt(Math.pow(collision.aUser.x - collision.bUser.x, 2) + Math.pow(collision.aUser.y - collision.bUser.y, 2))*1.75) {
//if (collision.aUser.mass > collision.bUser.mass * 1.1 && collision.aUser.radius > Math.sqrt(Math.pow(collision.aUser.x - collision.bUser.x, 2) + Math.pow(collision.aUser.y - collision.bUser.y, 2))*10.75 ) {
if (collision.aUser.mass > collision.bUser.mass * 1.1 && 5000 > Math.sqrt(Math.pow(collision.aUser.x - collision.bUser.x, 2) + Math.pow(collision.aUser.y - collision.bUser.y, 2))*0.075 ) {
console.log('[DEBUG] Killing user: ' + collision.bUser.id);
console.log('[DEBUG] Collision info:');
console.log(collision);