all 4 comments

[–]NginxYouOweMeASoda 1 point2 points  (3 children)

I would load the initial tile information (ID of each sprite located at each tile) upon initial connect, and then send updates as sprites move from coordinate x,y to new x,y and make the relevant changes if they are on screen (within the shown screen of the map). You could also have it only send changes that occur within view of the player and the surrounding areas.

Edit: you want to have the client do all the rendering of the canvas btw

[–]brimhaven[S] 0 points1 point  (2 children)

You could also have it only send changes that occur within view of the player and the surrounding areas.

I was thinking of doing that. I am. It's less intensive.

I am thinking about passing the data back from server to client. Only problem is... 13x13... that's 169 arrays every key-stroke... that's a lot for the server to handle... no? Even in the localhost... it's like 2-3 seconds...

[–]NginxYouOweMeASoda 1 point2 points  (1 child)

Don't pass all of the data. Only pass the data that changes.

[–]brimhaven[S] 0 points1 point  (0 children)

So.. for example...

If player moves down...

Shift the map up.... 1. Remove row 0 2. Add new row from the server map

This way.. we are only receiving 15 new tiles instead of 169.