Saturday, June 30, 2012

Yes, I'm Still Here

It has been quite some time since i last posted and, as the title says, yes, i am still here.  And i've been meaning to make this post for several weeks now.

I think my last post said i was about to start my programming course.  Well, after 4 months i have finally got into some actual programming work!  It's this last four months of everything in between which has prevented me from posting till now.  (Not that anything has actually changed in my work load, i've just "made time" now.)

It also means that over this time i haven't had a chance to do any more coding on the game but i have been wanting to finish off the [Fight3] subroutine all this time.

Before i started this module, the one which has actual programming, i did a module of theory, including the Systems Development Life Cycle and Program Development Routine and i was tossing up whether to retro actively apply these principles to the FF project.  I decided against it as i already have a pretty clear idea of where i'm going with the game and what i will need to do.

Then i started this module which is learning Java and Object Oriented Programming.  Which i'm sure a lot of people are already very familiar with but is quite new to me.  And the thought arose again, "Should i redo the work[ in Java]"?  I flip-flopped a bit and was thinking that "the original plan had been to do it in Basic so i should stick with Basic on principle" but this doesn't necessarily benefit anyone and as i've such little spare time now it's not really in my best interests.

So, despite the time i've spent writing the code in Basic i think it's best to switch to Java now.  Java is, after all, a currently and widely used language so at the very least i can get some valuable experience coding Java.  It will also give me the option to improve the user interface by taking the game a level or two above the basic DOS text adventure it was shaping up to be.  Which is not to say that there will be a drastic graphical improvement but it will be a better interface.

Now i just need to find the time to start rewriting averything i have already written... :S

Sunday, February 12, 2012

Underway

I have to keep this fairly short because...

I've started my programming course now.  Four nights a week with a couple hours between work and study, which i am now using to post here.

So far it's been pretty simple stuff, introductions to how the place (Computer Power) runs and does it's assessments.  My current module is a guide to using Windows 7...  It's got 20 hours assigned to it, hopefully i can get it out of the way tonight.

In a strange bit of irony, my last session of last week was cancelled, luckily before i got on the train, because the computers at CPI weren't working.  Hehe.

As to the programming of my FF game.  Well, it's been held up a little due to a lot of spare time being unavailable and spending a couple of weekends actually relaxing and doing nothing.

I finished writing the gosub for fighting three enemies and it mostly seems to work.  Unfortunately it doesn't completely work as it's intended to.  The sub basically consists of three parts.  In the first you have three oppoents and can choose to fight either of them and change opponents after each attack if you want.  When one dies the sub advances to one of three different continuations which deals with only the two enemies left.  When you finish off one of them the sub goes to one of three final stages, one for each enemy which could have survived till the end.

The sub works perfectly up to this point, switching between each section as each enemy dies but when you finish off the last one, it doesn't return as it should.  Instead it goes back to an earlier stage, usually the middle point where two enemies remain and repeats from there.  Of course the enemies are dead but they have just been promoted to undead thanks to this glitch.  They have negative hit points but can still attack...

I have thought of a posible solution though.

Currently the sub is, as it sounds, one long gosub with different [sections] for the process to flow through, or past then return at the end.

I'm thinking of breaking it up into seperate gosubs, each dealing with one stage of the fight and each returning to the original [area] after one enemy is finished off.  Then there will be code in the [area] which checks to see who died and directs the process to the next appropriate gosub part.  That will mean a bunch of extra code in each [area] that contains enemies.

I can work around that though.  I can make the section which sends the process to each relevant gosub a gosub itself so the process should go like this:

arrive at [areaX] with enemies.
gosub [fight] and check number of enemies
if enemies = 3 then gosub [fight3]
etc.
when one enemie dies, record as dead then return to [fight]
check which is dead then gosub [fight remaining two]
record which enemy dies then return to [fight]
check which died again then gosub [fight last]
return to [fight] when last is dead
run through a post fight sequence then return to [areaX]

Apologies if my notations don't look anything like they should, i'm still winging it afterall.

Hopefully that will work.  If it doesn't i think i'll really be at a loose end and have to go back to the max of two enemies...

