Party with Variable Hero? Dice rolling?

Hi all,

I’ve been a longtime reader of interactive fiction and gamebooks (the later more so), and as someone physically disabled, life can be both dull at times and trying at others. Rather than living my illness, I’ve decided to take up a new path in authoring my own gamebooks through ChoiceScript. With any luck, a debut with a Hosted Game (likely a line of them) will lead to greater things with the label!

That said, I’m not a coder by any stretch of the imagination, and I’ll likely have a million questions to ask when creating a title with gamebook style (lots of numbers, rolling, etcetera involved). My first post here mistakenly violated the forum rules by offering to recruit a coder for pay! The moderator has kindly decided to leave it readable for now if you’d like to reach me by any of the methods left available.

For now, I’ve gotta do this on my own! So, the questions.

  1. My debut project includes a party of four characters. Although each character’s name and what they are in terms of their class (think D&D) is predefined, I’d like to give the player the choice of which character is the leader of the group. In other words, they’re choosing which of the four is the main character, through which they interact with the rest of the game and its party.

So, how would I implement this and have it carry through to the rest of the game, with each character perhaps having different choices to provide options and replayability?

An example of the entry which opens the choice might be…

“I remember the four of them quite well. Heroes in their own time,” she said. “I know not whether it was by chance or the guidance of the gods, but their leader would soon be…”

  • Simon the paladin
  • Evella the mage
  • Korek the priest
  • Losara the rogue

From that point, the game takes place from the point of view of whichever character is chosen as the leader, with the characters not chosen tagging along as party members. Options, not to mention entire branches of the story, may close or open according to which character is chosen and which ones are the accompanying party members. How might I approach accomplishing this design in the code?


Another, perhaps shorter question. I’m using CSIDE for guidance but wondering about a few things which may align with my above concept. I mostly write gamebooks, so numbers and rolls are a big deal to me.

  • How do I define a list of attributes, and separately, a list of skills which can be advanced in play?
  • How, within ChoiceScript, can I prompt a roll of a character’s attribute or skill (or both) versus a die with my choice of sides (i.e. d6, d20, etc) based upon a choice they make? This would require including a target number for success, of course.
  • How can I include the party members in this system? Can they have their own separate character sheets with attributes, skills, and so on? Can I have their stats roll just as the hero’s would, when the hero is given the choice of having a party member do something?

I know it’s all a bit complex for a debut project/first project, but gamebooks always demand quite a bit of crunchy number stuff. If this is going to be my new hobby in life (a far more enviable one than just living my disability day by day) then I’ll happily jump right into the thick of it! Thanks so much for your help!

1 Like

Everything you listed is easily achievable. I recommend starting with the link below to get a feel for Choicescript and how you might achieve some of these goals. Once you get the hang of things, it’ll come like second nature. :slight_smile:

3 Likes

Are you imagining stats like you might see in a regular ChoiceScript game? If you haven’t already, I recommend checking out a few pages on the Wiki: choicescript_stats, variable types, and data types.

In startup.txt you might do something like:

*create simon_strength 0
*create simon_dexterity 0
*create simon_constitution 0
*create simon_intelligence 0
*create simon_wisdom 0
*create simon_charisma 0
*create simon_religion false
*create simon_persuasion false
*comment add more skills for simon

Of course, you’d add the variables for the rest of the party as well!

Create the variable in startup:

*create roll_d20 0

An example of how to roll the die, and then check for an outcome:

*rand roll_d20 1 20
*if (roll_d20 = 1)
   *goto crit_fail

ChoiceScript Wiki: *rand and *if

Yes, you can! You just need to define the variables for all the party members in startup.txt. And then, if you wanted, you could use the stats page to display their character sheets.

3 Likes

This sounds like a very intriguing idea, it definitely interested me! That being said I feel as though I should warn you: a big project like this tends to burn new people to CS out, without discouraging you (not my intention at all!) perhaps start off with a smaller game? With less variables (esp because you want 4 different portags with 4 different stories/personalities), even a side game or writing just 1 protagonist would be useful, especially in the learning stage! I just don’t want to see another author start a WIP and never finish it :slight_smile:

