-4

I am in the process of making a game, and I am sending the game to my friends to test it and report the bugs they find back to me, but I do not want the game to be spread because it is still a WIP. How could I go about making it only run on a specific computer?

My Idea:

public class Auth {

     private static String neededMacAddress = "18-5E-0F-14-D2-91";

     private static String systemID = System.getMAC(); //this is not it obviously

     public static void main(String args[]) {
         if (systemID.equals(neededSystemID)) {

         new Game();

         }
     }
}

EDIT: I am editing this a year or two later because I need to fix my questions in order to ask more, and I now know a lot more about programming. When I asked this question I was only a few weeks into my first CS class. I can answer this, but I need to edit it to comply with the guidelines.

  • _I don't know how to get a System ID_ What do you tell a _System ID_? efi serial number? Which os du you expect your program to run on, if any? – Clijsters Dec 14 '17 at 15:51
  • Maybe this could help you : https://stackoverflow.com/questions/1986732/how-to-get-a-unique-computer-identifier-in-java-like-disk-id-or-motherboard-id – Tapaka Dec 14 '17 at 15:51
  • this could be a little tricky... are you planning to run this on linux, windows...? – assembler Dec 14 '17 at 15:55
  • I want to run it on OSX because thats what we have at school – Ben Morrison Dec 14 '17 at 15:56
  • Is this for a commercial game or hobby stuff? If it is commercial I'd suggest you hire people or at least have Non-Disclosure-Agreements with those working on the sw. If someone wants to copy your sw, they will do it, no matter what copy protections you add in there. – j.karlsson Dec 14 '17 at 15:57
  • I think I could use the MAC address. I thought that wouldn't work because I didn't have it connected to a server. – Ben Morrison Dec 14 '17 at 15:59
  • 2
    Are you sure it's worth your time to impose this restriction? If anyone wants to bypass this hard enough, they will either modify the bytecode or find some other workaround. – byxor Dec 14 '17 at 16:05
  • It's just for hobby stuff, I just want to learn about weird things like this. – Ben Morrison Dec 14 '17 at 16:05
  • 2
    What value will this feature add to your product? Why is it a problem that your beta testers (your friends, who will presumably do this testing for free) test it on more than one machine? – Dan Mašek Dec 14 '17 at 16:05

1 Answers1

2

On starting the game, you can make the game code to read the client MAC address and send it to the server and there you can generate a key and send it back to the client and then the game will start. But, this will fail if the client spoofs its MAC address. Try it. Hope it helps..

This link has getting MAC using java

Kenny Omega
  • 398
  • 2
  • 12