1
\$\begingroup\$

I am using JavaScript + Node.js+Websockets to develop a multiplayer card game. In my single game version the Win determining calculation is done on the client side (of course) with a function.

It looks something like this:

function(CheckWin){
if (something) {
player1 win
document.getElementById("winning").innerHTML="reason"
}
else if (something) {
player2 win
document.getElementById("winning").innerHTML="reason"
}
else if (something) {
player1 win
document.getElementById("winning").innerHTML="reason"
}

}

It is a bit chunky but that is how it is. So in my multiplayer game I can either:

  1. When all card values are collected, the server emits all the cards value to the client side and then it will execute the function there like it was in my single game (but I heard this is not SAFE)

  2. Execute the function in the server side and then emit the result to the client (but I don't know how to emit all this information, comments, winning to client with socket.io, I think socket.io can only emit limited number of value types, I am planning to emit just the Boolean value win or lose).

I am new with programming/gaming so hopefully this question is not too silly.

\$\endgroup\$
3
  • \$\begingroup\$ Do you really have pure text comments in your code? \$\endgroup\$
    – Bálint
    Feb 20, 2017 at 7:56
  • \$\begingroup\$ Yeah in my single game version whenever a winning condition is determined, the reason (text) will be shown on the screen. Doing this because I want the player know why they win or lose(the rule of the game is a bit complex) \$\endgroup\$
    – Frostless
    Feb 20, 2017 at 7:59
  • \$\begingroup\$ I'm speaking about the player 1 win and player 2 win between the if and setting the text. \$\endgroup\$
    – Bálint
    Feb 20, 2017 at 8:13

2 Answers 2

7
\$\begingroup\$

Hello visitors of Jindsay's Card Game Forum. Here is your friend xXx_GameH4x0rPhilipp_xXx with another cheat for you. Do you want to win every game? Here is a simple hack which works with every web browser:

  1. Press F12
  2. Click on "Debugger"
  3. Select check_win.js
  4. There is now a window with lots of programming code. Don't worry, you don't need to understand any of it. Just click on the line number 65. There should now be a little icon on it.
  5. Play the game to the end.
  6. When the game is over, it will seem as if the game is frozen, but it's not. The program is just paused. There should now be a little arrow next to line 65 in the code window.
  7. You will notice a window with variables to the right. Look for the variable player1Score and change it to 999999999
  8. Press F8 to continue the game.

The game will now say that you won the game, even when you lost.

This might change a little when jindsay updates the game. When it stops working, just send me a PM and I update above instructions. When jindsay reads this, he might try to make this more complicated and the above instructions might get a bit longer. But unless he moves all the game mechanics to the server and turns the client-sided programming into nothing but a dumb input-output interface, there will always be a way to do this cheat.

Have fun!

\$\endgroup\$
9
  • 4
    \$\begingroup\$ The sarcasm is strong in this one :v \$\endgroup\$ Feb 20, 2017 at 9:10
  • 2
    \$\begingroup\$ Ok now I know I should definitely not let the client to do the determining job... \$\endgroup\$
    – Frostless
    Feb 20, 2017 at 9:33
  • 2
    \$\begingroup\$ Please avoid sarcastic answers. Or at least wrap it into quote and post a sane TL;DR answer. Thank you. \$\endgroup\$
    – Kromster
    Feb 20, 2017 at 10:59
  • \$\begingroup\$ @Kromster it's not sarcasm. Sarcasm is something like "Yeah, it's a great idea to let the client cheat, what could happen?" \$\endgroup\$
    – Bálint
    Feb 20, 2017 at 11:12
  • \$\begingroup\$ @Bálint whatever it is, it's a poor fit for answer. \$\endgroup\$
    – Kromster
    Feb 20, 2017 at 11:28
5
\$\begingroup\$

Doing basically anything on client-side apat from the inputs is a bad idea. And believe me, if the programmers could collect inputs on the server side, so the client couldn't fake them, then they would happily do so.

Literally anyone can change the code to always register a winning condition. If they make it send it back to the server, than it's even worse.

The client shouldn't be a game, it should be a renderer to visualize the data sent by the server, every gameplay logic should be handled on server-side.

Every player is a cheater.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .