Sunday, January 22, 2012

First Bit Of Coding Done

Ok, so it's not even been a day since i first posted but i had actually writen some code already, over the last few days, so i thought i'd post while i can still think of what to talk about.
I mentioned at the end of the opening post that there are some limitations of both BASIC and FF books.  Well, the first one of basic i have stuck already, though it might not really be a limit, as such.  Limitations of the gamebooks are a bit more subjective.

I seem to remember basic being able to produce a random number between certain pre-determined values and i need to be able to immitate a regular 6 sided dice (d6) to follow the rules of the books accurately.  However, justBasic doesn't do this, instead it creates a random number between 0 and 1 back to about 6 or 7 decimal places.  So not quite the same.

But i've managed to make it work.  If fact the extent of the code so far welcomes the player, asks them to name their character and then generates skill, stamina and luck scores for them.  There is also the previously mentioned tribute to my cat, meaning if you use certain names you get predetermined values or stat bonuses.  Finally a loop allows you to start over if you aren't happy with what you  'rolled'.

I made a departure from the letter of the rules already and made the random numbers d10s.  Base bonuses for skill, stamina and luck, respectively increase to 10, 20 and 10.  As long as the monsters recieve the same treatment this shouldn't be a problem and i think the random numbers generated by the computer are more evenly spread if they are over a wider range.

Increasing this range also allows for a few 'special features' to be added, like weapons and attack types with different effects on skill and damage dealt.  Available for the player only, of course.

And since writing and being unable to post this entry last night (thank you stupid laptop) i've written a couple of quick subroutines and a weapon selection option.

Now the game asks the player if they'd like to choose a (S)word, (R)apier or an (A)xe, though i'll probably change it to Rapier, Long Sword, Broad Sword because i want to include a second special equipment option for a Axe later.  The Sword plays as normal, the Rapier gives you +1 skill and does 1 less damage while the Axe does +1 damage and lowers your skill by 1.

To allow for those kinds of weapon variants i've made the base damage dealt from an attack equal 5, instead of two so that rapier does 4 not 1 damage.  I have yet to determine if a +/-1 on skill (which ranges from 11 to 20, approx 11% - 5%) is worth a 20% swing in damage dealt.  The Axe and Rapier will have their fans though and find situations where one is preferable over the other.  It also allows a player to cover a weakness in Skill to a degree.

The first subroutine i did was a time counter.  Currently all it does is tell you every half hour of in game time that you have been there for x amount of time.  No big deal so far but it allows for a time constraint to be put on the game like: "You have only 2 hours until midnight when the ceremony will be complete.  If you do not stop it in time the world will be doomed!!" or less dramatic things like an encounter being slightly different if the player arrives before or after a certain time.

The second subroutine regenerates a players luck over time.  This is clearly a big departure from the game but it has it's advantages.  With a higher posible luck score (max. 20) a players luck can be tested more often before they get into 'dangerously low' territory.  To help maintain a consistent frequency of luck tests without killing the player the luck needs to be replenised and can be restored by a point every 10, 15 or more game minutes.  It does mean a player could keep moving between two safe locations to restore their luck but combined with time sensitive content a balance can be reached.

Next up is coding what will probably be the most tricky, the fight subroutines.  [fight1] shouldn't be too hard but the routines for fighting 2 and 3 enemies may be...

No comments:

Post a Comment