59 votes
Accepted

Prevent cheating in html Javascript game

You can't. Javascript is executed on the users machine. Whatever is executed on the client side can be manipulated by the client. All mainstream web browsers come with powerful debugging tools out-of-...
Philipp's user avatar
  • 119k
45 votes
Accepted

What is a "normal" in game development

Direct Answer I see that other answer going into technical details, but I don't know if that hits the spot for answering "What are even normals" - so here's a plain English answer for ...
Raphael Schmitz's user avatar
34 votes

What is a "normal" in game development

In the context of geometry, a normal is a vector that is oriented perpendicular to a given object. It is commonly used for lighting calculations, but it can also be used to for calculating visibility, ...
Pikalek's user avatar
  • 12.2k
29 votes
Accepted

Wondering if there is a more efficient way to store level data in my game?

You should have the data for your level in an external source, such as an XML, JSON, YAML, CSV, or even a .txt file. Then you write your logic to read from the file, and generate the level ...
Evorlor's user avatar
  • 5,783
17 votes

Prevent cheating in html Javascript game

Put spoilers for the new star Wars movie and or other movies/books/shows in the code to deter people from looking at the code.
Chimeara's user avatar
  • 319
17 votes
Accepted

How To Upload JavaScript Games To Steam

Steam only deals with downloadable games, not browser games, so you'll need to package your game using something like nw.js or Electron. Also you might want this library for integrating with ...
jhocking's user avatar
  • 15.8k
11 votes
Accepted

How to avoid cost comparison each and every frame?

A boolean check is a very inexpensive thing. I wouldn't worry at all about performance costs. But there are two ways to go about this: Push or Pull. Either you 'pull' the data by checking every tick, ...
Steve's user avatar
  • 286
10 votes

Prevent cheating in html Javascript game

Well, for me personally it depends fully on what type of javascript game that it is: In the case of a single player game... let them cheat! Lets say you rewrite the wheel, and put as many roadblocks ...
return true's user avatar
10 votes

How to optimize collisions

Query only nearby objects As you already know, you need to check only nearby objects. This means that you need a way to retrieve a list of nearby objects to check. To do that, you need to divide the ...
Theraot's user avatar
  • 26.2k
8 votes

How do I keep a PHP server running forever?

One way to do this is not to change the actual values in the database in realtime. When the player logs on, you see how long it's been, and how much stuff he should have if he were earning during the ...
Almo's user avatar
  • 6,688
8 votes
Accepted

Find ID from Spiral x, y positions. Hard programming formula

Let's add some colour coding to see if we can reveal some structure in the problem: Here I've colour-coded the spiral into concentric rings of alternating colours. You'll notice the tile just before ...
DMGregory's user avatar
  • 134k
8 votes

Wondering if there is a more efficient way to store level data in my game?

String literals An easy way could be to use a string-literal and a function which loops over it and creates the level: ...
Falco's user avatar
  • 201
7 votes

Determing winning on the server side or client side?

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 ...
Philipp's user avatar
  • 119k
7 votes
Accepted

How can I use vibration of an iPhone for my HTML / Javascript game?

As you have found out, the W3C Vibration API is not supported in the iOS Safari browser (as reported here: https://caniuse.com/#feat=vibration). However, you've pointed out that you plan to package ...
Crumbledore's user avatar
7 votes
Accepted

Completely Pixelated Font in JavaScript Canvas?

In the css, you need to disable font smoothing for canvas: canvas{ font-smooth: never; -webkit-font-smoothing : none; }
mushrombrother.jpg's user avatar
6 votes
Accepted

Unity JS to C# conversion - Incomplete list of public variables in Inspector

Your missing data from the included instance of AudioClips. UnityScript is a little more flexible, in that it already serialises these things for you. In C#, you ...
Gnemlock's user avatar
  • 5,253
6 votes

How To Upload JavaScript Games To Steam

The current (2/21/2017), general process as described on the Greenlight FAQ: Who should submit their games to Steam Greenlight? Is there another way to submit my game to Steam? Steam ...
Pikalek's user avatar
  • 12.2k
6 votes
Accepted

How to handle complex inputs in 2D platform game?

This is an excellent question because you are experiencing a problem that's quite commonplace with less experienced programmers: attempting to solve your problem with a purely imperative approach. ...
Pharap's user avatar
  • 1,627
5 votes
Accepted

How to center a tilemap in Phaser?

I found out why it was not working... I needed to do this: layer.fixedToCamera = false;
Leonardo Seccia's user avatar
5 votes

I need a map generation algorithm for towerdefense

Recently I worked on the map generation algorithm for a tower defense game. The approach I took was to take a maze generation algorithm and use the solution path as the path that creeps follow. This ...
congusbongus's user avatar
  • 14.8k
5 votes

Determing winning on the server side or client side?

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 ...
Bálint's user avatar
  • 14.9k
5 votes
Accepted

2D Websocket WebGL game

1: Should the client wait for confirmation before moving the player? Websockets use the TCP protocol, which can have very irregular latencies from time to time (which is usually why UDP is ...
Philipp's user avatar
  • 119k
5 votes
Accepted

Security concerns related to HTML 5 games

I would like to know if people could modify an HTML 5 game's code Yes. Like all web technologies, the client has full access to the local code; they can browse the source, modify it and send ...
Vaillancourt's user avatar
  • 16.3k
5 votes

How to prevent (most) cheating (server-side) in my JavaScript, Node JS, socket.io MORPG?

There is just one way to prevent cheating: Handle all your game mechanics on the server. Anthing else is snake-oil. That applies even more to web-based games where every player can access all kinds ...
Philipp's user avatar
  • 119k
5 votes
Accepted

How to reduce the total time spent checking against my world bounds?

Your code for checking the boundaries looks good enough, but the frequency of which you call this function might be brought into question. Do you really want to do this collision check every frame for ...
eclmist's user avatar
  • 1,153
5 votes
Accepted

Representation of trains on a simplified rail grid

On tracking Your current simulation behaves pretty well, I would say. Because a rail wagon that is halfway a sharp bend, will indeed exhibit the behaviour that the wagon's center is no longer above ...
Bram's user avatar
  • 3,729
5 votes
Accepted

Would it be possible to make a Game Genie like program in Javascript?

What exactly do you want to replicate from a Game Genie code? The format of the original can be found in the docs here, but fundamentally they identified a part of the memory to change and the type of ...
Basic's user avatar
  • 1,242
4 votes

How to handle multiplayer in JavaScript?

Both the question and the accepted answer were published in 2011, and the times have quite changed since :) Websockets is quite prevalent, but an even better technology is WebRTC which allows for ...
OpherV's user avatar
  • 655
4 votes
Accepted

Understanding Javascript Variable Initialization

What you're looking at is an in-line initialization of an associative array (which functions similarly to a dictionary or map in other languages). If you made a variable in javascript like so: ...
Foggzie's user avatar
  • 1,222

Only top scored, non community-wiki answers of a minimum length are eligible