[TOOL] Quantum Imprint
QuantumImprint #PROCJAM2014
Record game actions, play them back!
Dynamic record/playback implementation of the cloning mechanics I used in Quantum Pliot [https://itunes.apple.com/app/id935956154 ], inspired by Kenta Cho's DefeatMe. Use this library to record game events and play them back later, like when making clones that imitate a player.
Sample implementation in imprint.computer-pidgin records the player's cursor position & color each frame. When the player clicks, the program begins playback, painting the same position & color where the player drew.
HOW TO:
- Include Script:
- Create your Imprintable: var mouseInfo = {"category" : "painter"}; //set the info hash to useful meta-data for playback createImprintable("mouse", mouseInfo);
- Record Actions: imprint("mouse", {"x" : mouse.x, "y" : mouse.y, "color" : currentColor, "radius" : 5});
- Create a Record from your Imprint: createRecordFromImprint("mouse");
- Implement playback function called by imprint.js: function playbackRecordedImprint(info, actions, timeIndex, timeDirection) { if (info["category"] === "painter") { doMyGameUpdateFunction(actions); } else { doGameUpdateFunctionForNonPainters(actions); //use the info hash however you want } } }
- Playback Records: playbackRecords(); //iterates through records playbackRecordedImprint(info, actions, timeIndex, timeDirection) {
- Rewind, recompile, relive.
Category | Tool |
Platforms | HTML5 |
Author | quantumpotato |