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.6k
7 votes
Accepted

Should I use secure WebSockets for a game?

Yes. You definitely should. Use Let's Encrypt to get a free SSL certificate (or as many as you want or need). SSL is always good to have: without it, man-in-the-middle attacks will be launched, by ...
Lucien's user avatar
  • 1,176
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
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

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
4 votes
Accepted

cron jobs for MMO browser game

Do lazy evaluation of player build progression. Whenever you need to retrieve the state of a player from your database for any reason, check how old that state is, progress the time which elapsed ...
Philipp's user avatar
  • 119k
4 votes
Accepted

Unity websockets client disconnects after server emits with data

Finally, after many hours of debugging, found an error. This library expects data from server to be a JSON object, and not string (that's a bit weird because this library allows to send both string ...
Nick's user avatar
  • 561
3 votes

synchronizing client-server actions

The short of it is that your game design and art both need to be built around the realities of networked play. When the user clicks, they should not immediately attack. Instead, the animation/effects ...
Sean Middleditch's user avatar
3 votes

How to optimize collisions

My game is working fine for now, but there's no real way to test with 50 players until people actually start playing. There is. Just write a bot client for stress-testing your gameserver. While it is ...
Philipp's user avatar
  • 119k
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,291
2 votes

synchronizing client-server actions

With the following model the client will render only what the server tells him to render. The client becomes an input & input-pre-emission-validator The server is the final-validator (don't ...
unknown.0perator's user avatar
2 votes

unity, socketio, nodejs. amount of messages sent is multiplied by amount of NPcs that have ever spawned

Figured out the problem: it was a remnant from a previous build in which I was trying to store all enemy data in variables and was not closing the registration of enemies properly: changed ...
Svp's user avatar
  • 43
2 votes

Multiplayer Game - Node.js syncing other players' position

Approach 1) is traditionally used in RTS types of games where timing is very important. However, this approach has the downside of increasing by a lot the chances of clients cheating. Since the client ...
Vaillancourt's user avatar
  • 16.3k
2 votes
Accepted

How to create additional rooms for new play sessions in a 2-player online game on Node.js?

I would suggest not using Socket.IO's rooms mechanism. It is not very flexible and isn't very appropriate for a robust server architecture. Here's a quick scribble of how you could structure your ...
Kal_Torak's user avatar
  • 146
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
  • 259
2 votes

Why are not the images loaded in Phaser?

I tested your Phaser Javascript code and it works fine. So I'm thinking it's a problem with how you've set up your server. Look up Express.js, its an NPM module that makes it really easy to set up ...
Dabe's user avatar
  • 21
2 votes

Unity websockets client disconnects after server emits with data

I don't have enough reputation to comment yet but I wanted to thank Nick for the above answer. I was facing the same issue but my Unity client was disconnecting when the server sent events that it ...
Dave Seidman's user avatar
2 votes
Accepted

Authoritative game server and database storage

Sending the data to the client before you are sure that it was successfully stored in the database, you run the risk that the client will display information to the user that the server ultimately ...
Hymns For Disco's user avatar
1 vote

Turning a simple HTML5/JS single-player game into a multi-player one

Turning a game developed for singleplayer into a multiplayer game when it was not designed for that from the start can be extremely difficult, both regarding software architecture and regarding game ...
Philipp's user avatar
  • 119k
1 vote

How can I refer to a recipe defined in one function from elsewhere in my code?

When you define a variable with var, it exists only in the local scope: in this case, inside the anonymous function(currentGame). If you want the variable to have ...
DMGregory's user avatar
  • 134k
1 vote
Accepted

Can a block-chain with embedded shared content stop cheating?

Centralized Game If are going to control the servers of the game. You do not need a decentralized solution such as block-chain. In fact, you will not even need cryptography (beyond what is necessary ...
Theraot's user avatar
  • 26.6k
1 vote

how to handle server tick update for multiple rooms? (Nodejs)

You should remember that nodejs are single-thread. So if you start few setInterval timers with about 15hz - some of times timers may and will start skipping ticks (as setIntercal can do it when loop ...
Vladimir Ishenko's user avatar
1 vote
Accepted

Implementing Turn based Combat Using Node js

This is just an exercise in modeling the objects you want to represent your game. At the very least, you need a concept of the battling entities (players and creatures) and individual battles. The ...
Jimmy's user avatar
  • 9,019
1 vote

Multiplayer Game - Node.js syncing other players' position

1 - Client send input. 2 - Server calculate and broadcast: destination, direction, velocity and timing function (if you need acceleration or jump curve). 3 - Unit start moving (on server and on ...
Vladimir Ishenko's user avatar
1 vote
Accepted

Implement resolution scaling HTML5 canvas

You have an authoritative server. That server has no screen, so it doesn't make sense to use pixel-measurements in your game mechanics code. So you should make up a coordinate system which works for ...
Philipp's user avatar
  • 119k
1 vote
Accepted

Compare two x and y if they are in a valid range

You need the "absolute" method: abs(). This will return a value that is always greater than or equal to zero. This way, you only have to check once for each axis: <...
Vaillancourt's user avatar
  • 16.3k
1 vote
Accepted

Collision not working in phaser node multiplayer

Make sure you're sending the velocity of your physics bodies from the server too. Position alone won't cut it, because it's not the only thing that impacts how the game objects move. The most secure ...
Hexus's user avatar
  • 126
1 vote

Throw ball - distance and force

This can be done by measuring the distance between the touch and release point. Along with measuring the time difference from when the touch started until the release happened. Then simply take the ...
vallentin's user avatar
  • 380
1 vote

Should I use secure WebSockets for a game?

Just in addition to @Loblums answer: AFAIK socket.io uses WebSocket as its default transport. With WebSocket being relatively new, not all intermediaries on the internet may be aware of it and handle ...
gzost's user avatar
  • 111
1 vote

Best practice/way for client to speak with server

Talking about online games - all logic/collision/actions should be manager on server. (because user is a cheater by default) I understand that maybe one single unit jump with 50-100ms ping will looks ...
Vladimir Ishenko's user avatar

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