Skip to main content
14 votes

What to do when my game is rejected by CrazyGames?

From the CrazyGames Developer FAQ, under the heading Uploading my games: Can I submit a rejected game again? Only if you have improved your game and it follows our quality guidelines. One thing that ...
Pikalek's user avatar
  • 12.5k
11 votes
Accepted

HTML5 games: play() failed because the user didn't interact with the document first

There is a good reason for this precaution: Users usually don't expect audio from websites. They get really angry when they load a website, and an audio advertisement blares at them at full volume. ...
Philipp's user avatar
  • 121k
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
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

What to do when my game is rejected by CrazyGames?

I just saw your game, and no offense, but it looks like it is subpar quality compared to the other apps on the site. Off the top of my head, I can list several points that may be fundamentally wrong ...
Simon C's user avatar
  • 51
4 votes
Accepted

HTML5 realtime MMO games, should I do server side physics update or client side?

Unless you want players to be able to teleport through walls using their browsers build-in JavaScript debugger, you will have to implement any game mechanics worth manipulating on the server. This ...
Philipp's user avatar
  • 121k
3 votes
Accepted

How to draw an image on canvas without html

Philip's suggested improvement to DMGregory's answer is important. ...
Jose_X's user avatar
  • 146
3 votes

How can I convert an Android game to HTML5?

There are some frameworks (like PhoneGap) which can build an application for multiple build targets. But only if you developed the application from scratch with that framework. When it is a native ...
Philipp's user avatar
  • 121k
3 votes
Accepted

WWW request does not connect using webgl platform

When you look into your browsers error console, you will likely notice an error message like this: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http:...
Philipp's user avatar
  • 121k
3 votes
Accepted

WEBGL antialias false to pixel art low resolution

Helped me in html5gamedevs forum. Solution: The scale mode of the texture needs to be set to nearest. You can either do that on a texture by texture basis via the scaleMode property, or change ...
salc2's user avatar
  • 141
3 votes
Accepted

online game, NPC monster death and hit detection to gain experience points

When you want a cheating-proof client/server game, then you need to handle all game mechanics which are worth cheating on the server. Don't send "Player X hits enemy Y for Z damage". Just send "...
Philipp's user avatar
  • 121k
3 votes

How to improve load times of audio files without loosing too much quality for HTML5 game?

When you take an audio clip which is already encoded in a lossy compression format and then re-encode it again with a different lossy compression, then any compression artifacts will accumulate and ...
Philipp's user avatar
  • 121k
3 votes
Accepted

How to get projectile direction vector in a 2d grid?

To find the unit vector from the angle you want to use cosine(angle) for the x-component and sin(angle) for the y-component. The angle must be in radians. You can convert from degrees to radians by ...
SquidJelly's user avatar
3 votes

How can I convert an html5 web game to an android app?

Your first step should typically be to simplify the app down to its simplest working version. Gut everything that is causing the app to fail to run on the new platform (comment it out OR put in mock/...
Engineer's user avatar
  • 30.3k
3 votes
Accepted

In regards to real time turn based games, where should the turn handler be?

The general rule of thumb for handling multiplayer games is that any game mechanics which can be handled on the server should be handled on the server. There are two reasons for that: The less the ...
Philipp's user avatar
  • 121k
3 votes
Accepted

How can I protect against a cheater changing variables on the client?

This won't prevent all cheating but at least will make it harder for the average cheat engine/ change variable hack. Follow the simple advise: Don't trust the client. Now what does that mean? Usually ...
Zibelas's user avatar
  • 4,618
2 votes
Accepted

2d game with 3d js. game engine

2d rendering is easily possible with 3d rendering engines, even when there is no explicit support for it. How it would work: Just put your two-dimensional geometry parallel to the xy-plane (or any ...
LukeG's user avatar
  • 1,547
2 votes

Is it possible to write a game with a HTML5+REST service architecture?

The problem with REST is that it is based on HTTP, which is not a protocol designed for low latencies or minimizing traffic. When you just want to send a few bytes, the HTTP header will generate huge ...
Philipp's user avatar
  • 121k
2 votes

HTML5 - check if font has loaded

The JavaScript FontFace class is (as of July 2020) still a working draft, but already supported by all browsers except (as usual) Internet Explorer. It can be used to load a font via JavaScript and ...
Philipp's user avatar
  • 121k
2 votes
Accepted

requestAnimationFrame handles game ticks weird when tab isn't viewed

Indeed, that's one of the "features" of requestAnimationFrame, it frees resources from not-focused tabs. To use this animation method you should use deltatime to keep track of the time elapsed ...
PRDeving's user avatar
  • 755
2 votes
Accepted

unity webgl scale page on different sizes of internet browsers on pc or phone

change the HTML as documented here. You can choose either one of the defaults or create your own template. According to those docs you create folder in Assets ...
gman's user avatar
  • 850
2 votes

Implementing multiplayer aspect of a simple HTML5 game

I remember struggling with the same thing actually and here it is. I figured it out not long time ago. I will use the rotating triangle as an example. The server is the one that needs to figure out ...
Joza100's user avatar
  • 269
2 votes

How to improve load times of audio files without loosing too much quality for HTML5 game?

I will assume that you have exhausted all that may come from encoding and compression. First off, load only what you need next, use a load scene when appropriate. Now, what you probably want is to ...
Theraot's user avatar
  • 27.5k
2 votes
Accepted

How to get the address of a nearby square on a chess board?

It looks to me like what you really want is a 2D array for managing your board state, which in JavaScript you can accomplish with a nested array. Your x & y coordinates stay as plain integers ...
DMGregory's user avatar
  • 136k
2 votes

Why does my godot game not take input in the browser?

Cause of the problem: I have two scripts named p2.gd and p1.gd inheriting from a base player class. I had not named the base class. So, my p1 and p2 scripts contained references to player.gd in terms ...
ashir's user avatar
  • 31
2 votes
Accepted

What is the best way to store level data in HTML5

There is no "best" way. Only the way that works best for your game. But loading data from files via fetch at runtime is certainly not the worst idea. ...
Philipp's user avatar
  • 121k
1 vote

How to Structure my Database for a HTML turn-based strategy game?

It really doesn't matter which database you use for this. You can use pretty much any. The sql-by-the-book solution for storing the current state of all games would be to create a table with these ...
Philipp's user avatar
  • 121k
1 vote
Accepted

Checking if bullet collides with enemy when I know the start X & Y, the angle, the speed and dist traveled of the bullets

To check if the bullet is currently inside a player, you can test the distance between the player and the bullet. If they are closer together than the radius of the player circle, then the bullet is ...
Victor T.'s user avatar
  • 1,381
1 vote
Accepted

How to automate the game

Your Update function holds too many responsibilities. It looks like it currently is responsible for: Handling a tick Processing user input Updating car position Updating car direction By delegating ...
Peter's user avatar
  • 9,955
1 vote

How to change the color of an image when getting points

If you only have 1 car image, you can use javascript to give the car a css property hue-rotate() to change its color. If you have multiple car images with ...
Jackyef's user avatar
  • 111

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