• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
MatrixTan

How to prevent cheating in html5 game?

6 posts in this topic

we know that the js source code of html5 games is visible for player. I want to record the player's score on server. But how to prevent cheating? The player can simulate a http request or change the result with debug mode in chrome.
 
for example, a physics game:
(It's hard :) )
 
How can I notify server of the if the player is succeed or not safely?
0

Share this post


Link to post
Share on other sites

The fact is that you can't do networking 100% safely.

However you can do some tricks to make it more safe.

 

The most secure way, which is also used by desktop games, is too let the server simulate. So the client only handles inputs and rendering. Unfortunately, this technique would require a lot of CPU power from the server, so that you can handle the amount of clients.

 

The second approach is to have some factors which are hard to find/hack, and which also determines if you have succeeded or not. Like in your example it is the position when the heart hits the princess. So you send the position of the heart, and lets the server validate it. This can easily be hacked, so to make this even better, you may create a random coordinate space to use when sending the position, and only use the local space to render the scene.

So, in other words you can't be safe, but you can try to prevent the most obvious attacks.

 

Edited by Tapped
0

Share this post


Link to post
Share on other sites

The fact is that you can't do networking 100% safely.

However you can do some tricks to make it more safe.

 

The most secure way, which is also used by desktop games, is too let the server simulate. So the client only handles inputs and rendering. Unfortunately, this technique would require a lot of CPU power from the server, so that you can handle the amount of clients.

 

The second approach is to have some factors which are hard to find/hack, and which also determines if you have succeeded or not. Like in your example it is the position when the heart hits the princess. So you send the position of the heart, and lets the server validate it. This can easily be hacked, so to make this even better, you may create a random coordinate space to use when sending the position, and only use the local space to render the scene.

So, in other words you can't be safe, but you can try to prevent the most obvious attacks.

 

Tanks for reply.

I thought about server simulation, but it's cost too much cpu for physics simulation as you‘v said. 

the second approach is a good idea. I'll try it. thank you.

0

Share this post


Link to post
Share on other sites

You should look into javascript minification and obfuscation.  It will not completely remove the ability for people to cheat by looking at your source code, but it should deter the majority of hackers.   

0

Share this post


Link to post
Share on other sites

@metsfan - I don't think that Javascript minification or obfuscation will do much to prevent cheating (maybe make cheating a bit more fun and appealing to those who might do it anyway)

 

In general you can't, and you should probably focus your effort in making a compelling game rather than preventing cheating. People can cheat in many types of games, and mostly they don't (particularly if it's single-player).

 

It is not really any easier to cheat in a HTML5 / Javascript game than one written in C++ and distributed as a binary (or NaCl, for example). This is particularly true if some or most of it is compiled e.g. with Emscripten.

0

Share this post


Link to post
Share on other sites

@metsfan - I don't think that Javascript minification or obfuscation will do much to prevent cheating (maybe make cheating a bit more fun and appealing to those who might do it anyway)

 

In general you can't, and you should probably focus your effort in making a compelling game rather than preventing cheating. People can cheat in many types of games, and mostly they don't (particularly if it's single-player).

 

It is not really any easier to cheat in a HTML5 / Javascript game than one written in C++ and distributed as a binary (or NaCl, for example). This is particularly true if some or most of it is compiled e.g. with Emscripten.

 

I respectfully disagree.  I agree that some hackers will see the challenge as appealing, but obfuscation as a security technique has been proven a successful deterrent   It will remove an entire class of hackers from wanting to hack your game.  It's the same reason encryption algorithms use a cypher.  Sure, a talented hacker with a lot of time on their hands could discover the cypher and crack the algorithm, but it will deter lower level hackers who dont have the skills to crack the cypher, and the hackers who dont feel like putting in the time to crack it.  You cannot prevent 100% of all hacking, it's about staying 1 step ahead, and putting hurdles in their way.

Edited by metsfan
0

Share this post


Link to post
Share on other sites

In general you can't, and you should probably focus your effort in making a compelling game rather than preventing cheating. People can cheat in many types of games, and mostly they don't (particularly if it's single-player).

 

I'm often amazed over how willing some players are to "cheat", even if it just means getting a top position on some highscore list, and gives them no benefit at all, except possibly bragging rights to their friends. (who probably mostly will think he just is a douche anyway)

 

The problem is that if cheating is too rampant, it can also seriously hurt how enjoyable the game is for the rest of the players.

 

Of course it is significantly easier to crack a program where you get the full source code (as in html5), instead of just a compiled binary, even though the latter ofcourse do not stop the dedicated "cracker".

 

So I think putting at least some hurdles in the way is a good idea, specially if "cracking" otherwise would just mean to figure out what http-request to put in your browsers adress bar. It will significantly lower the number of successful attempts, hopefully to a level where it does not destroy the enjoyability for the people who are interested in actually playing the game.

 

One example of a way, is to send a bigger portion of the final game state to the server for validation, instead of just the achieved score.

Send some key data (like positions and velocities, simulation time spent, mouse clicks done, etc), and validate if they are within reasonable limits, maybe even compare them to previous validated highscores.

Bigger blocks of data is also a bit trickier to figure out.

Then add some obfuscation too

Edited by Olof Hedman
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0