Retrieving all dialogue from JSON/Flat file

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
leeto
Newbie
Posts: 4
Joined: Fri Feb 24, 2017 9:35 pm
Location: The Cloud
Contact:

Retrieving all dialogue from JSON/Flat file

#1 Post by leeto »

Hey folks,

I have been working on developing processes to work on a project that would include heavy localization requirements without requiring localizers to touch game code. My goal with this workflow is that all dialogue changes can live independently from my game code and python/screen language code. I was wondering if anyone has had experience with attempting to (or if this is a documented feature of Ren'py that I am missing) interpolate ALL lines of dialogue to be read from a json file or other format.

For a pseudocode example, in my scene1.rpy I would have code somewhere that would look like this

Code: Select all

python:
     dialogue = json.dumps(scene1_english.json)
     renpy.say(dialogue[0].who, dialogue[0].what)
And I would have a scene1dialogue.json file that looks like

Code: Select all

[
     {'who': 'j', what: 'index 0 text'},
     {'who': 'k', what: 'index 1 text'},
]
Then in a multi-language environment I would have a dialogue file for each language and a language option check determining which dictionary of dialogue I should be pulling from for my say statements.

philat
Eileen-Class Veteran
Posts: 1912
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Retrieving all dialogue from JSON/Flat file

#2 Post by philat »

I've seen others do something like this, so it should be possible, but it's not really a documented feature and it's pretty rare. I mean, at that point, why use Ren'py? The main strength of Ren'py is the readability of the script, and moving it all into a json or xml file kind of defeats that. That said, the first few posts here discuss the issue. https://www.google.co.kr/search?q=site% ... e&ie=UTF-8

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2404
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Retrieving all dialogue from JSON/Flat file

#3 Post by Ocelot »

What is wrong with RenPy own localisation framework?
https://www.renpy.org/doc/html/translation.html
< < insert Rick Cook quote here > >

leeto
Newbie
Posts: 4
Joined: Fri Feb 24, 2017 9:35 pm
Location: The Cloud
Contact:

Re: Retrieving all dialogue from JSON/Flat file

#4 Post by leeto »

Ocelot wrote:What is wrong with RenPy own localisation framework?
https://www.renpy.org/doc/html/translation.html
Oh I think this aligns more with what I was looking for. I don't know how I missed this in the online documentation, I think I read "translation" and my brain kept associating it with the word in the math/animation sense. Just generated some tl files and this looks like something I can definitely use.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Majestic-12 [Bot], piinkpuddiin, snotwurm