Sign in to follow this  
CJWR

creating a key code system for my game

Recommended Posts

alright, i'm making a game i intend to sell (i don't know if it will or not, but that doesn't matter). Now, the easiest way by far to have people buy my game would be through paypal or credit card over the internet. So what i want to do is allow people to download my entire game, but unless they have a key, only play the beginning part of it (a demo if you will). Now of course i can't simply have one key, or once one person buys the game, he or she could give everyone in the world the key (in thoery). So i need my game to check when it is started if it already has a key. If it does, all is well, the user paided for the game and has full access. If it doesn't have a key, it checks if it has a code (that the user sends to me, so that i can give them the correct key). If has a code, it tells the user the code so that hopefully he or she will buy the game, and allows the user to play the beingning of the game only. If it doesn't yet have a code, it will create a code and tell the user the code so he or she will hopefully buy the game. now my question is, i need the game to create a code that if i enter into another program i will write, will give me a key. which i can then give to the user so that he or she has access to the full game. So for every code x, i need a key y. what mathimatial fomula will allow me to do this? i've seen it done in other games, so i know it can be done. thank you for your time and any help you can give me.

Share this post


Link to post
Share on other sites
i'm going to try to explain this in more detail of what is going on.

my game creates the code 123. now my game knows (but the user doesn't) that the correct key for this is 456. now when i enter the code 123 into my decoder (if you will) program, it produces the key 456. but i need millions of different codes and keys. so i need a mathimatial fomula to produce them. hope that helps.

Share this post


Link to post
Share on other sites
Quote:
Original post by CJWR
my game creates the code 123. now my game knows (but the user doesn't) that the correct key for this is 456. now when i enter the code 123 into my decoder (if you will) program, it produces the key 456. but i need millions of different codes and keys. so i need a mathimatial fomula to produce them. hope that helps.


Thats sounds like public key cryptography to me. I don't think it is feasable to release a different code with every single copy of your game, because CD manufacutrers won't make unique data on each CD as it is too expensive. What you need is an algorithm that produces the same results thing from many differnt inputs, some sort of reverse hash fuction.



Share this post


Link to post
Share on other sites
i know, when the game first is used, it then creates a key. i just need a fomula i can program my game with to create it and then using that code, enter it into another program to produce a key. you then enter the key into the game and the game checks to make sure it is the right code.

Share this post


Link to post
Share on other sites
Here's an option:

When the game first runs, use GetVolumeInformation to get the serial number for C: - encrypt this to create a licence request code.

Using the key create a licence code by encrypting it (I use blowfish). When the licence code in entered into the software it can decrypt it to ensure the licence request code is valid. This in turn can be decrypted and checked against the C: serial number.

This method has drawbacks of course, like if the user changes hard drive or doesn't have a C: volume then the whole thing falls down.

Share this post


Link to post
Share on other sites
interesting, but still problems.

i think i should just create a program to create say 1,000,000,000 different codes and keys. store all of them in a file, and then just have my program check for the right code in the file and then give me the key. all problems solved. do you think this will work? i cant find any problems with it, but i know next to nothing about how to create this sort of system.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this