Friday, January 27, 2012

BONUS POST!! The Story So Far...

This is what you will see when you run the game, in it's current state of completion.  Not exactly what you will see because there's no justBasic window around it but it's what  you will read.

KillystuffKastle is a place holder name and should be an obvious parallel to Deathtrap Dungeon.  It will be changed to something more appropriate in time.

Welcome to Killystuff Kastle
A game in the tradition of Fighting Fantasy
By Richard 'Palocles' Henderson
Turn on CAPS LOCK, it'll make things easier.
Welcome Adventurer
(press enter to continue)
Although this game is in the style of Fighting Fantasy there are some notable differences from the original rules in the gamebooks.  The most significant of which is that you won't have to keep any records or roll any dice, the game will do that for you.
You can weald one of a number of different weapons and in combat choose from one of several different types of attack, with different effects on your attack roll and the damage dealt.
(press enter to continue)
LUNGE is a good attack to use in the first round of a combat and can cause extra damage.
JAB is a quick and accurate attack but causes less damage.
A SLASH can cause extra damage to some creatures who are vulnerable to this type of attack.
CLEAVE is a powerful but less accurate attack which can do serious damage.
A regular ATTACK will need to be made at times to prevent enemies predicting your attacks and countering their effects.
(press enter to continue)
In each area you enter you will be told in which directions you can continue onwards and some of the actions you can do in these areas.  In some situations you will be able to perform actions for which you are not prompted and must, instead, use your own initiative to guess what you can do.
When you want to try an unprompted action, simply type a single word (in CAPS) describing the action you want to try.  For example: type SEARCH in an area with a secret door and it will be revealed if your Skill test is successfull.
Other options might include: INV(entory), CLIMB, SNEAK, HIDE, BREAK, etc.  You will not need to state what you are trying to climb or break.
Finally, a tally of your time taken is kept.  Over time your Luck will slowly replenish and the time you arrive at a location might effect what you find. Some actions, like eating will add to your time tally.
(press enter to continue)
Before you go further you must tell us who you are!
What is your name? PALOCLES
Hello, PALOCLES
Skill: 13  Stamina: 50  Luck: 16
Make new Character? (Y)es?
Choose your weapon: (R)apier, Long (S)word or (B)road Sword:  R
Rapier, damage: 4, skill: 1
Weapon ok? (Y)es?  Y

You are PALOCLES
Skill: 13  Stamina: 50  Luck: 16
You have a Rapier and Leather armour.
You have a Backpack with [5] provisions and [5] healing herbs.
Your belt pouch contains 14 pieces of gold.
(K)eep this character?  K
You are a wandering adventurer and have been travelled for many miles when you see a village on the road ahead of you.  Anticipating rest and a refreshing ale in the tavern the town will surely host you adjust your pack and quicken your pace.
As you approach the town it becomes apparent that all is not right.  Where there should be the bustle of village life, farmers bringing their wares for trade or the sounds of the local smith, you are greeted with empty streets and silence.
With your left hand resting on your belt, using your thumb you nonchalantly loosen your weapon in its scabbard.  As you pass the outlying houses and enter the high street you remain alert to posible ambush.
(press enter to continue)
You pass the tavern, it bears the sign of cat in silhouette with a rooster shaped hole through it.  Looking in through the windows you can see the tavern is as deserted as the town seems to be.  You lick your lips as you see the kegs behind the bar.
As you proceed deeper into the town you hear voices from ahead.  In the town square you see a group of what must be the villagers.  They seem agitated, voices are raised and some women can be heard crying.  You quietly approach the group and listen to what they are saying.
From what you overhear you can determine that some of the towns people have vanished during recent nights, the first to disappear some days ago.  None of the villagers are sure of the cause.
(press enter to continue)
A grizzled man with a weathered face and worn leather clothings growls about a group of monsters he has found tracks of.  A woman screams that her children have been eaten by Orcs!
A chubby man, looking besieged by the crowd desperately trys to calm the group.  He must be the towns mayor or bursar, while the grizzled man seems to to be the local ranger or a retired fighter.
The beleagered bursar sighs and begins to burble something about mercenaries from the large city a day or so travel away.  At this time you decide to make yourself know and clear your throat.
"AHEM"
(press enter to continue)
You tell the people you have overheard their talk and that you:
Would like to (H)elp them find their people and kill the monsters!
Think you could posibly help them, if the (P)rice is right.
(D)emand that the tavern keeper return to the inn as you are a tired and thirsty traveller in need of refreshment!
Make your selection, (H), (P), (D):
What would you do?  Don't worry, you can't die.  Yet.

