PDA

View Full Version : How to enable 15 min trial lock?



Indiepath
08-22-2004, 08:29 PM
How to enable 15 min trial lock to your game? Of course I know how to get my game to calculate time during the game but I don't know how to save the value to somewhere so that user won't simply re-install the game and start their 15 min trial lock again.

MiCo Games
08-23-2004, 12:49 AM
A simple way is to just write a value into the registry, and check if this value exists when the game starts. There are ways for a user to track which values change in the registry when a program is run, but casual players usually don't know this, so it should be fine...

Nemesis
08-23-2004, 06:26 AM
That is assuming a Windows target platform. If you're writing for a different OS, or planning to release on multiple platforms I would suggest sealing off the trial storage code (or whatever) in a library and have different implementations for each platform.

Then, in your game code you simply call the related function in the library.

Indiepath
08-24-2004, 04:17 AM
Hmm... registry sounds a bit scary to tweak and was hoping to get a ready-made-solution for this. I guess I could simply use files which are stored in /windows/ directory for example. Thanks for the replies.

Dominique Biesmans
08-24-2004, 04:36 AM
I guess I could simply use files which are stored in /windows/ directory for example.


you could, but that would make it impossible for a non Administrator to run the game (since a regular user doesn't have read and certainly not write rights on the /windows/ tree). On Win9x you might be allright.

You should use something like "C:\Documents and Settings\All Users\Application Data" to store files that are common to all users. (Note: don't harcode this path but use SHGetSpecialFolderLocation() with CSIDL_COMMON_APPDATA)

Indiepath
08-24-2004, 11:39 PM
There are functions which can check where windows system (or similar) directory is located. I think I'll use that. Thanks for the suggestion though.

Dominique Biesmans
08-25-2004, 03:08 AM
There are functions which can check where windows system (or similar) directory is located. I think I'll use that. Thanks for the suggestion though.


yes, the SHGetSpecialFolderLocation() function I told you about does exactly that. You'd just have to pass CSIDL_SYSTEM instead.

_But_ /windows/system isn't the place where you should store such files, and any user playing your game that isn't an adminstrator doesn't have access rights in /windows/system, meaning your game won't run for such a user.

Indiepath
08-25-2004, 05:33 AM
Ok. Thanks.