DRM plugin or library. enquiry

Started by Netgibbon, Tue 23/09/2014 08:32:41

Previous topic - Next topic

Netgibbon

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

#1
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: AGS

// Header:
#define CODEWHEEL_SIZE 15
#define CODEWHEEL_SLOTS 7

struct CodeSlot
{
  String name;
  int code[CODEWHEEL_SIZE];
};

struct CodePos
{
  int faceTop;
  int faceBottom;
  int slot;

  import function InitRandom();
  import function Check(int code);
};

int faceTop[CODEWHEEL_SIZE];
int faceBottom[CODEWHEEL_SIZE];
CodeSlot codeSlot[CODEWHEEL_SLOTS];

// Script:

function CodePos::InitRandom()
{
  this.faceTop = Random(CODEWHEEL_SIZE);
  this.faceBottom = Random(CODEWHEEL_SIZE);
  this.slot = Random(CODEWHEEL_SLOTS);
}

function CodePos::Check(int code)
{
  int spin = (this.faceBottom - this.faceTop + CODEWHEEL_SIZE) % CODEWHEEL_SIZE;
  return int == codeSlot[this.slot].code[spin];
}


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.).

Netgibbon

Quote from: Snarky on Tue 23/09/2014 14:42:39
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: AGS

// Header:
#define CODEWHEEL_SIZE 15
#define CODEWHEEL_SLOTS 7

struct CodeSlot
{
  String name;
  int code[CODEWHEEL_SIZE];
};

struct CodePos
{
  int faceTop;
  int faceBottom;
  int slot;

  import function InitRandom();
  import function Check(int code);
};

int faceTop[CODEWHEEL_SIZE];
int faceBottom[CODEWHEEL_SIZE];
CodeSlot codeSlot[CODEWHEEL_SLOTS];

// Script:

function CodePos::InitRandom()
{
  this.faceTop = Random(CODEWHEEL_SIZE);
  this.faceBottom = Random(CODEWHEEL_SIZE);
  this.slot = Random(CODEWHEEL_SLOTS);
}

function CodePos::Check(int code)
{
  int spin = (this.faceBottom - this.faceTop + CODEWHEEL_SIZE) % CODEWHEEL_SIZE;
  return int == codeSlot[this.slot].code[spin];
}


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

Quote from: Netgibbon on Tue 23/09/2014 08:32:41
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 ;) ).
 

SMF spam blocked by CleanTalk