But what do we want?
in the last post, I described a hypothetical string that might describe a character in the game Dungeon Robber. There are a few ways that the string could be refined.
Firstly, there were big chunks dedicated to the carrying of coins that might not even be applicable to the fharacter. These could probably be minimised with an identifier that recognises alphabetical and numeric components separately. I think Dungeon Robber has five coin types: (c)opper, (s)ilver, (e)lectrum, (g) old, and (p)latinum. That bit of the string could see the parsing algorithm look for the various letters representing the relevant coin type, starting with the next string digit it identifies a numeric value to show how much of that coin there is, and as soon as it hits the next coin type, it stops...before progressing through the same procedure with the next coinage. A starting character has no coins at all, and their string might simply read "csegp", a character after a few games might read "c1500s2000eg50p600". Some specific digit might be used to close off the sequence. Suddenly instead of a 20 digit string that may or may not be used, we have a variable digit string, with a minimum of 5 digits to reflect the five coins, and no limit on how long the string may be therefore eliminating the potential wealth limit for the characters.
Something similar could be done for character names, but instead of using alphabetical bookends for the string, it might be better to use a tilde (~) at either end of the name, with everything between the symbols recognised as the "name" part of the string. I would avoid using periods (.) or commas (,) because these might serve programming functions to break up strings in certain programming languages (or concatenate them in the case of php). Another way to do this without needing separate bookends for start and end of a sequence might be to designate a string length with a character. Maybe the coding starts at a certain point in the string, then recognises the character present at this point as a length determinant. 1-9 are obvious, then a=10, b=11, c=12....y=34, z=35...that should be plenty, but if you wanted to go further with string length you might then cycle through capital letters...A=36, B=37, C=38...Y=60, Z=61.
The simple name "Tim" would be rendered in the string as "3Tim" before moving on to the next element in the string... "Alessandra" would be "aAlessandra". To break up the given and family names, it would be possible to add a second sequence length identifier...thus, my own name would be rendered in the string as "7Michael6Wenman". But doing this would require a distinct limitation in the programming for generating a given name, then a family name (or vice versa), it wouldn't allow for the flexibility of spaces in a name such as "Sir Eric the Brave, Slayer of Dragons". Theoretically we could add another sequence length identifier to identify the number of sequences that make up the total sequence, but this is getting a bit meta, and a bit complicated in programming (to the point that I can easily see the scope for bugs appearing). For the sake of argument though, "Tim" and "Alessandra" as a single name, would be rendered "13Tim" and "1aAllesandra". My full name would be "37Michael4John6Wenman", and our complcated case would be "73Sir4Eric3the6Brave~6Slayer2of7Dragons" (you'll note that I've added a tilde instead of a comma after the word "Brave", this is again done purely because the comma might prove problematic and is easy enough to substitute in coding/decoding). Conveniently, as a check digit, the number of characters in the name string is equal to the sum of the numerals breaking it up plus one. The flexibility of this option might prove useful...it's just a case of determining if the usefulness outweighs the potential for bugs.
If the computer program generates a character sheet for the player to look at, we might consider a maximum cap on the name length, to make sure it fits in the designated area of the sheet, but otherwise this flexibility is fine.
That's probably enough about string manipulation for the moment, let's look at what will actually make up the string in this game.
Character name, character race, character culture, attributes, skill and abilities, equipment, career path progression, honour vs notoriety, money... and a bunch of stuff derived from these values.
Butbefore that makes sense, I'll need to explain the structure of the game.
Firstly, there were big chunks dedicated to the carrying of coins that might not even be applicable to the fharacter. These could probably be minimised with an identifier that recognises alphabetical and numeric components separately. I think Dungeon Robber has five coin types: (c)opper, (s)ilver, (e)lectrum, (g) old, and (p)latinum. That bit of the string could see the parsing algorithm look for the various letters representing the relevant coin type, starting with the next string digit it identifies a numeric value to show how much of that coin there is, and as soon as it hits the next coin type, it stops...before progressing through the same procedure with the next coinage. A starting character has no coins at all, and their string might simply read "csegp", a character after a few games might read "c1500s2000eg50p600". Some specific digit might be used to close off the sequence. Suddenly instead of a 20 digit string that may or may not be used, we have a variable digit string, with a minimum of 5 digits to reflect the five coins, and no limit on how long the string may be therefore eliminating the potential wealth limit for the characters.
Something similar could be done for character names, but instead of using alphabetical bookends for the string, it might be better to use a tilde (~) at either end of the name, with everything between the symbols recognised as the "name" part of the string. I would avoid using periods (.) or commas (,) because these might serve programming functions to break up strings in certain programming languages (or concatenate them in the case of php). Another way to do this without needing separate bookends for start and end of a sequence might be to designate a string length with a character. Maybe the coding starts at a certain point in the string, then recognises the character present at this point as a length determinant. 1-9 are obvious, then a=10, b=11, c=12....y=34, z=35...that should be plenty, but if you wanted to go further with string length you might then cycle through capital letters...A=36, B=37, C=38...Y=60, Z=61.
The simple name "Tim" would be rendered in the string as "3Tim" before moving on to the next element in the string... "Alessandra" would be "aAlessandra". To break up the given and family names, it would be possible to add a second sequence length identifier...thus, my own name would be rendered in the string as "7Michael6Wenman". But doing this would require a distinct limitation in the programming for generating a given name, then a family name (or vice versa), it wouldn't allow for the flexibility of spaces in a name such as "Sir Eric the Brave, Slayer of Dragons". Theoretically we could add another sequence length identifier to identify the number of sequences that make up the total sequence, but this is getting a bit meta, and a bit complicated in programming (to the point that I can easily see the scope for bugs appearing). For the sake of argument though, "Tim" and "Alessandra" as a single name, would be rendered "13Tim" and "1aAllesandra". My full name would be "37Michael4John6Wenman", and our complcated case would be "73Sir4Eric3the6Brave~6Slayer2of7Dragons" (you'll note that I've added a tilde instead of a comma after the word "Brave", this is again done purely because the comma might prove problematic and is easy enough to substitute in coding/decoding). Conveniently, as a check digit, the number of characters in the name string is equal to the sum of the numerals breaking it up plus one. The flexibility of this option might prove useful...it's just a case of determining if the usefulness outweighs the potential for bugs.
If the computer program generates a character sheet for the player to look at, we might consider a maximum cap on the name length, to make sure it fits in the designated area of the sheet, but otherwise this flexibility is fine.
That's probably enough about string manipulation for the moment, let's look at what will actually make up the string in this game.
Character name, character race, character culture, attributes, skill and abilities, equipment, career path progression, honour vs notoriety, money... and a bunch of stuff derived from these values.
Butbefore that makes sense, I'll need to explain the structure of the game.
Comments