# How to properly protect a flash game?

If I understand correctly, the main point of protecting a single player flash game is to keep it sitelocked. How to do this right and are there any other reasons to do this?

• Wouldn't an iFrame circumvent sitelocking? I know it's an age old debate, but I believe, since people will steal your content anyhow, it might be better to embed advertising and at least get revenue from it. And if they steal it, at least they don't steal your bandwidth. Of course, the downside is that you can't post updates once it leaves your site.
– Kaj
Jul 27, 2010 at 23:46

The best solution for site locking is to make sure the start of the url matches your allowed url:

if (stage.loaderInfo.url.indexOf("http://www.kongregate.com") == 0)
{
trace("OK!");
}
else
{
trace("stolen!");
}

• don't forget to check for no "www" and simetimes you might have to check for "https". You might have to also watch out for other subdomains. This is not a good solution in my opinion. Sep 20, 2010 at 20:27

Don't. People will steal your game, no matter what you do. Trying to sitelock a flash game smells of DRM to me (OK, it's not quite DRM, but it's pretty close), and you can read all about why DRM isn't going to work. That's not to say you shouldn't use any protection system at all, just not something that you have to visit their site a particular way and do the hokey pokey to play the game.

• The best you can hope for is that you have ads or some other revenue model built in so that when your game does get stolen (as it will) that you'll still make some money from it. Trying to prevent the game from being stolen is not going to be productive at all. It's better to take advantage of it and allow the game to be stolen while still giving you benefits. Jul 29, 2010 at 13:43
– RCIX
Jul 29, 2010 at 14:44
• I've got no problem with ads as long as they are added in a meaningful way and unobtrusive way. Aug 2, 2010 at 19:33
• Depending on the size and popularity of the title, a sitelock could easily prevent all actual users from stealing it. Only if the game becomes very popular will this ~DRM be circumvented.
– Nate
Sep 20, 2010 at 17:06

Sitelocking keeps honest sites honest, and is useful when, for example, you've got an exclusive period on a site but plan to distribute the game afterward. It's not going to stop someone dedicated enough, and I agree that it's better to put in MochiAds or something to take advantage of the distribution.

One case in which sitelocking is vital is when you are selling non-exclusive licenses after you've done a primary license. In that case, sitelocking ensures that the nonexclusively-branded version doesn't spread, since the sublicensing sponsor is paying less and you've already promised the primary sponsor all of the viral traffic. Yes, the sublicensor can circumvent it, but if you don't trust them, you shouldn't do business with them in the first place.

Buy an encoding software, so reverse engineering softwares won't work. They cost like 40-50 bucks and since game development is a long and tedious process, it really worth investing.

Example: http://www.dcomsoft.com/

• Encoding software creates an extra hurdle, but doesn't protect your game from reverse engineering. If the flash player can play it, it can be decompiled. Aug 6, 2010 at 6:53
• Funny side note: Eltima's trillix can decompile dcomsoft's swf protector protected files. And dcomsoft and eltima "seem" to be the same company. Aug 6, 2010 at 6:55

you can see this topic it may help

Protect Your Flash Files From Decompilers by Using Encryption