PDA

View Full Version : Dnd's Game Values



Indigo Knight
2018-06-20, 11:27 AM
Inspired by Durzan's thread I want to ask the present:
If you had to write down the types of values in dnd (ala object oriented algorithm), what would you choose?


Already suggested:

Per character:


Statistics
HP (Current, Maximum)
Abilities (Str, Dex, Con, Wis, Cha)
Saves (Will, Ref, Fort)
Level per Class (type, number)


Inventory
currency (type, amount)
items








Effective caster level, Caster level, Spells per day, Speed, Race, Skill,

Indigo Knight
2018-06-20, 11:29 AM
Going to use a second post to chart some common ones:

The six abilities (Str, Dex...)
The three saves (Fort, Will, Reflex)
Hp

Anachronity
2018-06-20, 12:11 PM
rolls (d20, 2d8, etc.)
bonuses
values (attributes, hitpoints, damage taken, and other tracking numbers)
abilities (more loose than the actual D&D term, instead acting as more of a pointer. Would include feats, racial abilities, class abilities, items, spells, or any other 'character option')

or maybe I'm misunderstanding the question?

Indigo Knight
2018-06-20, 01:00 PM
rolls (d20, 2d8, etc.)
bonuses
values (attributes, hitpoints, damage taken, and other tracking numbers)
abilities (more loose than the actual D&D term, instead acting as more of a pointer. Would include feats, racial abilities, class abilities, items, spells, or any other 'character option')

or maybe I'm misunderstanding the question?

Apparently.
I was asking about integer storing. You wrote it as values.

Lvl 2 Expert
2018-06-20, 01:07 PM
So, the question is, if I understand it correctly: which variables would a computer program need to store in order to create a save file for a single game of D&D?

It's probably good to split it into global values and things that are stored per character.

Per character:
HP
base stats
skill points per skill (and left over or total) (if 3.5)
money/gold pieces
number of items per owned item type

Global:
Hours until events
Number of dragons to slay to fulfill the prophecy
"how often has the party pissed off the king counter"

Stuff like that?

Indigo Knight
2018-06-20, 01:15 PM
Yes. True.

I'm not that interested in 'Global variables' as you mentioned.
I've updated the first post.

MoleMage
2018-06-20, 02:31 PM
Some more that I don't think fit into the above.