4 Likes

Thank you for the guidance and examples so far, everyone! Make no mistake that I find the wiki to be a very useful tool, but there are moments when it helps a lot to see someone show you directly how to implement something you have in mind. It’s a great means of learning how to use that same concept or aspects therein for future gamebooks, too.

Having said that, I have a question regarding the example of how to create the dice rolls! What I’d like to ask is how to integrate an attribute or skill into the die roll. For example, say Simon has a Strength of 14 and a Swordsmanship skilll of 10. He’s facing a potential foe, and one option is to strike out with his sword. The result of that choice is determined via a roll. How can I have the above example of the d20 roll add Simon’s Strength value of 14 and Swordsmanship value of 10 to the end result? This assumes something like a minimum value for success.

Yes, it’s indeed complex and I may start with just one character predefined as the protagonist and the others as party members. However, the loss of the optionally chosen protagonist and the various options and routes this choice opens/closes does take away somewhat from the game - and possibly the ending I had in mind!

I may be getting in over my head, but I suppose I’m going to sink or swim by my ambitious debut project. I certainly welcome anyone who I might contact for ongoing assistance to contact me, with deepest gratitude in advance for time given. If I complete just one book, well, I can at least say I didn’t allow my circumstances to stop me from doing that.

This is Simon's stats, set up:
*set simon_str 14
*set simon_swordm 10

What do you do?
*choice
   #Attack it with my sword!
      *rand droll 0 20   >> command to make a roll of 0 to 20
      *set pwr simon_str + (simon_swordm + droll)   >> CS can only do 1 operation at a time. That brackets mandatory.
      You rolled ${pwr}!
      *if pwr >= 40
         big roll!
      *elseif pwr >= 30
         lesser big roll!
      *elseif pwr >= 22
         not big roll!
      *else
         so on so on

This is the most basic, most crude example I can give you. More sophisticated system would involve subroutines *gosub and some crazy variable referencing {var}, but as a template to understand how CS handles things, hope this do.

2 Likes

Hey there, welcome to the forums! I doubt I can add more to what Szall posted, so please consider this more of a nerd commentary than a suggestion.

My knowledge on tabletop games may be outdated, but from the way I understand it, you don’t usually add the whole 14 or 10 points for a stat, but an addendum to the total score (I may be pretty wrong, please bear with me if so) so… you could set that in this way:

*create add_value
*create initial_strength 0

*if initial_strength 14
  *set add_value = 2
*if initial_strength 16
  *set add_value = 3

So instead of doing “simon_swordm + roll”, you would just do “add_value + roll”. I’m aware this is an even more complicated way to put things, but if you’re used to not using numbers too far off 20, this may help! And as of how to set up different characters in the beginning, I’m assuming you want to give each their own stats, which is easy enough:

Who will you play as?
*choice
  #The witch!
    *set magic +40
    *set sword -10
  #The warrior!
    *set sword +40
    *set magic -10

I’ll stop nerding now. Good luck with your game!

2 Likes

Listen, if you write code, then you’re a coder. Try saying you’re an inexperienced coder, instead. Experience can be gained.

2 Likes

Can I just add, this is a massive amount of work. I’m not sure you realise how much each extra character adds to the work load. It’s starts off ok, but gets exponentially harder as you go along. I’d strongly recommend against doing this as your first project as it’s highly likely you won’t finish it. (Nothing personal, just from what I’ve seen with newbie authors and complicated dead wips.) My advice is pick ONE available pov character and a standard party and give the the mc some customisation options. If you finish, you can always add additional characters to the story later on.

Also, if you’re using dice rolls, make sure you roll the dice before you need to. (At least the page before.) Rolling where you’re doing the stat changes means the dice will reroll every time the player checks their stats page.

5 Likes

