How to enable 15 min trial lock?

Discussion in 'Game Development (Technical)' started by Indiepath, Aug 23, 2004.

  1. Indiepath

    Indiepath New Member

    Joined:
    Aug 22, 2004
    Messages:
    999
    Likes Received:
    0
    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. MiCo Games

    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    38
    Likes Received:
    0
    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. Nemesis

    Original Member

    Joined:
    Jul 27, 2004
    Messages:
    273
    Likes Received:
    0
    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.
     
  4. Indiepath

    Indiepath New Member

    Joined:
    Aug 22, 2004
    Messages:
    999
    Likes Received:
    0
    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.
     
  5. Dominique Biesmans

    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    101
    Likes Received:
    0
    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)
     
  6. Indiepath

    Indiepath New Member

    Joined:
    Aug 22, 2004
    Messages:
    999
    Likes Received:
    0
    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.
     
  7. Dominique Biesmans

    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    101
    Likes Received:
    0
    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.
     
  8. Indiepath

    Indiepath New Member

    Joined:
    Aug 22, 2004
    Messages:
    999
    Likes Received:
    0
    Ok. Thanks.
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer