Return to “Everything & Anything”

Post

Re: Taiya's IRC-based RPG

#50
Day 11
Well! :D As it was my weekly "day off" jobhunting, I figured I might as well put as much of it as I could to good use. And, I did! I got almost seven hours of coding in yesterday. It's still not anything near Josh-level, but perhaps that's a good thing, in the end. :D So, let me tell you what I focused on.

StoryText

I got a lot done here. Most of the actions have text of some sort. I'm still coming up with ideas for a few, but the job is going remarkably well, all things considered. I'm headed directly for the "minimalist" mark, where I have a very sparing set of answers for all the possible outcomes. I'll tally up my totals for yesterday at the bottom of the post, but in the meantime, I'd like to discuss why I'm doing it the way I am.

I am not technically writing "stories". I am more writing "pieces" of the story that the player can then extrapolate a story from. For example: Let's say that in turn one, Bob pulls some ugly trick that messes up Alice's job. In turn two, Alice attacks Bob and wrecks his home base. The players can then extrapolate that the latter happened because of the former - and it might even be true, in the code - but I don't have to necessarily write anything down specifically for that scenario for players to make the connection.

By breaking down the story like this, I can, in the end, write much less story text. If I wasn't breaking it down - if I was making ten classes, and a separate four choices per person, with a separate four choices per branch... and three branches per turn... if I wanted to get up to ten turns, I would have to write over three hundred pentillion words. That's 345,876,451,382,054,092,800. To put that in perspective (somewhat), that's writing all the "A Song of Ice and Fire" books almost two hundred trillion times. In fact, it's very easily many, many times more words than humanity has written in its entire history.

That's a nope. I'm not doing that. "Choose your own story" games are nice, but they always run out too quickly. I don't want that. Thus, I code and write only specific parts of the story and let you, as the player, extrapolate the rest.

Turn Progress
While most of my time yesterday was spent writing more storytext (and on some other things), I did spend some time yesterday on the actual background code, hooking everything up. I fixed the bug where Taiya wouldn't give a second set of options on your turn (it turns out she was saving to the wrong array), so we can progress a little farther. She unfortunately doesn't know what to do with the second option you pick yet, but I should have that fixed and ready soon. One step at a time. :) I'm also fixing various typos and minor bugs as I go along.

Text arrays
Some of my time inevitably goes into making arrays of little text strings - things like planet names, star systems, asteroid field names, etc. Instead of utilizing Taiya's name generator, I'm instead going a different path: just writing it all out myself. I don't need to make an infinite universe here. I just need to make something that looks good. Yesterday I coded in a great number of planets for various star systems, and star system names as well. I already had some of each, but I wanted a few more, because as it stood, I only had a few sets. Now it should be better. Systems can also have different numbers of planets, all directly influenced by the size of arrays.

One thing I think I really need to do, though, is put all of these arrays into one text file. Hardcoding them is all well and good, but it's also rather messy, and keeps me from updating the lists on the fly. I'd prefer not to hardcode it if I can help it. The bulk of the story text needs to be hardcoded by necessity - there are far too many different variables to keep track of to easily offload it to a file without writing up a massive text parser, and while I have written text parsers in the past, it's not something I look forwards to doing at all. (Writing text parsers was actually what put me off regex. I can't stand to use it anymore.)

I think that's all for today. :) I should have a few more things done tomorrow, and in the meantime, I made a massive leap toward completion.

storytext: 278 lines (+88)
file length: 1333 lines (+172)
percentage of file that is storytext: 21% (+5%)
percentage of minimum complete: 79% (+25%)
percentage of optimum complete: 7% (+2%)
Have a question? Send me a PM! || I have a Patreon page up for REKT now! || People talking in IRC over the past two hours: Image
Image
Image
Post

Re: Taiya's IRC-based RPG

#51
Talvieno wrote: The bulk of the story text needs to be hardcoded by necessity - there are far too many different variables to keep track of to easily offload it to a file without writing up a massive text parser, and while I have written text parsers in the past, it's not something I look forwards to doing at all. (Writing text parsers was actually what put me off regex. I can't stand to use it anymore.)
May I have a moment to talk about our lord and saviour XML/JSON?
:ghost:
Warning: do not ask about physics unless you really want to know about physics.
The LT IRC / Alternate link || The REKT Wiki || PUDDING
Image
Post

Re: Taiya's IRC-based RPG

#59
JSON is the best,

XML should under no circumstances be used, its bloated and nigh unreadable.
YAML is messy, and actually has worse disk usage than JSON. (have actually done tests with this guys) :V

JSON is clean, and 100% readable if you understand a JS Object. Because this is JS Object Notation...

Code: Select all

{"Bob":{"name":"Bob","age":22,"contentsOfPocket":["string","slice of ham","thumbtack"],"relationships":["Jim":{"type":"brother","level":15}]},"Jim":{"name":"Jim","age":27,"contentsOfPocket":["hands","the One Ring"],"relationships":["Bob":{"type":"brother","level":12}]}}

Code: Select all

{
    "Bob":{
        "name": "Bob",
        "age": 22,
        "contentsOfPocket":[ "string", "slice of ham", "thumbtack" ],
        "relationships":[ 
            "Jim":{ "type":"brother", "level":15 }
        ]
    },
    "Jim":{
        "name": "Jim",
        "age": 27,
        "contentsOfPocket":[ "hands", "the One Ring" ],
        "relationships":[ 
            "Bob":{ "type":"brother", "level":12 }
        ]
    }
}
Using more whitespace (such as tabbing) makes it much more human readable.
removing all extra whitespace makes it much smaller and easier to store/deliver.

JSON is the format of choice for when you don't need complex linkages between things.
If you need complex linkages, you need to use another tool, JSON is useful for game saves, or data files.
Not so useful to define the metaphysical relationship between goats and every individual human.
°˖◝(ಠ‸ಠ)◜˖°
Image

Online Now

Users browsing this forum: No registered users and 1 guest

cron