Millemis, you can’t fit in there
Ever wondered how it is to loose all the data in a production environment? Ever tried it?
If you have, I suggest that you use this simple snippet to save the day :)
if Rails.env == 'production' tasks = Rake.application.instance_variable_get '@tasks' tasks.delete 'db:reset' tasks.delete 'db:drop' namespace :db do desc 'db:reset not available in this environment' task :reset do puts 'db:reset has been disabled' end desc 'db:drop not available in this environment' task :drop do puts 'db:drop has been disabled' end end end
Getting people to contribute
All right, so there’s no fun in doing a project alone and only for one self. Of course, there’s the satisfaction of creating this huge, complicated application, that needs to be able to handle all kinds of similarly, but yet different games and structures. But really role playing is about the social aspect. And truthfully it would be a greater success and experience if people would participate.
So the question becomes, how do you motivate people to join in on the idea of creating this awesome application?
I believe that one of the first things is running your application on open source software. This allows everyone regardless of wealth to participate. Further more, leaving the source open for review ultimately creates a mor secure and robust implementation with less errors and we all get a better experience for it.
All though: There is pitfalls with open source software, but mostly they are about the same as with proprietary ones. Mainly it’s important to choose a software that can run on as many different operating systems as possible.
In this case - and because I love the language and the framework - this means using Ruby on Rails.
Easy and friendly
Having an easy, outgoing and friendly tone in the discussions is paramount. If you scare the people, who participate in the discussions away, then you have less people participating - not more.
And this application is for all who play d20 games, and his means that we need to strive to create an environment that everybody is happy to contribute within.
It’s important to keep track of your application, and to be honest and forthcoming about the prospect for features to be released and bugs to be solved. At Chargen we try to keep this information easily available through milestones and issues - all of which are publicly available.
This means that at any time, you can review any and all of the security issues, feature requests or enhancements that’s being planned for the application. You can also see a schedule for when they’re expected to be released.
So come and join us
If you are up for joint in and helping to create this awesome application you can either mail me or start helping out by going to our github page.
I often find my self trying to keep my intake of coffee down. Not because I feel addicted to it - I don’t have any problems going days without it - but because like all good things it should be taken in moderation.
And I don’t know about you but coffee seems to have the same effect as alcohol, in the sense that it quickly and effectively drains water from my body.
So when ever I go to grab a cup of coffee I try to have a glass of cool refreshing water as well. I find that this is a good habit and it keeps the bad effects of caffeine at bay.
Todays subject regards creating feat trees. Almost all d20 game systems including D&D, Pathfinder and Heartbreaker use a tree-structure for feats. This means, that feats can have other feats as requirements - along side other requirements such as (e.g.) strength.
Some math is needed
To create a feat tree, we need a basic understanding of graph theory. One feat requires another, which requires another etc. This results in feats structured something like this:
Which feats are available to the character?
The first challenge is to determine which of these feats are available to the character at any given level. This means, that we need to run through the feat tree in a pre-ordered way.
This means that we start looping through the feat tree, checking the feats closest to the character first, and then outwards along the branches of the tree. This minimizes the data that we need to loop through before having a complete list of feats available to the character.
Easy implementation in rails
Since the project is written in rails, I needed a ruby/rails gem, which would allow me to create a feat tree. Preferably the gem should support preordering traversal of the tree, since that would save me some programming time.
Looking in ruby toolbox I found a couple of possible gems, which I could use:
I ended up choosing closure tree because it supplies optimised structuring, sql calls and supports pre-ordered sorting out of the box.