February 2014 Archives

Keep Calm, Roll on.

In my last post I left off with asking myself a whole lot of design questions after I decided to centralize most if not all of my 'Game/Business Rules' into 'Roles' under the logical namespaces. In the end I can just live with what I came up with even if there is some duplication of code I don't think I am in anti-pattern land yet.


Rule Role's or Role's Rule?

In my last post I used a role called 'MaxLevel' to define a small set of game rules that define both the 'Player Classes' and 'Maximum Player Level' a race can obtain. That got me thinking that perhaps I could improve my 'Race' class a little by getting rid of the 'ability_mins' attribute and moving it into a role.


A Class Without Class

Well in this entry I am going go to the next step and this time enter a 'Race' into the instantiation arguments of my Creator and it should then give me a list of 'Player Classes' that are available to the entered Ability rolls and Race selection.

Of course I will still have to the same checks for 'Grot' and 'Race' as I do not want someone to sneak something in by simply adding a 'Race' to the mix.


A Race to the Finish

Well in my last post I made use of the visitor pattern so sort out 'Grot' characters at an early stage. My next challenge is to set the race of my 'Character' from one of the ones below.


No Grot is Good Grot

On one of my earlier posts I mentioned a Grot character, in other words a set of ability rolls that can not result in a playable character.


Frustrated Moose

Well leaving off from my last post I was a little frustrated with Moose but not as much as our Moose friend below.


Gold to Grot

In my last post I attempted to use 'Class' as roles to weed out Grot characters that can never be used in the game as a PC. In the end I took the advice found in JT Smith's recent post and abandoned that idea.

While I want my program to be flexible enough to allow new races and classes to be added easily. What I do know that there will always be just six 'Ability' rolls, so why not just use them.


Sometime the Roles we Play are Dead Ends

In my last post I used 'Moose::Util::TypeConstraints' to limit my ability scores to a range between 3~18 now onto the next little test for Moose.

The next rule I want to enforce is, if the passed in ability scores are a Grot Character, (one that can never have a class as all the scores are too low) then I want an error to b…

I said Simpleton not Singlton!!

In my last post I said I was going to look at my 'Character Creation' part of my application and since then I have been doing a little digging and I believe that Moose will help me out here.


Now the Hard Part

Having thoroughly examined how Moose roles work, finding a good workable solutions to any problems I encountered, spec-ed out my basic Namespace, captured 90% of the roles I will need to create and mapped out the character creation process now I have t decide on how to put all the bits and pieces together.

So far I have these three 'Application' blocks Identified.

  • Character Creation
  • Character Instantiation
  • Game Play

I didn't bother to mention persistence as that is an obvious one but as seen below easy to implement.


Weeding out The Bits

Well I was thinking today to present a net little perl script that read the PDF file I created in my last post and get some of the presto-chango automatic code generation.

Well I quickly gave that up as the PDF conversion simply but everything in alphabetical order so I lost any structure I had there. I did have to cheat and not use a PDF reader. I just slurped it in as a file and then use a reg-ex to suck out the bits I wanted. Really I had to double cheat and peek at t…

When is an Org Chart Not an Org Chart

Well continuing on with my AD&D theme am taking another break from Moose Code and looking at design again. Well this time I wanted to see how many common 'roles' I might have between my differing Character Races and Classes and the large number of scribblings I have laying under my desk where getting annoying.

So I started with what I was most familiar with with ye old ULM Object Diagram using a…

Get Out Of My Namespace!!

Do_not_take_his_bone.jpg="text-align: center; display: block; margin: 0 auto…

No Moose is a Good Moose

