2

I would post this on https://stackoverflow.com/, but figured I am not looking for code, just an idea how to accomplish this.

I have a gameserver that interacts with nodejs and uses the websocket module. It works great, there is one problem:

When a user is joining a game and the map gets loaded, a user could easily press F12, go into Chrome dev tools and remove the overflow:hidden css attribute, thus.. revealing the rest of the map. (A Web-based map hack!). My map dimensions are 3000x3000 + in size.

I need some type of way to to send something to nodejs every xx seconds and then nodejs needs to send back a token with that request as well to keep that css attribute at overflow:hidden and if the data being sent is manipulated in anyway, I can then shut down that player's connection.

Doing this method, I would use the setInterval with Javascript to create the heartbeat. Am I going about this the right way?

Edit: And yes, this will require more bandwidth, but well worth it imo.

3

You'd be better off using that extra bandwidth to spoon feed the map to the users as they discover it.

As you've noticed, anything client side can be easily hacked. You might think of a fancy way to encrypt the data, but you'd still have to send the decrypt keys to the browser.

For that matter, you don't really know if you're talking to a browser at all - you're just sending data over a TCP port to a computer that kind of maybe sort of looks like it might be a common web browser.

  • Sweet. I will give this a try intead. So, let's say when a playing is moving around the map, have a trigger at an XY position or different points around the map (my game is 2d isometrics) to load in the tiles/monsters dynamically? – Nick Newman May 20 '15 at 4:02
  • That sounds right to me. – Dan Pichelman May 20 '15 at 4:04
  • Thanks Dan, I had a light-bulb moment after reading your answer, ha. – Nick Newman May 20 '15 at 4:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.