loading...
Cover image for Setup Ren'Py Project

Setup Ren'Py Project

cpluta profile image Chris Pluta ・6 min read

Welcome back to part 2!

In part 1, we installed our engine. Now we are ready to setup our project.

Creating a new project

To begin, let's open Ren'Py.

First, we want to configure our language. To do this, click preferences in the bottom right of the launcher.

Launcher - preferences highlighted

We can now change our default project, editor or any other engine settings. After making your changes, click Return on the lower left. This will update your settings immediately. You may get prompted with a message checking if you are using the most up to date version of Ren'Py. Click Cancel to continue back to the launcher.

Launcher - Preferences window

Now that we have our preferred language selected and settings configured, click + Create New Project on the lower left.

Launcher - Create New Project highlighted

We are presented with an informational message verifying the default language of the game. The game will generate a new project in English since that is my preferred language. Click Continue to set your project name.

Confirm Language

For this tutorial, my project name is "Breakfast Tale". Once set, click Continue to set preferred resolution.

Name Project

I chose the default 1280x720 then click Continue.

Ideal Window Resolution

Next we have the default colors for dialog frames and text. These can be changed at a later time, so pick whatever feels most appealing. I miss my days of college and working on a Linux machine with a dark background and neon green text working in the lab. So I will pick that as my default, then click Continue.

Color Picker

Sweet! Now we have an initial project!

Launcher - New Project

Launch New Project

We now have a new entry on our launcher! Ren'Py searches your project location configured in your preferences. My configuration is D:\RenPy.

Now that we see our project we will select it. This highlights it. Next, we can click Launch Project and see what we have to work with!

New Project - Default Main Menu

It loaded with a very generic screen. Let's click Start and see what we've got.

Start New Game - First Screen

Awesome! It's like we have a game!

Let's exit out of the game and check out some code to see how this works.

Code Exploration

First, open Visual Studio Code. To open the project, click File then Open Folder. I navigate to D:\RenPy\Breakfast Tale since that is where my game is located.

VS Code - Open Folder

Now, that the project is open we see a collapsed folder. Once we expand it we will see two types of files. These files have extensions of .rpy and .rpyc. The .rpy files are the source files where you make your game changes. The .rpyc files are compiled when we launch the game, these can be ignored since they will be regenerated.

VS Code - Project Files

Let's find the start of the game. If we look at script.rpy we will see the following:

VS Code - script.rpy

This is the beginning of the game. Let's try an experiment! Make a new file called icanhasstart.rpy.

To create a new file right click the game folder and click New File. This will make a new file with the cursor ready for typing. Type icanhasstart.rpy then hit enter to make the new file.

Next, cut the contents from script.rpy so the file is empty and paste it into icanhasstart.rpy. Save both files and launch the game.

It still worked! How'd that happen?

Turns out when Ren'Py compiles the game it essentially merges all the script files into one massive script, so anything can be referenced anywhere. This is a handy tip for later when we organize our dialog and scenes. I don't know about you, but doing everything in one file will drive me nuts.

Let's undo our changes. Copy the contents from icanhasstart.rpy back to script.rpy. Next lets delete icanhasstart.rpy and icanhasstart.rpyc and put it in the past like the era of I Can Has Cheezeburger.

Let's look at what else this file is doing. We can see that it establishes a scene, shows the character, has some dialog, and then comes to an end. We will dive deeper into what we can do with this in later parts.

There are a few other files and folders we will discover later, such as options.rpy for the main menu, gui.rpy for the the game layout, and screens.rpy for styling.

Source Control

We have an initial working project and want to experiment and possibly break things. So let's set up some source control to manage our code. The source control provider I will be using is GitHub.

First, let's setup a .gitignore. I copied it from here, it's light-weight and a good start.

Let's make a new file on the root called .gitignore. Now that we have our new file let's paste the following:

*.txt
tmp/
cache/*.rpyb
game/*.bak
game/*.rpyb
game/*.rpyc
game/saves/
game/assets/
game/*.ico
game/*.jpg
game/*.jpeg
game/*.png
game/*.mp3
game/*.ogg
game/cache/*.rpyb

Before we continue, the Visual Studio Code has Git already integrated. To use it it will require a GitHub account, which you may already have if you signed into Lets Build!

Now, we need to initialize our repository. In Visual Studio Code, in the left panel click "Source Control" then click Initialize Repository. This will make the .git folder with all your changes ready!

I'm not too familiar with git so I use GitHub Desktop to setup my credentials for my repository. Once installed log in with your GitHub account.

Once setup we need to map the GitHub Desktop to our project to publish our first changes. To do this click File then click Add Local Repository. We will then browse to find our project. Once you select the folder click Add Repository.

GitHub - Add Local Repository

You will now see a list of pending changes to commit.

GitHub - Initial Changes

Add a summary comment such as "Ready to get started!" then click Commit to master.

Now your changes disappeared! But they aren't on GitHub yet. We still don't have a repository. Once we click Publish repository we are prompted to set it up. I'm going to name my repository Breakfast Tale and make sure "Keep this code private" is unchecked so we can all keep track of the progress!

GitHub - Publish repository

Now we can go to GitHub and see our changes have now been published!

Now that everything is configured we can use Visual Studio Code to Push, Pull and Sync operations to maintain our project. A Push is done after you commit your changes to be staged for the server. A pull is when you retrieve the code from GitHub. A Sync is a Push and a Pull in the same operation.

To use these in Visual Studio Code we can now use the Source Control tab. This will show us any changes since our last push to see what changes we've made. This allows us to make changes with confidence, and undo anything that isn't working to the previous checked in state.


Now that we have our project setup we can start making some progress on our game!

Stay tuned for the next update and see where the project is going on GitHub at: https://github.com/cpluta/Breakfast-Tale.

Posted on by:

cpluta profile

Chris Pluta

@cpluta

Software developer by day, game maker by night. Co-Founder of Lets Build.

Discussion

markdown guide
 

Hi Chris and thank you for this super helpful post. It's surprising how little information exists about integrating GitHub and Ren'py and your article filled almost all the gaps I needed so: thanks!

One thing I still don't get because GitHub and the concept of source control are new to me. Let's say I want to make some changes in my Ren'py game, I'm modifying some Method.

I'll want to create a new branch for this until I'm sure the Method works, right? My question is now that I'm done modifying the Method, how do I run Renpy before I commit it so I can find bugs? Is this how it's works or do I have to commit first and if I find bug I roll back?

Thanks and advance!

 

I'm really glad and excited this helped you out!

The way I think about source control is that it's a snapshot of your work. Since this is the case I try to keep my source control clean with changes I am confident that are working. Just like this article, I got a basic working game and decided to check it in immediately. So while I'm working on the next phase of the game and I come across something that isn't working for me I can compare and see what changes I made and find any errors vs what used to work, or what I accidentally deleted.

With that being said you should be able to run your game before you checkin. If you made a new branch you just need to map it to your a different folder. And since Ren'Py checks your projects folder you should map that branch to that same location just as you have your master branch to be run and test.

In terms if you need to branch, it's a personal preference and depends on your size of the team. You can opt to add new features then bring them in slowly on a consistently stable build, or as you mentioned if something isn't working being able to just roll it back. Without knowing more of how you have things setup, I'd think you would have to check it in, merge it back to master then test it out.

Hope this helps!

 

Hi Chris. This was very helpful. I'm now using GitHub on Ren'py thanks to your post!