Skip to content

Instantly share code, notes, and snippets.

const crypto = require('crypto');
// Generate salt from player name
let hasher = crypto.createHash('sha1');
let salt = hasher.update(name).digest('base64');
// Generate pbkdf2 hash from ID using generated salt
crypto.pbkdf2(id, new Buffer(salt), 1000, 24, 'sha1', (err, key) => {
let passwordHash = key.toString('hex');
});
@woubuc
woubuc / mod.rs
Last active October 5, 2018 21:04
register_mod!(ModInfo {
id: "test-mod",
name: "Test Mod",
dependencies: vec!["other-mod"],
}, mod_main);
fn mod_main(ctx : ModContext) {
println!("Test mod says hello!");
while let Some(evt) = ctx.next() {
@woubuc
woubuc / info.md
Last active October 4, 2018 14:53
Simple mod loader implementation in Rust

Simple mod loader implementation in Rust

Workspace with 3 projects: core, shared and mod

  • Core produces the exe
  • Shared contains shared functions and datastructures (GameData)
  • Mod is set to crate-type = ["dylib"] and produces a .dll

Disclaimer: This is an experimental implementation based on the shared_library crate. It works on my computer. I'm definitely not claiming this is how mod loaders should be done, and of course use this code at your own risk.

Feel free to use this code as you wish, feedback from more experienced Rustaceans is of course always welcome.

Phaser Cheatsheet

This is the content from the original Phaser cheatsheet, the site of which went down. I'm editing outdated information as I come across it.

Starting a new game

Reference: http://docs.phaser.io/Phaser.Game.html#Game

var game = new Phaser.Game(width, height, renderer, "parent");
//All parameters are optional but you usually want to set width and height
//Remember that the game object inherits many properties and methods!
[
{
"name": "Merchant_Jaede",
"inventory": [
{
"name": "pottery bowl",
"ql": 2,
"price": 10,
"dmg": 0,
"rarity": false