Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Load game with "password"?

Discussion in 'Editor & General Support' started by bigkahuna, Jul 21, 2006.

  1. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Hi,

    The game that I hope to bring over to Unity starts with a video clip trailer and several interactive 2D "tutorials". I was reading another thread on a similar topic and thought that I might accomplish this by creating an "opening application" in Flash or Director and then have that application launch the Unity application when it's finished. I'm pretty sure this is all very do-able.

    But in my situation, because this is a "serious game", I don't want the user to be able to launch the Unity game by itself. I want to make it so it can -only- be launched at the completion of the "opening application".

    So one idea I had was to launch the Unity game with a password. I'm not sure how it would be done on a Mac, but under Windows it would look something like:

    mygame.exe -password

    Is there a way in Unity to make my game so that it can be launched with a "string" and the first thing the Unity game does is check that string? That way the game checks for the string, if it's correct it plays, if it isn't it exits.

    Any ideas?
     
  2. jeremyace

    jeremyace

    Joined:
    Oct 12, 2005
    Posts:
    1,661
    I don't know about the command-line switch, but it might be easier to write a file somewhere from your video loader and then read it on startup from unity to see if the video has been played.

    You might also be able to write to your games preferences plist directly from your loader and just set a var there.

    But writing a file should be easy enough.

    -Jeremy
    EDIT: spelling
     
  3. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Hmmm... but how would I make sure that the loader is -always- played first, not just the first time? Have the loader write to the file as it exits, then reads it, and writes back? Only way I can think of unless you've got a better idea? This is definitely do-able on the loader side if I use Director.

    My next concerns would be how -seamless- this might look to the user? I'd also have to close the loader after it launches the game otherwise it might bog down the game...

    Thanks, you've given me something to think about.
     
  4. jeremyace

    jeremyace

    Joined:
    Oct 12, 2005
    Posts:
    1,661
    Once you read the value in Unity, reset the value from within Unity (either player prefs or custom file)

    Just open your loader, play the movie, write the file, run unity, (in unity)read file, reset file, then continue.

    -Jeremy
     
  5. socksy

    socksy

    Joined:
    May 21, 2005
    Posts:
    244
    Why would you want it to be impossible to be launched because it's a "serious game"? Couldn't you just hide it in a Data folder, or in the Loader bundle? It'll still be launchable by those who really try, but the average user won't go through the trouble, or even know how to go about it.
    Is it a nag screen, or something?
     
  6. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Ok I'm new to Unity, so I'm not sure what a "loader bundle" is.

    This particular app mixes training and gameplay, so I don't want the player (student) to be able to bypass the training and just be able to play the game. This may end up being part of a license recertification program, so I have to ensure that the student completes the whole program and not just a portion of it.

    The other issue is that there may be unscrupulous businesses who would "repackage" and "repurpose" the game with their own loader, something else I would like to prevent.
     
  7. jeremyace

    jeremyace

    Joined:
    Oct 12, 2005
    Posts:
    1,661
    Well, you would have to get into encryption and other such junk to get close to having a "Secure" loader system, and it is extremely unlikely to have a secure system like that. The idea I suggested is not secure at all if someone wants to crack it.

    You would need video data encoded into your game files (like normal) to be secure.

    Joe! David! Aras! We need compressed video playback!

    -Jeremy
     
  8. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Understood and agreed. I've had this discussion on other forums before and what I'm looking to do is not 100% secure and I understand that. But what I want to make sure I've done is to keep it from being -easy- to access. I'm thinking that your suggestion (have the loader write to a file on exit and the game read and then re-write on launching) is probably good enough. In the few seconds that the proper "password" is in that text file the computer will be busy and only a hacker would bother to figure out how to bypass it. Until a better idea comes up, this is probably the way I'll go.

    As for compressed video playback, that is something I will miss from my last game engine, and I'm pretty bummed Unity doesn't have it yet. What I would -really- like to see is "Flash Video" playback support in Unity. Flash video compresses so much better, with fewer artifacts and plays back faster than any other codec I've tried. I plan on using MM Director for the "loader" app partly because I can then use Flash video.
     
  9. jeremyace

    jeremyace

    Joined:
    Oct 12, 2005
    Posts:
    1,661
    Hmmm, what you could do to make it a little harder is create an encrypted access code using the system date as the key in your loader app. Then you de-crypt the code in Unity using the date as a key and compare it to the hardcoded access code. That will make it a fair bit harder to hack, you'd have to really want to crack it to spend the time figuring it out. The reason I suggest using the date as the key as opposed to some other system variable (username or whatever) is the date will change, so even if they find the txt file with the code, it will only work on that day.

    Also, dont write the file with a .txt extension, give it some wierd extension. It will still read fine because the contents are plain-text, but is less likely to be opened by accident. Something like: DrG98GES.dat would be good.

    Unfortunately I can't think of anything better for you I'm afraid.

    HTH,
    -Jeremy
     
  10. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Ha! Yup, been doing this kind of "sneaky" stuff for years. The other thing I've done is rename it something with a .drv or .sys extension and put it in a hidden directory. It helps that Windose still only checks the file extention to decide what kind of file it is, so most people won't bother to try and open it.

    Thanks again for your suggestions and ideas. I'll be getting my iMac in the next few days and will be able to try some of this stuff out on my own!
     
  11. socksy

    socksy

    Joined:
    May 21, 2005
    Posts:
    244
  12. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Ahhh... OK Socksy, thanks for the explanation. What complicates this issue further (for me) is that my target OS will be Windows and I don't have a copy of Director for OSX. So I'll have to do some shuffling around to build on two different OS's and then test under Windows. Shouldn't be too tough though.
     
  13. Morgan

    Morgan

    Joined:
    May 21, 2006
    Posts:
    1,223
    FWIW, In OS X a Director executable is not a package. (I have MX 2004, which can output projectors for both Win and Mac/Rosetta.)