Simple protection of published game

2

Index

Attached Files

The following files have been attached to this tutorial:

.capx

security-url.capx

Download now 194.04 KB

Stats

9,470 visits, 23,180 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 16 Feb, 2014. Last updated 19 Feb, 2019

Thou shalt be punished

Preparation

We only need three objects in our game:

> Browser - to test current url address

> Text or Spritefont - to display some informations

> Mouse - for interaction

Layout

Place two instances of Spritefont in the layout and give them instance text variable called name

For the upper instance of Spritefont set name to test

and for bottom one set name to play.

Events: Security check

I'm using this in my game, so to have everything nice and tidy I made a group called Security check.

Inside this group we insert condition called Compare two values.

For First value we needs to set expression from Browser object called Browse.URL and in Second value we need to place link to our game. In my example it will be https://dl.dropboxusercontent.com/u/34375299/Construct%202/examples/Security%20test/index.html.

We now use instance variable of Spritefont to differentiate which one will show informations about originality of our game, and one to play/redirect to game.

We use sub-events for that. Add two conditions Spritefont | Compare instance variable as a sub-events of System | Compare two values condition.

In first comparison set value to "test" and for second one set value to "play" .

"test" will show information if we are on original/not game url and

"play" will display: play game or go to original url.

In my example:

"test" to "WELCOME TO THE SOURCE"

"play" to "CLICK HERE TO PLAY"

This two texts will be valid and show this informations only if we run game from our place.

Now we need to duplicate and invert this events to display different text if game runs from different place.

To duplicate events, select System | Compare two values and press Ctrl+C and Ctrl+V.

To invert, select System | Compare two values and press key "I" or right click on System | Compare two values and select Invert

We have now a simple test that will tell us if our game is on our server or somewhere else.

Events: Interactions

Almost done. All left to do is to make bottom SpriteFont act as a button.

Under Security check group create new condition Spritefont | Compare instance variable name = "play"

add sub-event Mouse | On Left button Clicked on SpriteFont.

Place action for this sub-event from Browser object called Go to URL and in the URL field past link to your game.

This is not required but I've added two more events to change SpriteFont opacity and Mouse cursor style when mouse is over text.

That's it. You have now simple but effective security check for your game!

  • 0 Comments

Want to leave a comment? Login or Register an account!