+ Reply to Thread
Results 1 to 8 of 8

Thread: How to enable 15 min trial lock?

  1. #1
    Senior Member
    Join Date
    Aug 2004
    Location
    Dorset, England
    Posts
    1,012

    Question How to enable 15 min trial lock?

    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.

  2. #2

    Default

    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...

  3. #3
    Senior Member
    Join Date
    Jul 2004
    Location
    Malta
    Posts
    273

    Default

    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.
    Nemesis

  4. #4
    Senior Member
    Join Date
    Aug 2004
    Location
    Dorset, England
    Posts
    1,012

    Default

    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.
    Indiepath Ltd
    "do good things - make money"
    And that is not the general opinion of Indiepath Ltd - etc... legal .... blah..

  5. #5

    Default

    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)
    Dominique

  6. #6
    Senior Member
    Join Date
    Aug 2004
    Location
    Dorset, England
    Posts
    1,012

    Default

    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.
    Indiepath Ltd
    "do good things - make money"
    And that is not the general opinion of Indiepath Ltd - etc... legal .... blah..

  7. #7

    Default

    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.
    Dominique

  8. #8
    Senior Member
    Join Date
    Aug 2004
    Location
    Dorset, England
    Posts
    1,012

    Default

    Ok. Thanks.
    Indiepath Ltd
    "do good things - make money"
    And that is not the general opinion of Indiepath Ltd - etc... legal .... blah..

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts