Skip to main content
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
  • 27.3k
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
  • 121k
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
  • 121k
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
  • 15k
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
  • 121k
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

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
  • 121k
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
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,468
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

Collisions between players in multiplayer racing game

Do physics only on server. Here is an example workflow: Client presses "steer left". Client sends "steer left" request to server Server receives the data. Server steers instance of client on server ...
starikcetin's user avatar
  • 5,325
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

websockets authentication security

WSS means Websocket over TLS. So when you force the use of WSS instead of WS, you already solved most problems. Just make sure that The server certificate is valid and signed by a root CA The client ...
Philipp's user avatar
  • 121k
1 vote

How to optimize collisions

There are different ways to deal with collision, but we should always prioritize efficiency. A brute force algorithm such as the one you’ve implemented runs n^2 times, or at O(n^2), which is expensive ...
Hashim Jacobs'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
  • 121k
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
  • 136k
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
  • 27.3k
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,029
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
  • 121k
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

why are my client and server physics not syncing up? node.js and html5

In addition to @Nat's answer, you should find a way of calculating when the server got the info from client and using that info to predict the new position. Or even better using extrapolation. There'...
Kitanga Nday's user avatar

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