Update 6: Adventurers
A quick update because its 4am, but after a couple day break, I crammed some work in and the game now has the beginnings of an adventurer system! You can hire randomly generated adventurers and add them to your party.
UI:
- Game areas (Farm, Cave, etc) have submenu bars
- Dialogue box controls moved inside of the dialogue window, and made smaller
- Settings cog moved inside of main menu, and settings menu cleaned up a bit
- Various other formatting refinements, including stuff to make the page more "responsive" (e.g. adapts to different sized browser windows)
Game changes:
- You can now hire randomly generate-able adventurers!
- The game now saves the player's equipment
- You can now unequip a weapon
- A tooltip now appears for your equipped weapon as well as those in the equipment list, and -
- equipped weapon tooltip shows current equipped weapon, for slightly easier stat comparison
- Health regenerates over time, at a default rate of 1/s. Thus, if you die in combat you don't automatically get full health anymore.
- Health doesn't regenerate for characters who are in combat
- Other tabs are disabled while in combat
Hiring Adventurers
The system so far is pretty basic, but the goal was to get the framework in place. You can hire adventurers, and the game saves them, and dynamically fills out your party screen as needed. Currently, you just click "Hire" and a fresh adventurer is generated. You can then hire, re-roll their stats, get a fresh new adventurer, or reject them entirely.
In the "final" game, it probably won't be this easy - there may be a pool of shifting adventurers (e.g. in a tavern), rather than generating on demand (but I needed to build the code for generating adventurers in the meantime). Initially, the stat distributions will be lower, as you get lower quality adventurers. But as your reputation goes up, not only better classes, but those with better base stats, will start to show up.
Generating Random Stats
Most old school RPGs (read: D&D) had the main character stats range from 1-18, mostly, with 18 being incredibly tough. I wanted to use this range but make the randomisation weighted toward a certain bracket - e.g. most should be, say, 14-16. I tried out a bunch of ideas found on forums, from just a straight up random range, to tips such as "get 3 random numbers then avg. them to get weighted toward the middle" to writing custom distribution functions. I tested it out by making the game keep track of these different approaches' averages:
...which all had exactly the same result.
After playing with a few, in the end it really was as simple as just "adding" a few different random numbers together, and playing with the numbers to get the bias I want. I set a bias of around 17, because let's face it, RPG players reroll until they get decent stats, so this speeds up that process. You can still get unlucky and get single digit stats, so it's not a cakewalk, but generally, it shouldn't take too many rolls to get something decent.
Of course, the weighting will probably change in the full final game, but it was fun to play around with.
Making Equipment Comparison toolips
I lost many hours trying to make a way for the game to show you your current weapon stats and one from the equipment list at the same time, for comparison, a la many RPGs e.g:
As simple as it should seem to just make two tooltips appear at once, it was very problematic. long story short, the way the code is set up, it's just not possible - I coded myself into a wall, and would have to rewrite a lot of things from the ground up.
So I settled on a compromise of sorts: When you mouse over some equipment, the tooltip simply displays the description of both the selected item and your current equipment, one after the other, within the single tooltip. Blunt, but it does the job:
Next Steps
I need to continue integrating the adventurers, primarily so they can also be equipped, and then add them to combat. I'm planning a basic turn-based battle system, where characters take turns in order of their SPD stat (which will probably be derived from DEX+AGL for now). Then, dungeons need to be fleshed out, to have multiple encounters, and the ability to "clear" them, opening up the next dungeon in the list.
For now, the narrative and deeper roleplaying elements are a distant dream, but I'm hoping, with 8 days left, that I will get a few solid days in the end to purely focus on story and world building!