Welcome back to part 2!
In part 1, we installed our engine. Now we are ready to setup our 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.
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.
Now that we have our preferred language selected and settings configured, click + Create New Project on the lower left.
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.
For this tutorial, my project name is "Breakfast Tale". Once set, click Continue to set preferred resolution.
I chose the default 1280x720 then click Continue.
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.
Sweet! Now we have an initial 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!
It loaded with a very generic screen. Let's click Start and see what we've got.
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.
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.
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.
Let's find the start of the game. If we look at script.rpy we will see the following:
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.
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.
You will now see a list of pending changes to commit.
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!
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.