- Jul 20, 2018
- 724
- 1,185
First off I know I am way out of my depth but I'm just dicking around and learning a lot about Ren'Py and Python in general. I tried to google an answer but I'm not sure how to word the question exactly so no luck there.
The problem I'm running into is that the classes I'm writing contain 'a lot' of data. So an instance of said class isn't very human readable anymore. Now I already got that splitting classes can help a lot (and started doing that naturally.) But is there a better way to keep oversight of what I'm doing?
My idea was to create a loader for the class instances that reads a text file where each line is one of the class variables but maybe there are better ways of doing things.
as an example:
As you can see above the instance is already becoming a little unwieldy and there are still two empty lists in there and the class may expand as well. Other classes might be bigger still. (especially if they contain text like a description or the like)
So would it be smart to writ a text file like below with a loader or is there a better way of doing things that I don't know about due to inexperience?
The problem I'm running into is that the classes I'm writing contain 'a lot' of data. So an instance of said class isn't very human readable anymore. Now I already got that splitting classes can help a lot (and started doing that naturally.) But is there a better way to keep oversight of what I'm doing?
My idea was to create a loader for the class instances that reads a text file where each line is one of the class variables but maybe there are better ways of doing things.
as an example:
Python:
#The class government currently contains the following variables
class government:
def __init__(self, name, glevel, corruption, influence, prestige, base, mod, policies, upgrades):
#The (uncompleted) instance for the government looks like this:
default town = government('Virgin Bay','town',0,0,-1000.0,{'population':9999, 'previousAS':0, 'previousAW':0, 'previousDS':0, 'edugrant':0, 'churchgrant':5000, 'otherexpenses':25.01},{'population':1.0004, 'poptax':0.04, 'bsnstax':0.025, 'edutax':0.05, 'churchtax':0.00, 'churches':['protestant','catholic','nondiscript']},[],[])
So would it be smart to writ a text file like below with a loader or is there a better way of doing things that I don't know about due to inexperience?
Code:
town
government
'Virgin Bay'
'town'
0
0
-1000.0
{'population':9999, 'previousAS':0, 'previousAW':0, 'previousDS':0, 'edugrant':0, 'churchgrant':5000, 'otherexpenses':25.01}
{'population':1.0004, 'poptax':0.04, 'bsnstax':0.025, 'edutax':0.05, 'churchtax':0.00, 'churches':['protestant','catholic','nondiscript']}
[]
[]
Last edited: