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.

charrec-front.jpg

So my dilemma now is to choose an appropriate design for the 'Application' as a whole.

From my diagram from an earlier post on character creation indicates that a simple Procedural style. The user starts with a set of dice rolls for abilities and is then presented with choices until a character comes out the end and is either persisted or dropped.

Should I bother writing that part with Moose, after all it will just be a series of if else or given when statements that enforce a set of business rules. Will I have code here I can reuse later on? Is this part going to scale up to create 1000s of characters at a time or just 1 character 1000s of times? How complex is my data? Can one go forward or backward though the differing stages of the procedure, can one save half way though. How are the differing stages to be exposed, will it be web-pages, web-service, stand alone script? If the differing stages are exposed how do the communicate with each other, email, html, xml, hash-ref?

Do I really need OO for this and if I use OO Moose how can it help me?? Well there is my next post me thinks.

'Character Instantiation' is my next little 'Application' and from all my previous posts I can rest assured that this will be an OO built on Moose and the instance data will be coming from some persisted source that will be correct (you won't be able to get a dwarf -elf- paladin - assassin) but do I create these using an 'Object Factory' where I just pass it some data and out pops my 'character' or perhaps an 'Abstract Factory' or perhaps even a 'Builder' System.

Well lots to look at there.

Finally my 'Game Play' part of the puzzle. Really the easiest choice of the three as I have all these roles hanging around. The 'Decorator' pattern will suite me best. In game-play a character is decorated with extra abilities (roles) such as 'a curse', 'weapons', 'poison','spells' etc as the game goes on.

I think in the end I will also have some sort of 'Composite' pattern to go along with this as single character adventures are boring (and very short) and monsters have a nasty habit of attacking on mass.

Well plenty to think about for the next little while.

130510.png

Leave a comment

About byterock

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