Level
Exp (Current/To next level)
Maximum Spells Known and/or Maximum Spells Prepared (depends on caster class, these are the numbers; separately you'd have to store the actual lists of spells known/prepared)
Number of Spell Slots (for each spell level, plus cantrips in 3.5) per day
Hit Dice (Current/Maximum/Size)

Indigo Knight
2018-06-20, 03:52 PM
So here's a thing: there are multiple references to level;
Hit dice, level, experience, challenge level, caster level and some more.
Is it really necessary to have that much different names?
My theory is that it's possible to have just one value and get the other as a derivative everytime it's needed.

For example - spells. If you know caster level and the ability modifier then you can calculate spell known and spell per day. Does it really necessary to store it differently ?
And this question isn't just a programming question. Why track it separately?

MoleMage
2018-06-20, 04:04 PM
So here's a thing: there are multiple references to level;
Hit dice, level, experience, challenge level, caster level and some more.
Is it really necessary to have that much different names?
My theory is that it's possible to have just one value and get the other as a derivative everytime it's needed.

For example - spells. If you know caster level and the ability modifier then you can calculate spell known and spell per day. Does it really necessary to store it differently ?
And this question isn't just a programming question. Why track it separately?

For level, the only issue is multiclassing. Assuming you're using 5e (where Hit Dice are more significant), if you have 10d8 HD and you're a multiclass Monk/Rogue, for example, how many of those are monk and how many are rogue? You can figure out total level for the purposes of knowing when to level up from the Hit Dice, but you still need level per class.

As for spells, I can see where you're coming from for parts of it (if you're an X level Wizard with Y Int bonus, you get Z spells prepared, without exceptions that I'm aware of). Spell slots available are a volatile value though; over the course of a day you'll use some up. I can calculate my maximum spell slots from my other values, but not my current spell slots (either you need "spells cast already" and do some math or "spells currently available" and do some different math).

Indigo Knight
2018-06-20, 04:42 PM
So what would you minimize them to? (in respect with level calculations?)

MoleMage
2018-06-20, 05:01 PM
I would say level by class can be used to calculate things like hit dice instead of the other way around. So current level (per class) is the only thing stored, and maximum hit dice, total level, and next level experience needed are calculated from the list of those rather than stored directly.

Indigo Knight
2018-06-20, 05:09 PM
But not hit points, I assume.

MoleMage
2018-06-20, 07:05 PM
But not hit points, I assume.

Maximum could be if you used averages I suppose. But for typical rules not HP no. You also couldn't calculate level from HP unless you used averages (estimate yes, calculate no).

Knaight
2018-06-21, 12:59 AM
So here's a thing: there are multiple references to level;
Hit dice, level, experience, challenge level, caster level and some more.
Is it really necessary to have that much different names?
My theory is that it's possible to have just one value and get the other as a derivative everytime it's needed.

You can derive a bunch from storing an ordered list of classes taken per level, then using the various class values to derive BAB, saves, spell slots, etc. That said it's a pretty negligible change in file size, and it adds more trouble than it's worth. Just store the full stat block.

Indigo Knight
2018-06-21, 06:13 AM
I wanted to disagree with you because of reasons of duplicate variables and a want to simplify calculations as well as backwords calculations. But I think it's more straightforward to store even the numbers that are derived from class. I guess.

So, what's more to add?

Zombimode
2018-06-21, 06:54 AM
So here's a thing: there are multiple references to level;
Hit dice, level, experience, challenge level, caster level and some more.
Is it really necessary to have that much different names?
My theory is that it's possible to have just one value and get the other as a derivative everytime it's needed.

For example - spells. If you know caster level and the ability modifier then you can calculate spell known and spell per day. Does it really necessary to store it differently ?
And this question isn't just a programming question. Why track it separately?

Because that only works with Things that are 100% reduceable - and nothing in 3.5 is.

Your effective class Level (not caster Level, which can be something completely different) for the purposes of spells per pay plus you effective ability score for the purposes of bonus spells per day are just the start. Spells per day can be added or subtracted by feats, class features and effects.

Would it still be possible to live without an explicit data structure for spells per day? Sure. Technically you only need the op-codes of your CPU and memory adresses to write any programm.

What some beginning programmers don't get is that your Code does not need to be clever. It needs to be clear, easy to use and easy to maintain.

Take Spells Per Day:
Instead of defining a new data structure you write convoluted Getter and Setter methods that some kind of Arrays as input and output Parameters. Lets asume that you got it to work correctly. Now, someone wants to add the "Extra Slot" feat. With a data structure for Spells per Day, this would be the easiest thing in the world. Without you have to manually alter the base methods for your property.


In General: if you were to write a D&D API every property that game has* should be a property that your API provides. How your API is set up internally is up to you, but for your own sanity you want something clear and easily extensible.


*to the extend you want it to model. For instance, if your goal is "D&D 3.5 but without Magic of Incarnum" than your obviously don't Need to provide an Essentia property. Or if you know that your target application can't handle flying entities, Fly Speed is not something you Need to track.



Maximum could be if you used averages I suppose. But for typical rules not HP no. You also couldn't calculate level from HP unless you used averages (estimate yes, calculate no).

There is no reason* why you would not store MaxHP and CurrentHP as their own properties.


* for the implied context of a Desktop or mobile Plattform game. You don't write a D&D API for time-, space- and security-critical contexts like astronautics.

JeenLeen
2018-06-21, 08:00 AM
I've considered something like this off and on as a fun programming project.

I think a lot of minimization can be done by having lookup tables to pull in information. So you might have a basic "Character" data type with values like CharacterLevel, Race, AttributeArray (list of Str, Dex, Con, etc.), MaxHP, ClassArray (that is, a list of what class was taken at each level), and something for feats/skills, depending on edition. For 5e, it'd be pretty simple to have something like an array of all skills and note which ones you are proficient in (including tools in this list). Likewise could have a list of feats taken. An another list for items held, plus some slots for currency and if you want any metagame/narrative knowledge (e.g., arrays of how favored the PC is by various factions).

I'd have a lookup table for each class, so your ClassArray can pull in what class features, spell slots, etc. It also gives you your hit die (not max HP, but hit die for purposes of short rest recovery in 5e). I do think you'd need some complicated array for each character (or set of arrays) to house stuff like spells known, how many spells already spent, etc. Maybe a list of items that have something like "feature name" (which links to another lookup table for details, if needed), "when recover" (could be instant for features you can always use, short rest, or long rest), Class (showing what class gave it, in cases where redundancy due to multiclassing might matter), and an indicator of if it's used or not. Something like that could house long-rest-recovered things like wizard spells, short-rest-recovered things like warlock spells, infinity-use things like 5e cantrips, and even stuff like barbarian rages.

Race would also link to a lookup table, allowing you to pull in whatever that gives you.

You can probably minimize storage a lot by using codes and having them linked to other lookup tables, but I think the complications for understanding the code wouldn't be worth it. I'd rather see Bard, Barbarian, Cleric, etc. written out (or at least reduced to a 3-character, fairly easily discernible code) than use a numeric coding for each.



What some beginning programmers don't get is that your Code does not need to be clever. It needs to be clear, easy to use and easy to maintain.

There is no reason* why you would not store MaxHP and CurrentHP as their own properties.

* for the implied context of a Desktop or mobile Plattform game. You don't write a D&D API for time-, space- and security-critical contexts like astronautics.

Very good points. While you could minimize the memory storage in many ways, it often isn't worth the convolution. Even if nobody else needs to look at your code, you might want to update it sometime, and I know I can't always understand my code if it's been a while and I didn't comment it well or I wrote it crazy.

Indigo Knight
2018-06-21, 10:17 AM
Do keep in mind that I'm not about to write any code for a program. I'm more asking from the point of keeping numbers and items for game purposes. As, this is a homebrew design page and we're all juggling theoretical numbers.
I've already conceded about the general notion of keeping track of overlapping functions. Thou I do wish I could narrow them down in order to avoid too much book-keeping when playing.


So, code related approach aside - a player would likely want to write down the number of potions he has left in his possession, but does he really need to mark ability modifier if you have ability number and the ability minus ten, halved gives you the what you need.
Personally, I wouldn't need the repetition of ability modifier.
But then, what if you've been drained? And on...
This is what I'm thinking about.





if you want any metagame/narrative knowledge (e.g., arrays of how favored the PC is by various factions).
Are there any core rules in regard to this?

MoleMage
2018-06-21, 10:28 AM
Are there any core rules in regard to this?

I know the 5e DMG has optional rules for this at least.

If you're trying to minimize tracking things by hand, my experience is that more tracking is better than more math. I usually pre-record my attack bonuses with various weapons, and in 3.5 would even write out entire full-attack routines ahead of time. The math isn't difficult (by design), but it does require an interruption of thought to do. I'd rather write everything I can ahead of time. It's somewhat faster (noticeably faster if you're new to the system or have a lot of small bonuses to calculate), but significantly smoother.

Tl;Dr bookkeeping is better than number crunchanged in the moment.

JeenLeen
2018-06-21, 03:46 PM
Do keep in mind that I'm not about to write any code for a program. I'm more asking from the point of keeping numbers and items for game purposes. As, this is a homebrew design page and we're all juggling theoretical numbers.
I've already conceded about the general notion of keeping track of overlapping functions. Thou I do wish I could narrow them down in order to avoid too much book-keeping when playing.


So, code related approach aside - a player would likely want to write down the number of potions he has left in his possession, but does he really need to mark ability modifier if you have ability number and the ability minus ten, halved gives you the what you need.
Personally, I wouldn't need the repetition of ability modifier.
But then, what if you've been drained? And on...
This is what I'm thinking about.

Ah. I see better now. To my surprise, I think there's a strong parallel between programming information-recording and character-sheet info-recording.
Also, I think the number storage can actually vary from player to player, depending on what maximizes fun for that person.

Some stuff is always needed, and I guess that's the minimum: level, what class each level is, race, max HP, current HP, list of items, gold, and maybe something based on class features (spells known, rages left, etc.), whatever you need for your edition's skills.
The minimalist view is basically a programming one: how can you, with minimal data elements, retain all information. The rest can be looked up or memorized by the player. For stuff like temporary drain or debuffs, those are just a status you note in a Misc box.

But some players might find the game easier if, on their character sheet, they write out details, like what the roll is for their weapon, or for their weapon under this normal buff they usually have. It takes up more space, but it makes it take less time (and mental effort) during play. What those extras would be can vary from player to player.
Thus, like with the programming example, we get something about ease of interpretation and readability as well.

brian 333
2018-06-21, 04:03 PM
Look into Neverwinter Nights. It is a 3.5ed. D&D game built with the intent that it be player-modifiable. Thus, all the variables for characters are easily accessible.

Indigo Knight
2018-06-21, 05:04 PM
I know the 5e DMG has optional rules for this at least.

If you're trying to minimize tracking things by hand, my experience is that more tracking is better than more math. I usually pre-record my attack bonuses with various weapons, and in 3.5 would even write out entire full-attack routines ahead of time. The math isn't difficult (by design), but it does require an interruption of thought to do. I'd rather write everything I can ahead of time. It's somewhat faster (noticeably faster if you're new to the system or have a lot of small bonuses to calculate), but significantly smoother.

Completely agree with the assessment that simply writing down every number is better then calculating it every time. Thing is that those numbers are also susceptible to recalculation. Especially after suffering debuffing during play. When I first read the pathfinder book I kinda rolled my eyes a little - Do I really have to keep count of my attack bonus, my base attack bonus, my proficient attack, my offensive combat maneuver, etc'? (Exaggerating, ofcourse)

I wanted to write my goal as concise and to the point as possible therefore short. But it seems I only confused my readers:
Again: I'm not looking to program anything. Not delving into code. But I do want to see what are the numbers that makes the game go round. A peek under the hood.
As was already hinted above, the game doesn't have any clear core implementation of fame and renown (sadly). So there are no numbers for that. (I also think this is what makes diplomacy checks so weird. A game aspect that is usually handwaving is suddenly rolled for).
Some numbers doesn't have any sustenance without others, like ability modifiers.
Some number are simply a must (current HP).
And some number are a weird duplicate, such as the nature between reflex save and touch armor class.

Does this make it more clear?



But some players might find the game easier if, on their character sheet, they write out details, like what the roll is for their weapon, or for their weapon under this normal buff they usually have. It takes up more space, but it makes it take less time (and mental effort) during play. What those extras would be can vary from player to player.
You speak the truth. However, most (if not all) players agree on a set group of rules that are widely spread. Whether because it was introduced in the core rulebooks or it makes playing convenient matters less. It gives sort of ground level to build from there. If I create homebrew which is based on Tome of Battle it would be reasonable to expect that those who don't know or don't want to play with that book will not be using homebrew based on those rules.
Therefore, I think it is possible to conclude that there are 'numbers' that everyone use.