Author Topic: DRM plugin or library. enquiry  (Read 834 times)

Netgibbon

  • Posts: 10
    • I can help with play testing
    • I can help with proof reading
    • I can help with scripting
    • I can help with story design
    • I can help with voice acting
DRM plugin or library. enquiry
« on: 23 Sep 2014, 08:32 »
I was wondering if anyone has developed or if anyone knows about a plugin or library that my team could use to create a DRM system similar to the one used with Monkey Island's Dial-A-Pirate code wheel.

Any responses are much appreciated :)

Snarky

  • Global Moderator
  • Posts: 6,769
  • Private Insultant
    • I can help with proof reading
    • I can help with translating
Re: DRM plugin or library. enquiry
« Reply #1 on: 23 Sep 2014, 14:42 »
You don't need a plugin for that. The hardest part is probably to make the physical code wheel. In the game itself, you just need a few arrays of codes, two of sprites, and a random number generator. Something like this (very rough, probably buggy):

Code: Adventure Game Studio
  1. // Header:
  2. #define CODEWHEEL_SIZE 15
  3. #define CODEWHEEL_SLOTS 7
  4.  
  5. struct CodeSlot
  6. {
  7.   String name;
  8.   int code[CODEWHEEL_SIZE];
  9. };
  10.  
  11. struct CodePos
  12. {
  13.   int faceTop;
  14.   int faceBottom;
  15.   int slot;
  16.  
  17.   import function InitRandom();
  18.   import function Check(int code);
  19. };
  20.  
  21. int faceTop[CODEWHEEL_SIZE];
  22. int faceBottom[CODEWHEEL_SIZE];
  23. CodeSlot codeSlot[CODEWHEEL_SLOTS];
  24.  
  25. // Script:
  26.  
  27. function CodePos::InitRandom()
  28. {
  29.   this.faceTop = Random(CODEWHEEL_SIZE);
  30.   this.faceBottom = Random(CODEWHEEL_SIZE);
  31.   this.slot = Random(CODEWHEEL_SLOTS);
  32. }
  33.  
  34. function CodePos::Check(int code)
  35. {
  36.   int spin = (this.faceBottom - this.faceTop + CODEWHEEL_SIZE) % CODEWHEEL_SIZE;
  37.   return int == codeSlot[this.slot].code[spin];
  38. }
  39.  

Then you just have to populate the CodeSlot arrays with codes (and names) and the faceTop/faceBottom arrays with sprite indexes to match the code wheel. To put up a code challenge on screen, make an instance of CodePos and initialize it, then display the faceTop/faceBottom graphics and the name of the code slot (Antigua, Bermuda, etc.).
« Last Edit: 23 Sep 2014, 14:50 by Snarky »

Netgibbon

  • Posts: 10
    • I can help with play testing
    • I can help with proof reading
    • I can help with scripting
    • I can help with story design
    • I can help with voice acting
Re: DRM plugin or library. enquiry
« Reply #2 on: 23 Sep 2014, 19:18 »
You don't need a plugin for that. The hardest part is probably to make the physical code wheel. In the game itself, you just need a few arrays of codes, two of sprites, and a random number generator. Something like this (very rough, probably buggy):

Code: Adventure Game Studio
  1. // Header:
  2. #define CODEWHEEL_SIZE 15
  3. #define CODEWHEEL_SLOTS 7
  4.  
  5. struct CodeSlot
  6. {
  7.   String name;
  8.   int code[CODEWHEEL_SIZE];
  9. };
  10.  
  11. struct CodePos
  12. {
  13.   int faceTop;
  14.   int faceBottom;
  15.   int slot;
  16.  
  17.   import function InitRandom();
  18.   import function Check(int code);
  19. };
  20.  
  21. int faceTop[CODEWHEEL_SIZE];
  22. int faceBottom[CODEWHEEL_SIZE];
  23. CodeSlot codeSlot[CODEWHEEL_SLOTS];
  24.  
  25. // Script:
  26.  
  27. function CodePos::InitRandom()
  28. {
  29.   this.faceTop = Random(CODEWHEEL_SIZE);
  30.   this.faceBottom = Random(CODEWHEEL_SIZE);
  31.   this.slot = Random(CODEWHEEL_SLOTS);
  32. }
  33.  
  34. function CodePos::Check(int code)
  35. {
  36.   int spin = (this.faceBottom - this.faceTop + CODEWHEEL_SIZE) % CODEWHEEL_SIZE;
  37.   return int == codeSlot[this.slot].code[spin];
  38. }
  39.  

Then you just have to populate the CodeSlot arrays with codes (and names) and the faceTop/faceBottom arrays with sprite indexes to match the code wheel. To put up a code challenge on screen, make an instance of CodePos and initialize it, then display the faceTop/faceBottom graphics and the name of the code slot (Antigua, Bermuda, etc.).

Thank you very much (laugh)

Monsieur OUXX

  • Posts: 3,554
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
Re: DRM plugin or library. enquiry
« Reply #3 on: 24 Sep 2014, 18:26 »
anyone knows about a plugin or library

By the way, I'm about to answer a question you didn't ask, but it'll also help you if you're more familiar with AGS terms in the future:
 - Plugins are external to AGS and most of them are made in C++. They're usually for "super" features, mostly fast graphics and 3D. That would be waaaaay overkill for what you're looking for.
 - Modules could be what you call "libraries", that is: pieces of code written directly in AGS scripting language. Except in the AGS world we like to keep it simple and the "library" would most likely fit in a single module, and wouldn't really be a library anymore ;).

For example, you could decide to release your copy-protection as a module after you're finished fine-tuning it (don't forget to credit Snarky obvisouly ;) ).