I'm building this game mostly because I want to experiment with Node.js and Socket.io, and the game is more like a proof of concept.
To start with, I have a 2D grid system as the game map.
_________________________________________.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|.
Each position with values:
0: empty
1: wall - can not be destroyed by explosion
2: obstacles - can be destroyed by explosion
3: bomb
4-9: some powerups
10>=: the id of player
CLIENT-SIDE
I'm not planning to have any game logic happen on the client side, so the client simply send left, right, up, down and plant a bomb command to my server. There is however, some simple check that happen on the client side - 1. check that there's no wall at the direction the client is moving to; 2. the client didn't plant a bomb in the last 3 seconds.
The client also receives the state of the map as a 2d array and knows how to draw everything using that info.
SERVER-SIDE
Main game logic happen on the server side, which includes updating the position of player, calculating the damage of bomb explosion - destroy stuff in the range, except walls and space behind walls
Questions:
When the player is moving, he won't see himself moved until he gets the data back from server that updates his position. So I worry this delay may affect user experience, is it better that I move his position on his browser right away, and only update other players' position using info received from server, that means his own movement is rendered away, while his position info is sent to server.
When rendering everything, it's simple to implement that whenever anything on the map move or change, redraw everything with the new data. Is that a waste? Can I only update things that change, for example, a player move right 1 position, nothing else changed on the game map, do I still have to redraw everything? I think I'm going to use Canvas to render.
Please feel free to comment or answer if you think there are places I can improve or I simply thought wrong, thanks!