Don't turn your monsters into mans!

I spent the last few days working on the [fight2] subroutine and gee, it takes a lot of lines of code to add an enemy to a fight!  The whole thing weighs in at nearly 500 lines, probably only 50 of which are the code for the 1 on 1 fight.  But did it all went fine, right?  Nope.

When i had everything complete and was trial running the code the second monster was not doing any damage and in some cases was actually adding damage instead of subtracting!  I scoured the code for hours and everything looked fine but still the problem.  Well, eventually i found the problem but not before posting on the justBasic forum again, asking for help.

The variable that determines the damage that the number 2 enemy does is called mon2dam and through-out the code the variable was written correctly but he still wasn't doing damage.  It wasn't till i was editing my post in the forum that i noticed what was causing the trouble.  As the subroutine was taken out of context i'd listed a bunch of arbitrary variables at the beginning to define the monsters parameters.  These were things like: mon1ski, mon1sta, mon2ski, man2dam, etc.

See the problem?  I'd typoed the mon into a man and as a result, when the program went to check his damage value it couldn'f find one so gave it a value of 0 by default.  Fixed the typo and problem solved, everything working as it should.  Yay.  I'm done now, right?

Wrong.  I still want to add more to the fight subroutine (It's really just one long sub which handles all the enemies and shuffles off the left overs to other parts as some die) so that it can handle a three way.  A fourway really, with three enemies attacking the player.  Why?  Because goblins are shite.  One on one they get slaughtered and it's only in numbers that they might pose a threat and probably only in numbers that they would even dare attack a human armed with anything more serious than a garden hoe.

In fact i think i should even add a modifier to the sub so it will offer the poor little buggers an advantage for fighting in groups.  A simple +1 skill each, for each monster in the group and it might even give them a chance at doing some damage before they get butchered.  As they die the bonus will diminish and it would only require adding a +1 or +2 in a few different bits of the code, specifically the part that determines their attack value, to make it work.

That will be easy.  Coding the [fight3] segment will be less so.  Having done the [fight2] part i know what to do but it will take a while and a lot of code.  The number of different outcomes increases drastically with more opponents, no more player hits vs. monster hits.  Now it's player hit/miss x monster1 hit/mis x monster2 hit/miss x monster 3 hit/miss.  And what if the player kills the second monster first?  So many permutations...

Tuesday, January 24, 2012

Fight's over, now on to plot.

I wrote the [fight1] (fight one monster) subroutine on monday night and tidied it up on tuesday.  I've even included a goto to allow the player to use luck during combat but my current luck test only reduces luck on a success.  Is this too much of a departure form the original FF rules or is it an improvement?  I had to check after i wrote it whether it was right or not but i think it's fair to only dock the luck point on a successful test.  Perhaps a purist would disapprove but what do my readers think?  Do i even have any readers?

I think all the code i've written so far if pretty solid, for what it is.  I've fixed a bunch of errors which would basically hang the program at a question if you didn't give a usable answer.  Now they all either repeat the question or continue to the next part of the game.

So a quick run down of the program to show what you can do so far:

[chargen] names and generates the stats of the character.
[weapselect] allows you to choose between three different types of sword
[fight1] to fight a single opponent
[testluck] to... test your luck
[time] to keep track of time.  I might rewrite it to record the total in a different way though
[restoreluk] adds 1 to your luck score every few minutes
[area1] a template for a location, including monster variables
[gameover] which runs when you die, telling you a few stats about the game like (game)time taken and monsters killed.

I still need to make a template for a location which has a trap as an obstacle instead of monsters and a template for locations which don't really do anything more than connect other areas.

What all this means is that, at this point i basically need to come up with a story to continue the work.  As the original inspiration was Deathtrap Dungeon, i'd like to make this first version similar to that but i can't think of an intro which isn't incredibly contrived.  I can get a copy of a map of DD and code that but DD is probably copywrite and, as i'd like to make this effort available to the public, i think i should do a unique story.

I have got an idea for a werewolf based adventure which makes a lot of use of the time keeping sub and will pay homage to the great Werewolf TV series, including the hunt for Skorzeny.  But i don't want to do that yet because it's more a month in the wild than a dungeon crawl (it's not a dungeon crawl at all).

I think i'll have to sit down, bust out my old school mapping skills and draw a map of the dungeon.  It would be best if i know what sort of areas i will be putting in before i do the map and, based on comments on Fighting Dantasy and/or turnto400 it should be an environment which people could actually imagine is a real environment that the monsters could live in.  It might be fantasy but orcs 'n goblins still gotta take a crap somewhere.

So basically, at this stage i am asking for plot ideas as well as ideas for evil deathtraps, encounters and puzzles.  I do have ideas for a section of the map, a trap and an obstacle but they will only be a very small part of the whole effort.

Players of the original game books have also grumbled about arbitrary deaths for wrong turns or having/not having certain items.  So i'd like to have the player able to make a difference in these situations.  Clues in the text indicating that a certain direction or action could be dangerous (more dangerous than exploring dungeons), redundancy in vital items, ways to escape deathtraps, etc.

Finally i'd like to be able to include expository text, in appropriate areas, in the game to develop the story and give the player the impression they are involved in something fairly organic.  Maybe it's just me but i think a plot is important to games and for this sort of game, even more so.  The player could just kill their way through a bunch of tunnels and steal everything they find but it would be so much more rewarding for them to do it in the context of a dramatic story arc which builds up the role of the bigbad and his nefarious plot before they reach the ultimate encounter and fight the final showdown.

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...

Saturday, January 21, 2012

Let's get the dice rolling, or the rnd(1) generated.

G'day, i'm Richard but my Matrix name is Palocles.  I'll take this opportunity to give a proper run down of what i'm doing here as the blog description only allows 500 charcters, which is woefully insufficient.

A long time ago in a city not too far from here i was in highschool and decided to take Computer Studies as a subject.  This helped me avoid sports but did nothing to alleviate my geekish status.  Said status being further enhanced by an interest in such things as Fighting Fantasy books and RPGs.

At some point in that, my last year of highschool, i decided to convert the FF gamebook Deathtrap Dungeon into a computer game.  The way Basic work(ed/s) led me to believe it would be a simple enough matter and the content could remain virtually unchanged.

I successfully created the code to name a character and generate their stats: Skill, Stamina and Luck.  With a checky little cheat which made the player absurdly talented if they named themselves "Bobby the Cat", in honour of my cat, Bobby.

Unfortunately the project got derailed when i began to transcribe the fluffy background material, otherwise known as the Coercive Beginning, into the program as this took so much time i never got around to writing any more actual game code.  D'oh.

Fast forward nearly 20 years and here i am again.  About to begin a Programming Diploma and suddenly inspired to repeat my original attempt to convert Deathtrap Dungeon.  I wont be learning Basic on the Diploma, there are much more powerful languages available but out of a sense of nostalgia i intend to use Basic yet again.

A quick Google search reveals that justBASIC is free and has wiki and forum support.  A quick tinker around with the code reveals i remember fuck all of the language and justBASIC differs slightly to what i remember.  Nevermind, it comes with Help files and Tuts.  Which Vista doesn't support...

So my start was off to a bit of rocking and/or shaking.  A couple of forum posts later and with thanks to Rod i had got the Help files working!  First obstactle overcome.  Next obstacle, crap loads of coding...

My next post will describe the progress i have made thus far and may also include some discussion on the limitations of gamebooks and whether they should be adhered too for this project and the limitations of coding in Basic.

Also thanks to Murray of the very funny Turn to 400 blog and Dan of the prolific Fighting Dantasy blog, both here on Blogspot, for inspiring me to actually make this blog of my efforts.