[STRUCTURE] How to stock text properly?
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.
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.
[STRUCTURE] How to stock text properly?
Good evening,
A simple question about how one should structure the renpy code. I'm kind of a purist and I like when a code is clean and easily readable. The point is that with visual novels, a lot of text will eventually appears. So here's my question, how do you stock the text of your game? Do you simply put it in the renpy files as expected? Or do you use another way?
I had the idea of using json files to stock every dialogues, menus and choices in them. Does anyone have already done it? Has it more pro or cons? Is there any other solutions suitable?
Thanks in advance for your answers!
A simple question about how one should structure the renpy code. I'm kind of a purist and I like when a code is clean and easily readable. The point is that with visual novels, a lot of text will eventually appears. So here's my question, how do you stock the text of your game? Do you simply put it in the renpy files as expected? Or do you use another way?
I had the idea of using json files to stock every dialogues, menus and choices in them. Does anyone have already done it? Has it more pro or cons? Is there any other solutions suitable?
Thanks in advance for your answers!
Last edited by Therozin on Tue May 03, 2016 3:04 pm, edited 1 time in total.
Re: [STRUCTURE] How to do stock text properly?
Ren'Py files are very clean, I heavily rely on json to store data for items/locations/characters and etc. but I doubt that you'll be able to come up with something cleaner than Ren'Py script for VN mode itself.
Re: [STRUCTURE] How to do stock text properly?
I fail to see point in json with RenPy/Python. Python is scripting language which can be editer by simple text editor. If you add json layer over python, why you using python at all? Why not use more performant/widespread language?
Only more or less good reason i see is if you use some kind of automatic testing/authoring tools. Otherwise i would simple split core mechanics (game specific layer on top of RenPy) and data (dialogues, descriptions, definitions). Both parts done fully in RenPy/Python.
Only more or less good reason i see is if you use some kind of automatic testing/authoring tools. Otherwise i would simple split core mechanics (game specific layer on top of RenPy) and data (dialogues, descriptions, definitions). Both parts done fully in RenPy/Python.
I may be available for hire, check my thread: viewtopic.php?f=66&t=51350
Re: [STRUCTURE] How to stock text properly?
Indeed, maybe I'm seeking problems where I shouldn't be.
I must say that Renpy is very clean when it comes to coding, I doubt it could be clearer. The idea was, for example, having a code looking like this.
That would have made the code shorter, hence less dense prima facie. Maybe you could point me to some game codes that might be a good example to follow in the general practice? The point is that I really want to do something clean if I am to work with people one day. ^^
I must say that Renpy is very clean when it comes to coding, I doubt it could be clearer. The idea was, for example, having a code looking like this.
Code: Select all
Character "[DialogueManager("Id_of_dialogue")]"Re: [STRUCTURE] How to do stock text properly?
It's cleaner, no interim variables, no checking for errors every time the engine starts and etc. It'll make sense with large amounts of data.drKlauz wrote:I fail to see point in json with RenPy/Python..
You'll go crazy looking for lines you wish yo fixTherozin wrote:Code: Select all
Character "[DialogueManager("Id_of_dialogue")]"
Re: [STRUCTURE] How to stock text properly?
If you have lots of dialogues with very close structure then you can call label with arguments or write python function.
But i really miss point why at all you want to use any DialogueManager? To make localization easier? Or you got special authoring tools/semi-automated game editor? Don't create complex things when you can use simple ones.
I believe for most cases of RenPy games, you should simple write as supposed. If you have complex game structure and RenPy feel restricting, then perhaps you shouldn't fight engine block, but try other tools, as, let's speak honestly, RenPy is not perfect, especially in performance area.
But i really miss point why at all you want to use any DialogueManager? To make localization easier? Or you got special authoring tools/semi-automated game editor? Don't create complex things when you can use simple ones.
I believe for most cases of RenPy games, you should simple write as supposed. If you have complex game structure and RenPy feel restricting, then perhaps you shouldn't fight engine block, but try other tools, as, let's speak honestly, RenPy is not perfect, especially in performance area.
I may be available for hire, check my thread: viewtopic.php?f=66&t=51350
Re: [STRUCTURE] How to stock text properly?
I usually use something like:It's cleaner, no interim variables, no checking for errors every time the engine starts and etc. It'll make sense with large amounts of data.
Code: Select all
class Goblin(NPC):
Name='Goblin'
HP=50
Str=5
Int=1
...
StartCombat([Game.PC],[Goblin,Goblin,Goblin])
But perhaps it's more of personal choice.
I may be available for hire, check my thread: viewtopic.php?f=66&t=51350
Re: [STRUCTURE] How to stock text properly?
It is.drKlauz wrote:But perhaps it's more of personal choice.
And we use:drKlauz wrote:I usually use something like:Code: Select all
class Goblin(NPC): Name='Goblin' HP=50 Str=5 Int=1 ... StartCombat([Game.PC],[Goblin,Goblin,Goblin])
Code: Select all
{
"name": "Goblin",
"desc": "A small carnivore creature with razor sharp teeth.",
"front_row": 1,
"battle_sprite": "content/npc/mobs/w.png",
"portrait": "content/npc/mobs/w1.png",
"race": "Goblinoid",
"locations": [],
"min_lvl": 1,
"basetraits": [
"Trickster"
],
"stats": {
"attack": 7,
"defence":4,
"magic": 0,
"agility": 6,
"luck": -50,
"charisma": 0,
"constitution": 10,
"intelligence": 5
},
"skills": {},
"traits": ["Monster", "Neutral"],
"attack_skills": [
"ClawAttack"
],
"magic_skills": [
]
},Re: [STRUCTURE] How to stock text properly?
Well, python offer some nice options like inheritance, in-place calculations and some other mentioned things. More flexibility. I remember spidweb games (geneforge i believe) used some kind of ini files for descriptions, each item had ID number, inheritance was simple "ParentID=123". Crude in my opinion.
But yes, if it works, it's good enough.
But yes, if it works, it's good enough.
I may be available for hire, check my thread: viewtopic.php?f=66&t=51350
Re: [STRUCTURE] How to stock text properly?
Well... the parent class is about 2k lines of python code long. Mobs child is smaller, child for advanced character is another 2k on top of the parent. This is raw data, some of it are properties, some conditions. JSON has a nice lint and most online editors will format your file so it looks pretty. Loading it into a dict is very easy.
You don't really loose any functionality. It feels really clean to me but this would have worked as python dict just as well.
You don't really loose any functionality. It feels really clean to me but this would have worked as python dict just as well.
Who is online
Users browsing this forum: Google [Bot]
