2

I am building an online game, similar to a flash online game, but using HTML only. (HTML5)

I would like to prevent people from copying it and putting the game on their site.

With flash, I used to do this by adding the URL check to make sure it was running on my site, but this seems useless if i can only put the check in Javascript.

Is there anything that can prevent someone from simply copying the game?

as a followup..

Can I protect the source at all? (aside from obfuscation with javascript.)

Thanks!

nycynik
  • 7,371
  • 8
  • 62
  • 87

2 Answers2

2

No way to do this, it's the nature of the web. Your best bet is obfuscating your code.

Jan
  • 8,011
  • 3
  • 38
  • 60
  • ...or change your commercial model. Good products (and consequently, large profits) are all about the intangibles. If you offer a better game, faster servers, great customer service, and a good all-around experience, your customers will buy from you. It doesn't really matter if some Chinese guy scrapes your code; he can't do those things as well as you. – George Cummins Jun 17 '11 at 20:32
  • Indeed. Competition can have your code, but it will never be up to date because you're always a step ahead. – Jan Jun 17 '11 at 23:18
2

Unfortunately if the game engine is 100% JavaScript, the most practical way to do this would be with obfuscating your code. Here's a link to a site that does just that.

However, by using Ajax which allows your client side script to communicate with your server, you can store the majority of your game's logic and functionality on your server in any type of server-side scripting such as PHP.

Basically your PHP (or some other language) files on your site would get requests from the user's machine to make decisions about logic in the game whenever logic is needed for the game to function, and your server would respond, all through using Ajax. Then someone could only really copy half of your game - that part stored in JavaScript.

The one downside with this method is that it may slow down the user's game drastically due to having to communicate with the server constantly.

Hope this helped and made sense!

Jeff Gortmaker
  • 4,607
  • 3
  • 22
  • 29