Coder Social home page Coder Social logo

8bitskull / dicebag Goto Github PK

View Code? Open in Web Editor NEW
25.0 25.0 1.0 20 KB

Dicebag is a Defold extension containing probability functions designed specifically for games.

Home Page: https://forum.defold.com/t/dicebag-probability-for-games/67169

License: Creative Commons Zero v1.0 Universal

Lua 100.00%

dicebag's People

Contributors

8bitskull avatar unquotidianvi avatar yagich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

yagich

dicebag's Issues

More asymmetry options

Hello @8bitskull!

I've found out we're implementing something starting from the same source. I would love to hear your thoughts about how to implement "custom" behavior/asymmetry, such as the "critical hits" example.
Do you think that adding a way to pass in user defined functions could be beneficial? Since it's something that usually would affect the final result that way might be usless/reduntant/code bloating?

Something like that could be as the following code

-- dice module
function roll(dice, callback)
  result = math.random(dice)
  return callback(dice, result)
end

-- user
dm = require('dicemodule')

doubleup = function (dice, result)
  value = result
  if (result == dice) then value = result * 2 end
  return value
end

dm.roll(6, doubleup)

Thanks for your attention and the effort on this module!

Add RNG function callback argument for repeatable random sequences

For instance, if I were creating a puzzle game or a roguelike where each level is randomly generated, it would be useful to be able to be able to store the random seed and know that the same seed will always generate the same level. I imagine this as a parallel set of functions exactly like the current ones, adding an extra parameter for the RNG callback function.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.