So I'm a software engineer who's take the next step in creating a visual novel. I've been sifting through the documentation and I have yet to see any class declarations or creating functions. Is it possible to use object orient programming in ren'py in regards to characters and their stats? I mean the space alone will be a benefit instead of having 10 variables that tell the same type of stat for 10 different characters.
For example every character has HP but I want to know what Bob's Hp is currently at. In java you would code a class called character with all the basic information (HP, MP, AP, etc) and create instances of that class and call it by the characters name. that way you can do something like Bob.get_HP() instead of clustering the programming file with 100's of declarations. So could anyone tell me or point me to any documentation about implementing object oriented programming in ren'py?
Also does anyone have any tips on file size management? I'm barely done creating a demo and I'm already past 1000 lines in my code. Essentially everything done in a single file which makes it a bit hard to manage when you create a full scale game.
Renpy Objective programming 101 help
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.
- Divona
- Miko-Class Veteran
- Posts: 678
- Joined: Sun Jun 05, 2016 8:29 pm
- Completed: The Falconers: Moonlight
- Organization: Bionic Penguin
- itch: bionicpenguin
- Contact:
Re: Renpy Objective programming 101 help
You have to understand that Ren'Py is script language using Python as a programming language. So nothing is stopping you from creating class or function in Python. There isn't in depth on how to code in Python in Ren'Py documentation. Just a simple thing on how to corporate Python code along side Ren'Py script like Python Statements and Screens and Python (see Python and Ren'Py). For other tutorials on how to create class or function in Python, you can find in other document regards Python language itself.shiza wrote:So I'm a software engineer who's take the next step in creating a visual novel. I've been sifting through the documentation and I have yet to see any class declarations or creating functions. Is it possible to use object orient programming in ren'py in regards to characters and their stats? I mean the space alone will be a benefit instead of having 10 variables that tell the same type of stat for 10 different characters.
For example every character has HP but I want to know what Bob's Hp is currently at. In java you would code a class called character with all the basic information (HP, MP, AP, etc) and create instances of that class and call it by the characters name. that way you can do something like Bob.get_HP() instead of clustering the programming file with 100's of declarations. So could anyone tell me or point me to any documentation about implementing object oriented programming in ren'py?
- Python Object Oriented
- Python Functions
You can split the script into files. It doesn't have to be all in "script.rpy". Most common one would be split script based on "label" or "chapter". When Ren'Py is launch, it would read every files into one, so it doesn't matter. You can read more about it from the old Ren'Py FAQ - How do I split my game into multiple files?.shiza wrote: Also does anyone have any tips on file size management? I'm barely done creating a demo and I'm already past 1000 lines in my code. Essentially everything done in a single file which makes it a bit hard to manage when you create a full scale game.
Last edited by Divona on Sat Jun 17, 2017 5:37 am, edited 2 times in total.
- Ocelot
- Lemma-Class Veteran
- Posts: 2402
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Renpy Objective programming 101 help
RenPy is built on top of Python -> You can use Python in your game V
Python supports Object Oriented Programming -> You can use OOP in your game if you want
https://www.renpy.org/doc/html/python.html
Also there are a lot of clases in RenPy. Like, everything starting with capital letter: all screen actions, all transition classes (predefined transitions are instances of those classes)...
Python supports Object Oriented Programming -> You can use OOP in your game if you want
https://www.renpy.org/doc/html/python.html
Just a question, why are you so sure that you need OOP for that? What is wrong with simple data structures and functions manipulating them?space alone will be a benefit instead of having 10 variables that tell the same type of stat for 10 different characters
Also there are a lot of clases in RenPy. Like, everything starting with capital letter: all screen actions, all transition classes (predefined transitions are instances of those classes)...
Separate it into different files: https://www.renpy.org/doc/html/language ... html#filesEssentially everything done in a single file which makes it a bit hard to manage when you create a full scale game.
< < insert Rick Cook quote here > >
- papiersam
- Veteran
- Posts: 231
- Joined: Fri Aug 12, 2016 2:24 pm
- Completed: Gem Hunt Beta, 1/Probably, Animunch
- Projects: The Panda Who Dreamed
- Contact:
Re: Renpy Objective programming 101 help
Also does anyone have any tips on file size management? I'm barely done creating a demo and I'm already past 1000 lines in my code.
Also, software architecture. Prolly #4 priority in Software Engineering.Separate it into different files: https://www.renpy.org/doc/html/language ... html#files
Who is online
Users browsing this forum: DewyNebula