Unlock item by entering key-code

Hey!
I plan on implementing a feature that people can get a key (like physically printed on paper) that they can enter in my game to unlock a certain weapon.
Each code should only be useable once and then be ‚blocked‘.

Do you have any idea of how to accomplish something like this? :eyes:

Thanks in advance! :slight_smile:

If it’s all on the client, you could store a list of keys and whether they’re unlocked or not. I guess that is kind of obvious.
If there’s a server involved, then the same idea, but stored there?

Please clarify if I missed something in your question. :slight_smile:

Thank you for your answer!
So basically, this check if a key is used should be constant… so that 2 people cannot use the same key… I think a server that stores the keys and stores if they have already been used is needed then right? Or wrong? :rage:

Well, for sure… otherwise how would you work it out? :slight_smile:

In addition to that, note that anything that’s deployed with your application can be reverse-engineered… no matter whether it’s a trivial comparison with hardcoded values or some smart and flexible algorithm that only accepts a subset of keys out of all permutations.

All of that can be read out and can be “cracked” when it’s part of a client application. So if you’re serious about proper key management, you’ll definitely need some server-driven validation and even that is sometimes not as easy.

1 Like