Well after my Dice adventure I had a few bookmarked mods (Acme::Dice, Games::Dice::Loaded, Games::Dice::Advanced, /users/byterock/2014/02/index.html

Not More F'n Dice. Don't you Have Better Things to Do!!

As most of my post of late have been D&D related and my last post one of the major part of the game is simple rolling of dice.

Some of you might be old enough to remember this screen shot

="window.open('http://blogs.perl.org/users/byterock/assets_c/2014/02/Might and Magic 2 (C-64)-1473.html','popup','width=250,height=163,scrollbars=no,resizab…

Ask Not What your Moose Can Do For You. But What You Can Do For Moose

As most of my recent posts have been looking at what nice little goodies Moose has to offer and I now that I have solved my last role problem I figured it was time to take a little break from coding and look as general Design a little

I could just do like the old days and draw something up like this;


Of Moose and Men, well Class really!

I left off on my last post stubbing in a little code to take care of loading my 'Player Class' (Fighter, Thief etc) into my 'Character' class. I did mention that there are some real subtle rules, I will look at just one of them.

Unfortunately 'Mordol the Moose' rolled a '1' and failed his 'Saving Throw' vs traps and ended up like this;


If 'at is a moose Ah woods hate tae see a rat

In my last D&D post I had at least the first problems worked out for Character race. Now I think I will move into the most challenging of all the 'Class' of a character.

In D&D a 'Class' is the role (JOB) a character plays in the game ie fighter, thief, mage etc. There are 5 primary Classes and 5 sub classes which is easy enough to model with Moose a 'Role' for each of the 10 and we are done.


God hath given you one face and you make yourselves another.

In the continuing story of Moose and D&D I left off with what I think was a slick use of Moose:Util to load in a Character's race.

As all long term D&D players now you will eventually run into a player who says the following;


Well in my present 'Character' class I allow this as my race is just a string.


Looking for Moose in all the Wrong Places

In my last post I again ending up like poor Keith Haring in his picture below.


I programmed what I wanted but it was beginning to look like the same stuff I started with.

So playing around a bit I remember…

Thou yeasty elf-skinned baggage!

With my last post I managed to apply a role to an instance of a class. What I think this will allow me to do is keep my base 'classes' from sprawling out of control while also encapsulation a good number of Game Rules' (or Biz Rules) in to small parts that I can easily reuse.

So far it has handled things quite well and even taught me a few things and I think has really exposed what Roles can do in Moose. Now as my D&D story moves along I am about to jump into what I thin…

Once more unto the breach, dear friends, once more;

In my last D&D post I managed to get my generic 'OpenDoorsOnA' role working with my 'Fighter' class but I was left wondering if I would make better sense to make 'Exceptional' Strength a role then only use it the rare time that a 'Fighter' character has 18 strength????

146e5bd2de81a98608834843fc9d5b1b_large.jpg="text-align: …

To Extend, or Not to Extend: That is the Question:

With apologies to The Bard and The Scottish Play for the bad miss-quote above. I am continuing on with my D&D Moose Quest. The last post I left of with what to do now that I am going to try to use a number of Mixins and how they perhaps can work with other classes.

I have chosen the 'OpenDoorsOnA' character ability as it is one that is not only effected by 'Strengt…

Roasted Moose With all the Mixins

In my last D&D post I left off with my six abilities as attributes in my character class and two 'traits/roles', ('Languages' and 'Henchmen') it did leave me with the question. Should I treat all or just some these character abilities as 'trait/roles' or should some be subs in my base class or $flip back and make my base abilities roles or even to go back to square one again and just make them subs in my original base class??

So I did a little reading and thinking and personally all these …

A Roleing Class Gathers no Moose

Well it seems I am making a little progress with D&D 'Character' classes I think I even got a role that will stick. I did have a little unfinished business from my previous post with my 'Character' class that I have to fix.

Namely it is important to the game that I know the current value of an ability which may change, and the initial value which will not, but I do not want to add in all sorts of attributes with funny odd names. So putting on my game design/players hat for a second,…

Oh Well Back to the O'l Drawing Board


Well that is the way I feel today, but at least, like Marvin, I am ready to start again. I tried in my last post to introduce a role into my D&D classes and all I ended up with what is what I started with, a muddle!

Well having another look at 'Intelligence', 'Characters' and 'Languages' I know that all 'Characters' h…

Rolless in Seattle

I left off from my last D&D post still looking for a role, but at least I settle on simple base class 'Ability' which I will extend into six abilities.

Now looking at each ability they all have differing effects depending on the value. So lets look at 'Intelligence' this time. According to the 'rules' it seems the more Intelligence you have the more languages your character can speak,as well for ="http://en.wikipedia.org/wiki/Wizard_%28Dungeons_%26_Dragons%29#Advanced_Dungeons_.26_Dragons_1st_…

Are Abilities Roles?

In my last post I started out modeling D&D characters with Moose to examine how roles could be applied

I ended with very little code written before I had to make a decision on using my first role or to use more traditional object extension.

Now, Looking at 'abilities' they all have the same set of common attributes, (I will just use a few)

  • name

  • initial value

  • current value

So to make this a class we would just do this

About byterock

user-pic Long time Perl guy, a few CPAN mods allot of work on DBD::Oracle and a few YAPC presentations