Save & load snapshots from the console:
What you can do with snapshots:
What do you mean?
Well, to demonstrate how snapshots can work, I've asked permission from Jeremiah Lee, the creator of the Print-&-Play game, Zombie in My Pocket to implement the game in Card Board. Very exciting!
How did you create a custom snapshot like this?
Right now this is a highly manual process:
- snapshot - typing this in will output a JSON string that describes the game board, the areas, and the cards. Copy this string into a text file if you want to "save" a snapshot of your game.
- loadSnapShot - type this into the console, followed by a string-representation of a snapshot will wipe out your existing game and replace it with the new snapshot. (note that "SnapShot is capitalized")
What you can do with snapshots:
- Save and restore a game that you've been playing
- Tweak a game by tweaking the snapshot data
- Create cool custom games like Zombie in My Pocket!
What do you mean?
Well, to demonstrate how snapshots can work, I've asked permission from Jeremiah Lee, the creator of the Print-&-Play game, Zombie in My Pocket to implement the game in Card Board. Very exciting!
How did you create a custom snapshot like this?
Right now this is a highly manual process:
- I uploaded the ZiMP graphics onto this demo site so that we can load the card data onto the demo. These consisted of 25 JPEGs. I had to upload them to the same server because the security permissions of Flash can be complicated if you aren't loading images from the same source.
- I copied the snapshot from a standard game and changed it so that:
- The dimensions of the game board were bigger, to allow the tiles to be laid out properly (See ["Game"]["width"])
- I deleted two of the areas and made one very big and another narrow. This way the big area could be a game board and the narrow one could hold the game's Dev cards.
- I removed all of the standard cards and most of the chips (this is a little bit time consuming at the moment :p )
- I saved the new snapshot and reloaded it into the game.
- Then, to insert the Zombie cards, I ran "loadCards" in the console for each card and took a snapshot of the whole thing again.
- For those who want to really customize the experience, one could imagine a score cards and extra cards to keep track of inventory, etc...
Now that I've introduced the snapshot functionality, let's see it in action. Try of the ZiMP game by following the instructions below:
Loading instructions for Zombie in My Pocket on the Card Board demo site:
Loading instructions for Zombie in My Pocket on the Card Board demo site:
- Start Card Board by going to card-board.weebly.com
- Click "Start Server" (loadSnapShot will not run unless a game has been started)
- Click "Toggle Console" to open the console
- Copy the snapshot code at the end of this post
- Paste the code into your console and press "Enter"
- Click "Toggle Console" to close the console
- Play Zombie in My Pocket!
- As usual, Card Board knows nothing about the roles, so you have to know them yourself. The rules are available here: http://card-board.weebly.com/zimp-rules.html
- I've included some white chips to help you keep track of your health
Zombies in My Pocket Snapshot (loads JPEGs from weebly.com)
loadSnapShot {"Cards":[{"halfh":144,"x":503,"y":219,"w":191,"chipColor":0,"back":"0","area_id":9001,"halfw":96,"r":0,"h":287,"data":"nothing","card_id":52,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/1702447_orig.png","face_up":true},{"halfh":143,"x":503,"y":233,"w":191,"chipColor":0,"back":"0","area_id":9001,"halfw":96,"r":0,"h":286,"data":"nothing","card_id":56,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/8209502_orig.png","face_up":true},{"halfh":143,"x":503,"y":221,"w":191,"chipColor":0,"back":"0","area_id":9001,"halfw":96,"r":0,"h":286,"data":"nothing","card_id":57,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/9905325_orig.png","face_up":true},{"halfh":144,"x":503,"y":217,"w":191,"chipColor":0,"back":"0","area_id":9001,"halfw":96,"r":0,"h":287,"data":"nothing","card_id":64,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/7747953_orig.png","face_up":true},{"halfh":144,"x":503,"y":227,"w":191,"chipColor":0,"back":"0","area_id":9001,"halfw":96,"r":0,"h":287,"data":"nothing","card_id":65,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/666250_orig.png","face_up":true},{"halfh":144,"x":503,"y":229,"w":191,"chipColor":0,"back":"0","area_id":9001,"halfw":96,"r":0,"h":287,"data":"nothing","card_id":69,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/6031286_orig.png","face_up":true},{"halfh":144,"x":503,"y":231,"w":191,"chipColor":0,"back":"0","area_id":9001,"halfw":96,"r":0,"h":287,"data":"nothing","card_id":70,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/1052700_orig.png","face_up":true},{"halfh":144,"x":503,"y":223,"w":191,"chipColor":0,"back":"0","area_id":9001,"halfw":96,"r":0,"h":287,"data":"nothing","card_id":71,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/5315949_orig.png","face_up":true},{"halfh":143,"x":503,"y":225,"w":191,"chipColor":0,"back":"0","area_id":9001,"halfw":96,"r":0,"h":286,"data":"nothing","card_id":72,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/3924240_orig.png","face_up":true},{"halfh":64,"x":253,"y":499,"w":127,"chipColor":0,"back":"0","area_id":9001,"halfw":64,"r":0,"h":127,"data":"nothing","card_id":67,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/5758464_orig.png","face_up":true},{"halfh":64,"x":253,"y":501,"w":127,"chipColor":0,"back":"0","area_id":9001,"halfw":64,"r":0,"h":127,"data":"nothing","card_id":62,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/4081187_orig.png","face_up":true},{"halfh":64,"x":253,"y":497,"w":127,"chipColor":0,"back":"0","area_id":9001,"halfw":64,"r":0,"h":127,"data":"nothing","card_id":63,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/5025164_orig.png","face_up":true},{"halfh":64,"x":253,"y":509,"w":127,"chipColor":0,"back":"0","area_id":9001,"halfw":64,"r":0,"h":127,"data":"nothing","card_id":54,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/3408983_orig.png","face_up":true},{"halfh":64,"x":119,"y":498,"w":127,"chipColor":0,"back":"0","area_id":9001,"halfw":64,"r":0,"h":127,"data":"nothing","card_id":55,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/7081578_orig.png","face_up":true},{"halfh":64,"x":119,"y":500,"w":127,"chipColor":0,"back":"0","area_id":9001,"halfw":64,"r":0,"h":127,"data":"nothing","card_id":68,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/1522035_orig.png","face_up":true},{"halfh":64,"x":119,"y":510,"w":127,"chipColor":0,"back":"0","area_id":9001,"halfw":64,"r":0,"h":127,"data":"nothing","card_id":58,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/8340114_orig.png","face_up":true},{"halfh":64,"x":119,"y":506,"w":127,"chipColor":0,"back":"0","area_id":9001,"halfw":64,"r":0,"h":127,"data":"nothing","card_id":59,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/7507074_orig.png","face_up":true},{"halfh":64,"x":119,"y":502,"w":127,"chipColor":0,"back":"0","area_id":9001,"halfw":64,"r":0,"h":127,"data":"nothing","card_id":60,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/9428648_orig.png","face_up":true},{"halfh":64,"x":253,"y":505,"w":127,"chipColor":0,"back":"0","area_id":9001,"halfw":64,"r":0,"h":127,"data":"nothing","card_id":50,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/2860129_orig.png","face_up":true},{"halfh":64,"x":253,"y":507,"w":127,"chipColor":0,"back":"0","area_id":9001,"halfw":64,"r":0,"h":127,"data":"nothing","card_id":51,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/8084355_orig.png","face_up":true},{"halfh":64,"x":119,"y":508,"w":127,"chipColor":0,"back":"0","area_id":9001,"halfw":64,"r":0,"h":127,"data":"nothing","card_id":53,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/8566841_orig.png","face_up":true},{"halfh":64,"x":253,"y":503,"w":127,"chipColor":0,"back":"0","area_id":9001,"halfw":64,"r":0,"h":127,"data":"nothing","card_id":73,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/4799551_orig.png","face_up":true},{"halfh":64,"x":119,"y":504,"w":127,"chipColor":0,"back":"0","area_id":9001,"halfw":64,"r":0,"h":127,"data":"nothing","card_id":61,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/1865545_orig.png","face_up":true},{"halfh":64,"x":118,"y":367,"w":127,"chipColor":0,"back":"0","area_id":9001,"halfw":64,"r":0,"h":127,"data":"nothing","card_id":66,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/2704347_orig.png","face_up":true},{"halfh":64,"x":253,"y":370,"w":127,"chipColor":0,"back":"0","area_id":9001,"halfw":64,"r":0,"h":127,"data":"nothing","card_id":74,"isChip":false,"front":"LOAD_http://card-board.weebly.com/uploads/6/3/9/8/6398599/3437969_orig.png","face_up":true},{"back":"5","x":144,"isChip":true,"halfw":10,"y":113,"halfh":10,"card_id":2304,"face_up":false,"r":0,"chipColor":16777215,"h":20,"data":"1","area_id":9001,"front":"5","w":20},{"back":"5","x":124,"isChip":true,"halfw":10,"y":109,"halfh":10,"card_id":1505,"face_up":false,"r":0,"chipColor":16777215,"h":20,"data":"1","area_id":9001,"front":"5","w":20},{"back":"5","x":144,"isChip":true,"halfw":10,"y":121,"halfh":10,"card_id":2306,"face_up":false,"r":0,"chipColor":16777215,"h":20,"data":"1","area_id":9001,"front":"5","w":20},{"back":"5","x":144,"isChip":true,"halfw":10,"y":125,"halfh":10,"card_id":2307,"face_up":false,"r":0,"chipColor":16777215,"h":20,"data":"1","area_id":9001,"front":"5","w":20},{"back":"5","x":144,"isChip":true,"halfw":10,"y":129,"halfh":10,"card_id":2308,"face_up":false,"r":0,"chipColor":16777215,"h":20,"data":"1","area_id":9001,"front":"5","w":20},{"back":"5","x":124,"isChip":true,"halfw":10,"y":113,"halfh":10,"card_id":1800,"face_up":false,"r":0,"chipColor":16777215,"h":20,"data":"1","area_id":9001,"front":"5","w":20},{"back":"5","x":124,"isChip":true,"halfw":10,"y":117,"halfh":10,"card_id":1801,"face_up":false,"r":0,"chipColor":16777215,"h":20,"data":"1","area_id":9001,"front":"5","w":20},{"back":"5","x":124,"isChip":true,"halfw":10,"y":121,"halfh":10,"card_id":1802,"face_up":false,"r":0,"chipColor":16777215,"h":20,"data":"1","area_id":9001,"front":"5","w":20},{"back":"5","x":124,"isChip":true,"halfw":10,"y":125,"halfh":10,"card_id":1803,"face_up":false,"r":0,"chipColor":16777215,"h":20,"data":"1","area_id":9001,"front":"5","w":20},{"back":"5","x":124,"isChip":true,"halfw":10,"y":129,"halfh":10,"card_id":1804,"face_up":false,"r":0,"chipColor":16777215,"h":20,"data":"1","area_id":9001,"front":"5","w":20},{"back":"5","x":124,"isChip":true,"halfw":10,"y":133,"halfh":10,"card_id":1805,"face_up":false,"r":0,"chipColor":16777215,"h":20,"data":"1","area_id":9001,"front":"5","w":20},{"back":"5","x":124,"isChip":true,"halfw":10,"y":137,"halfh":10,"card_id":1806,"face_up":false,"r":0,"chipColor":16777215,"h":20,"data":"1","area_id":9001,"front":"5","w":20},{"back":"5","x":124,"isChip":true,"halfw":10,"y":141,"halfh":10,"card_id":1807,"face_up":false,"r":0,"chipColor":16777215,"h":20,"data":"1","area_id":9001,"front":"5","w":20},{"back":"5","x":124,"isChip":true,"halfw":10,"y":145,"halfh":10,"card_id":1808,"face_up":false,"r":0,"chipColor":16777215,"h":20,"data":"1","area_id":9001,"front":"5","w":20},{"back":"5","x":144,"isChip":true,"halfw":10,"y":117,"halfh":10,"card_id":2305,"face_up":false,"r":0,"chipColor":16777215,"h":20,"data":"1","area_id":9001,"front":"5","w":20},{"back":"5","x":144,"isChip":true,"halfw":10,"y":133,"halfh":10,"card_id":2309,"face_up":false,"r":0,"chipColor":16777215,"h":20,"data":"1","area_id":9001,"front":"5","w":20},{"back":"5","x":144,"isChip":true,"halfw":10,"y":109,"halfh":10,"card_id":2302,"face_up":false,"r":0,"chipColor":16777215,"h":20,"data":"1","area_id":9001,"front":"5","w":20}],"Game":{"name":"Zombiesinmypocket","game_id":"zimp","owner_id":"Survivor","width":1095},"Areas":[{"x":0,"owner":"-1","y":0,"h":800,"id":9001,"w":900,"r":0},{"x":900,"owner":"-1","y":0,"h":800,"id":19003,"w":195,"r":0}]}