Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

183
Vistas
creating an anti cheat in an online web game

I have a simple website with a little game in it. It has a basic scoreboard using express - every time you die the website send a post request to the server with your score and the server adds it to the leaderboard. My problem is that its very simple for the leaderboard to be exploited. through devtools people can easily just:

  • disable the colliders so they cant die and then turning it back on when they are happy with the score
  • straight up just set the score to what ever value they want
  • use the console to send a post request of their own with a score of their choice

I thought about creating a server side score counter and collision checker but my game is fast paced so I think this would be problematic, not talking about the computing power that it would put on the server if multiple people play at the same time.

Is this really the only solution or are there simpler solutions I'm not thinking of?

server code:

const express = require('express');
const app = express();
const fs = require('fs');

const { json } = require('express');

app.use(express.json());
app.use(express.urlencoded({extended:true}));
app.use(express.static('Build'))

app.get('/leaderBoard', (req,res)=>{
    var rawData = fs.readFileSync('./database.json');
    var data = JSON.parse(rawData);
    res.json(data);
})

app.post('/leaderBoard', (req, res)=>{
    var rawData = fs.readFileSync('./database.json');
    var leaderBoard = JSON.parse(rawData).leaderBoard;

    for(var i = 0; i < leaderBoard.length; i++){
        if(req.body.score > leaderBoard[i].score){
            for(let i2 = leaderBoard.length -1; i2 > i; i2--)
                leaderBoard[i2] = leaderBoard[i2-1];
            
            leaderBoard[i] = req.body;
            break;
        }
    }

    fs.writeFileSync("./database.json",JSON.stringify({leaderBoard},null,2));
})

app.listen(process.env.PORT || 3000);
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

A server side check would be imperative if you want to truly avoid any cheating... BUT, you could always make it harder to cheat on the client side with simple checks, like defining a maximum score change (for example if someone gains more than 100 points in 1 second, then he's cheating).

Using a minified code can't hurt, and you could also replace your variables name by abstract ones (a, b, c, instead of "score"). For that same reason, a collision check shouldn't just be defined by a true/false flag.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda