Learn Ren'py by using finished code. Bad Idea?

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
couto886
Newbie
Posts: 9
Joined: Sat Nov 10, 2018 9:29 pm
Contact:

Learn Ren'py by using finished code. Bad Idea?

#1 Post by couto886 »

I've started to learn how to use Ren'py in more complex games recently and there is this game I've been using as a model for the things I want to learn, so I grabbed his code and tried to understand how was made. The problem is I find myself constantly confused with the code, what is making me question if analyze a finished code was really a good idea. If isn't, can somebody indicate a better way to learn?

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: Learn Ren'py by using finished code. Bad Idea?

#2 Post by trooper6 »

I used a combination of:
-studying the documentation and making test projects using the different things in the documentation (for example I worked through everything in the documentation dealing with bars).
-taking the basic Python course at codeacademy.com so I have a grasp of the basics.
-Looking at the code in the Tutorial
-Looking at the code of finished games that are simple...and more complex
-Looking at code in the Cookbook
-Looking at questions asked in the Q&A section here and if there is an interesting question with an answer I don’t know, I do to the documentation and see if Incan teach myself how to do it with a test project, then I answer their question when I figure it out.

Then after all of that, I may also ask questions here in Q&A if I’m really stumped on something.
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

couto886
Newbie
Posts: 9
Joined: Sat Nov 10, 2018 9:29 pm
Contact:

Re: Learn Ren'py by using finished code. Bad Idea?

#3 Post by couto886 »

Thanks dude. I guess I'm starting my own game to see how far I go before i get stuck. The main reason I've been so obsessed with analyzing a finished game is the fear of letting something pass in the beginning and have to code half the game again... But I guess there is no other way :)

User avatar
Chekhov
Regular
Posts: 113
Joined: Tue Jun 26, 2018 9:19 am
Projects: Pluton
Contact:

Re: Learn Ren'py by using finished code. Bad Idea?

#4 Post by Chekhov »

The one practice that helped develop my coding more than anything is top try and not think of any game as "one big project", but instead like a million lego's that fit together correctly.

This also helps if the whole thing falls down (bugs and such), because you can break apart each piece and analyse it seperately.

For example, if I want to make a game of yahtzee (where you throw 5 dice, then can reroll any amount for two times and then have to choose where to score that amount... a very simple game).

So to make that game of yahtzee I probably want a roll_x_dice() function that I can pass any number of up to 5 to and get back a list of numbers as long as the number I gave it. Now when the game isn't working as intended I can completely rewrite roll_x_dice(), I can independantly test roll_x_dice(), I can remove roll_x_dice and replace it with some premade results and see if they get recorded accurately.

By approaching it that way, the whole coding process became much more organised and much less stressful. At some point you'll see that maybe you don't want to write the function for up to 5 dice, because in the future you might want to make a game where you roll 10 dice. So you might create it in a way so that you won't have to rewrite the function for the next game. Of course this is peanuts level, but some things you write can definitely be re-used and save time down the road.

DannX
Regular
Posts: 99
Joined: Mon Mar 12, 2018 11:15 am
Contact:

Re: Learn Ren'py by using finished code. Bad Idea?

#5 Post by DannX »

I usually try to divide my game into small parts, and list them in the order I want them to logically happen, and how would I represent that in the game. For example in a simple zero sum game like rock papers scissors, it would be something like:

1. Let the player choose their hand. (screen with some kind of input that returns their choice)
2. Make the game randomly choose a hand. (function)
3. Present the game's hand and the player's hand. (screen)
4. Compare them and determine the winner, or if it was a tie (function)
5. Show the result to the player (screen)

Then for each step, I try researching how can that be made in python and how would I integrate it into renpy, by searching in the documentation, or here in the forums. If you're really stuck you can also always ask for help.

Post Reply

Who is online

Users browsing this forum: No registered users