How do I store a bunch of texts in Godot?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Irul
:warning: Old Version Published before Godot 3 was released.

I am developing a quiz-based game. You can say it’s like the popular “Who Wants to be A Millionaire”. So there will be bunch of questions and answers which are basically plain texts (around 700 questions)

What is the best way in GDscript to store that questions. Shoud I store it in a plain .txt file then load it to my game and parse it? if like so? how do I do it in GDscript? I came from Java background so that’s how I usually deal with text-based “resources”. Or there is a special node for handling it?. I mean if Godot already has feature for it, why should I work hard to
reinventing the wheel.

Thanks in advance

:bust_in_silhouette: Reply From: jospic

I think json is the best choice.
A dictionary with it allows you to manage questions and their multiple answers in simplest way.


Thanks for pointing me out. Have you got any good tutorial on json in Godot?

Irul | 2016-10-06 15:07

Json support boils down to functions in Dictionary: Dictionary — Godot Engine (latest) documentation in English, combined with File you can load and save it from disk:

I wrote a simple example here:

Zylann | 2016-10-07 00:14

That’s very kind of you. Thanks, I have managed it to work.

Irul | 2016-10-07 01:50