Working on a text-based game in HaxeFlixel, and I’m wondering if there’s a best practice for dealing with the text itself. There’s a lot of it, and it’s full of newlines and quotes and such. I imagine putting it in the actual Haxe script is probably not the best way, since you’d have to use a zillion escape characters? So like maybe a Markdown file where you could tag each text block something appropriate, and then parse it from Haxe?

EDIT: I ended up just keeping all the dialogue in a simple .txt file. I wanted to make adding dialogue as accessible as possible for people with limited computer skills, basically. And it actually turns out that Haxe’s string parsing will handle alllll the escaping for you, so they can pretty much use any characters they want! Except colon (:). They just have to give the dialogue a title inside colons like :this:, and I have it set up to parse the .txt into a dictionary where the titles are the keys and the dialogue is the corresponding value.

  • Remy RoseOPM
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    1 year ago

    That’s two votes for using a DB! I guess that’s what I’ll do, gotta start looking into how it works. Thanks johnhatten and realz!

    • Remy RoseOPM
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      I’m too much of an amateur to know what that is, and google isn’t helping on this one. What are those?

      • TheCee@programming.dev
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 year ago

        Basically a file format in which you can place strings in multiple languages, have a key to insert into your software and have other gizmos like support for plurals etc. I’ll admit, it has been some time since I have used those and hopefully you will find better solutions than gettext.