Organizing init

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
User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Organizing init

#1 Post by namastaii » Sun Apr 17, 2016 7:18 pm

What is the best way to organize in your opinion?

I have a lot of code, some of it complex and so there is quite a bit of init blocks I have.

Which is better? Putting all init parts with their screens on separate files or putting all init together at once on one page then the screens on their own thing?

Does this make sense?

What are some ways you guys do it? Does it affect the speed of the game or how things are processed?

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Organizing init

#2 Post by trooper6 » Sun Apr 17, 2016 7:39 pm

What exactly are you init'ing?

I hope it isn't variables, because current best practices is to initialize variables using default.

Looking at my stuff, what do I have in inits? Classes, Functions, Transforms, Styles, maybe some config stuff.

So how do I organize? Depends on the project and how much stuff I have.

For my current main project, I put the clock class and all associated styles and functions and defaults all in one file so I could more easily port it over to the cookbook thread. I have separate rpy files for two involved screens and anything that needs to be initialized for just those screens goes in that file. I also have an rpy files just for my calls, and relevant defaults go on that file. But that is a project with a lot of moving parts.

For other projects that are much simpler...i.e. mostly just like a standard VN with little game play--or one of my testers--I tend to put it all in the start file. Just organized in a nice and coherent way.

My main concern is that it is organized cleanly and in a way that will make sense if someone else looks at it.

Remember, Renpy treats all files like one big file...so your organization is really about comprehensibility for you--or for some of my programming concerns, modularity.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Organizing init

#3 Post by namastaii » Sun Apr 17, 2016 7:56 pm

I'm not initing variables. I have a lot of functions and styles etc. I have a lot of screens that have a lot of init stuff to it. Inventory, etc
I just don't want the game to run less efficiently if I do it a certain way.

So the way I have it now, I'll use the inventory screen for example...even though it isn't really running yet.
I have the python code that needs to be init in a separate .rpy file with all the other init stuff since the other init stuff isn't that long anyway..so I figure all that main stuff just get thrown together (I think it's easier for me somehow or I feel better about it that way) and then the actual screen itself would either go into it's own inventory_screen.rpy or into a file that has all screens that are like it on it.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Organizing init

#4 Post by trooper6 » Sun Apr 17, 2016 8:04 pm

As far as I know it makes no difference to Renpy how you organize your files since it treats everything as one big file anyway. So organize it the way that works best for you.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Onishion
Veteran
Posts: 295
Joined: Mon Apr 20, 2015 10:36 am
Contact:

Re: Organizing init

#5 Post by Onishion » Sun Apr 17, 2016 10:14 pm

Yeah, do what makes it more readable to you, what means that you don't have to do more page flipping and scrolling than you'd like to when editing stuff, or where you know where to find it. If that means cramming them all together, fine. If it means putting each next to other similar elements, that's fine too.

Post Reply

Who is online

Users browsing this forum: Alex, Google [Bot], nyeowmi