p5.js using global scope
There's a lot of good games on Repl.it using p5.js, but they're easily hacked simply because p5 uses functions in the global scope, e.g
mouseClicked(). Is this good practice?
That's the cost of importing global code. Generally, nowadays, it's not good practice anymore.
I'm not sure if there's a p5.mjs though.
@realTronsi You can make it hard enough, to the point that nobody would bother trying to hack your app in the first place. It is always possible to hack, whether it be "changing" the amount of Robux you have by editing the DOM, or scamming others out of millions via an exploit in a game.
@tussiez Okay so you need to clarify that next time, as I mentioned client side game multiple times. Anyways, in this case, you have to implement the game in the server like normal people, as anti hack on the client is both useless and impossible.
If you have a live fps based game where players affect each other directly, do it live, otherwise you can do it asynchronously, where an engine is both on the client and server, and the server checks the legitimacy of the inputs and outputs
@xxpertHacker yes never said they weren't bad, but you can't just stop using libraries because of that, and also I was addressing the "anti-hack" and trying to tell them anti-hack isn't possible. Just don't use global variables for the sake of code readability and good practice, not for "anti hack"