Hi! Are you sure about that? This would mean that the engine refreshes the passage each time you leave the stats page… but I’ve found out that the opposite is true with my experiments in variable changes within stats screen… (Arrays and loops and choices, oh my!) When I change a variable in stats (say, change an item from “carried” to “equipped”) and then return to the game proper, the variable does not update until I move to the next passage.

I must say that this is very confusing to me… It is almost as if the engine is behaving in two radically different ways at exactly the wrong moments…

Oh, and to Kuroyama - I had a very similar idea a while back (also 4 characters!) but some other projects got in the way, as they usually do. It sounds very, very interesting - you could make it a Rashomon story (excellent movie btw) where one event is presented as completely different depending on who the observer is. This could perhaps be a solution to the problem of exponential complexity that Jacic is warning you about. If you construct your story to be fairly linear and then make it so that each chapter can be played through the eyes of a different character… well I can see a huge potential for replayability right there.

Also, I’d advise you to write your first draft from the perspective of one character or change characters automatically from chapter to chapter. Only once you’ve got the plot firmly in place you should add option at the beginnings of chapters to change the POV. This might help keep complexity manageable and yet retain the cool feature of changing POV as the story progresses.

Good luck and have fun!

Hello,

I just wanted to thank everyone for their additional feedback. Yes, I do realize that this project could spiderweb out into quite the array of possibilities, a very large work. That’s alright by me. I’m ambitious about doing this (enough that I’ve even offered to pay for coding help) because I’m doing something I want to do rather than wallowing in my disability any longer. I could write a much, much shorter story for my debut - I may as a side project, even - but the accomplishment would feel a bit hollow because my heart just isn’t as much in it.

If it’s any consolation, the work as planned has one path, not four completely different stories for each character. They’re going to the same place together, after all, seeing the same things. It’s unnecessarily redundant to narrate the same description of a room four times over. The differences are in the fact that options may open up to the protagonist which don’t occur to the others. Rolls and skills depending, maybe one of the other party members has a option to offer.

On occasion, there will be scenes unique to the character you’ve picked. These character scenes offer choices just for them which figure into later events, behind the curtain. If the party members are making their own choices in that same moment, you won’t see what they are (unless you replay the gamebook as each of them).

The scene eventually jumps back to that core route forward, a single line of scenes with choices differing according to what the characters have to work with. That’s the bulk of the effort, really, writing a single story path which has options accounting for each of the characters’ abilities and knowledge. Not four stories, but one story with various potential options (and the occasional entirely unique scene for your protagonist of that playthrough).

Even if I did a much shorter story, it’d end up being a gamebook. They’re just what I enjoy writing, lots of choices and randomness, number crunching to make things a bit less predictable. I’m not a fan of A leads to B leads to C story writing. That’s not to talk down to it; I’ve played great games which utilize that format, including from Choice of Games. I just like to be a bit more nerdy with my tale, as someone said above. Even a brief debut book would have a fair amount of work put into it. I’m actually learning a lot by diving into the more demanding alternative.

I might write something short on the side, as I handle the larger gamebook, just to get something out there. If it’s just a brief work of ten thousand words, why not? The real mountain I want to climb is the story I’ve already described, though. Succeeding there will be satisfying in light of my personal limitations.

With regard to the dice changing, I’ve actually read that before in doing research for my project. Someone did advise another writer to have the dice roll on the page prior to where the result is displayed, as the player can otherwise cheat the system. I don’t fully understand it myself, but I’m giving it my best to learn as I go along. @AdmirableAnimation has already been a hugely helpful guide in shaping some of my essential, formative code, creating a sort of ‘gamebook engine’ which I can use for future publications.

2 Likes

Yes very sure if we’re talking about the same thing. I had problems with it rerolling stats and fight rolls in one of the games I’m writing when I didn’t realise not to put the rand command on the same page as a skill check. Check out the bugs section here Rand | ChoiceScript Wiki | Fandom

Maybe this helps? How would I give ChoiceScript a small number generator/dice to select a certain situation?

Fair enough. I’m still not sure you realise just how large an undertaking this is, particularly as a first project, but you’re the one who needs to write and code it :slight_smile: