Page 1 of 2
Trial Version
Posted:
Thu Jan 19, 2012 5:05 am
by blockcrisisdeveloper
How can I add trial version to my game? for example I want the end user to be able to play it for 3 days then it gives a message after 3 days and quits and the user won't be able to play it anymore until he/she buys it?
Any help would be appreciated.
Thank you
Re: Trial Version
Posted:
Thu Jan 19, 2012 5:23 am
by skydereign
You can use a stTime vector and getTime, storing the date the game was first opened. This can be worked around by changing the system's date, but it's a start. You could alternatively allow them to play the game a certain number of times, or only for a certain amount of time (by tracking how long the game has run). To actually disable the game you could either ExitGame, or move to a screen telling them to buy the game, and use PauseGameOn.
Re: Trial Version
Posted:
Thu Jan 19, 2012 10:32 am
by master0500
couldn't this be worked around by also deleting the variable file?
Re: Trial Version
Posted:
Thu Jan 19, 2012 5:41 pm
by skydereign
You can't delete files in gE, though you could wipe it. But nominally if you have a wiped save file (or no save file) then you should create a new one.
Re: Trial Version
Posted:
Thu Jan 19, 2012 6:32 pm
by blockcrisisdeveloper
Hi thank you for your reply. Can you give me an example .ged or something showing stime?
Thank you
Re: Trial Version
Posted:
Thu Jan 19, 2012 7:11 pm
by SuperSonic
skydereign wrote:You can't delete files in gE, though you could wipe it. But nominally if you have a wiped save file (or no save file) then you should create a new one.
I think master meant, couldn't you delete the file that is created to show how long you have played the game?
Re: Trial Version
Posted:
Thu Jan 19, 2012 7:52 pm
by Jagmaster
blockcrisisdeveloper wrote:Hi thank you for your reply. Can you give me an example .ged or something showing stime?
Thank you
This should help you.
How to use GetTimeRegarding the other concern: I don't know how well this would work, and it would be pretty easy to hack into. what you'd do is open up a new .ged and then make a var named "Valid" and save it in a group named "Registration" or something hard to guess like "aRFG23q@#452xcnf". Then, in the create actor for the view place this code:
- Code: Select all
Valid=1;// Make this equal any quantity you want. For added security you could use a string variable.
saveVars("Registration_File.sav", "Registration");
Save the.ged document and hit game mode.
You will now have a .sav file in the same directory as the .ged document.
In your actual game, you'd add the same variable with the exact name and save group name as you did in the previous .ged.
On create actor of view in your game,
- Code: Select all
loadVars("Registration_File.sav", "Registration");
if(Valid!=1)
{
ExitGame();
}
If you delete the Registration file, the game will close! To make this work, you'll need to include the Registration_File.sav file in the folder with the game when you compress it or whatever. You'll want to record the time in the same file, only crate a different save group. And that's it!
I hope it helps anyways.
Re: Trial Version
Posted:
Thu Jan 19, 2012 10:39 pm
by skydereign
SuperSonic wrote:skydereign wrote:You can't delete files in gE, though you could wipe it. But nominally if you have a wiped save file (or no save file) then you should create a new one.
I think master meant, couldn't you delete the file that is created to show how long you have played the game?
Ah, well then yeah you could. But there is no other way to store information between plays. But, I guess if you really didn't want them to work around it, you could wipe the game file. I didn't suggest this before purely because it seems way to aggressive, but the only workaround is for them to have copied the game, or to download it. So, wherever you decide that they can't play the game anymore you can use an fopen("gamefile", "w"); to completely wipe the file.
By the way, blockcrisisdeveloper, is it safe to assume that nothing came of your work on the new interface?
Re: Trial Version
Posted:
Thu Jan 19, 2012 10:47 pm
by Jagmaster
I didn't think about anyone re-downloading it. That kinda throws my idea into the dirt
You could use the system I mentioned above for keeping someone from dragging and dropping a .dat game file onto the .exe, you could save the level in valid, and if the save file was lost, or the level's number didn't match the saved number, you could display an error message or something. I guess.
That wouldn't use binary files, only the built in var saving system.
Quick question, is fopen, fclose and the File pointer compatible with the built in var saving system? I'm assuming so to some extent.
Re: Trial Version
Posted:
Thu Jan 19, 2012 10:55 pm
by skydereign
The only improvement I can think of is when you do want the game to delete itself, create another hidden file. That way you can put something in the view checking if the file exists, and if so, rewipe the game. That way if they for instance redownload or update the game, the file would still exist, and therefore allow you to detect that the game should be wiped. Just so you know there will always be a workaround, your hope though should be that the vast majority of people don't try to do so (which most people won't).
Re: Trial Version
Posted:
Thu Jan 19, 2012 11:20 pm
by Jagmaster
Wiping the game itself is a pretty good idea. You'd have to make a startup application that would check the file and then erase the actual game once the trial expired. I just realized after a bit of trial and error that the game cannot erase itself. Possibly some kind of safety mechanism?
And Skydereign, how would do write a hidden file? is there some kind of operator in fopen like w+b, perhaps maybe w+h or something like that?
Re: Trial Version
Posted:
Thu Jan 19, 2012 11:31 pm
by skydereign
At least on mac, I can have it erase the contents of the ged or the export, it doesn't really matter. As for the hidden file, it depends on the os. It's easy on mac and linux, as you just add a . before the name. The thing is that doesn't work on windows. So, you could create the file on windows, and set in its attribute to be hidden, name it something like .erase, and then it should appear invisible on most computers. Then you use it where if there is a 1 in the file, then delete the game.
Re: Trial Version
Posted:
Thu Jan 19, 2012 11:54 pm
by Jagmaster
About the Game erasing. Both of these examples have the exact same code.
Game1 cannot erase itself. Game2 can erase Game1 though.
Tell me if I'm wrong. If it is so on your end, it might be some kind of built in safety feature. Either that or it's just my computer.
MouseDown>>
- Code: Select all
FILE* file = fopen("Game.exe", "w");
fclose(file);
- Game.exe
- This game cannot erase itself.
- (1.37 MiB) Downloaded 151 times
- Game2.exe
- This game can erase Game.exe
- (1.37 MiB) Downloaded 154 times
Regarding the hidden files; thanks for the answer. It's a pity windows can't do that. The rather devious side of me would think that would make some pretty strange bloatware.
Well, I guess you learn something everyday. It's fun to try and come up with a fool-proof system, almost like setting up a puzzle in a way.
Re: Trial Version
Posted:
Fri Jan 20, 2012 12:12 am
by skydereign
Ah, when I tested it, it was on a mac. I forgot that in windows you can't delete (or edit) a file that is running (also the case for linux). So as you say, you would use a loader file, and it can erase your actual file. This method is also preferable for other reasons, as it allows you to load the gE engine via a small game, and then the .dat file of your actual game. That way you can display some actual graphics as the game loads, instead of a black screen. That and you aren't deleting the file the computer is running...
Re: Trial Version
Posted:
Fri Jan 20, 2012 8:34 am
by Wertyboy
Sound cool... but well i need demo.... cuz i'm lazy to do myself with these things