In my previous post, I had discussed how I managed to get Ren’Py to work more nicely with Xcode as an Xcode project, meaning that Ren’Py developers that also develop apps for macOS, iOS, etc. can still do their work without having to leave Xcode. After writing that initial post, I found more ways to make the Xcode/Ren’Py experience (at this point, I’m calling Rencode) a little bit better and have even managed to get others interested in the idea.
Xcode File Templates
You know how when you click “New File” in Xcode how it shows a whole bunch of file templates to choose from? It turns out that all those templates are a set of files themselves, conveniently with the file extension
.xctemplate. Xcode by default comes with several of these for all different platforms, but users and developers can create their own by adding some folders and files in the right places. When I initially did research on how to make my own, I discovered that it’s not really something that people talk about, and the process to add them yourself… well, it’s a process.
Nonetheless, after reading an article on Medium and one from another place and learning more about the template markup, I’ve managed to create two file templates for Ren’Py files. The first type of template is for a regular Ren’Py script with a label in it. When you type the label name in the configuration box, it will name the file and what-not accordingly. It also handles the file header with the standard Xcode copyright messages for you.
The second file is dedicated to making a basic screen, and it has a little more configration involved. Since I’ve figured out how to add configuration options beforehand, I tried to make it easy to set it up easily; it handles the screen’s name,
zorder, and whether it’s a modal or not. Along with the copyright headers, it creates a screen similar to below and in Ren’Py’s documentation:
screen UIViewController: tag "UIViewController" zorder 1 modal False text "Hello, world!"
Luckily, to make things easier on developers, I’ve released these basic templates online on GitHub, where you can copy the templates yourself or run the installer script, which works on both bash and zsh.
Download here: https://github.com/alicerunsonfedora/xcode-renpy-templates
Xcode extensions… no go for this :Ehehe:
During this time, I also tried looking into making extensions for Xcode that installed these templates for you. Sadly, this isn’t the case with Xcode at the moment, but I have send some feedback to Apple to see if they could make that a thing.
You can read up on the conversation on the Developer Forums: https://forums.developer.apple.com/message/364652
Xcode and the DDLC Mod Template
Notably, I had initially started trying to make Rencode happen because I wanted to continue coding Project Stein, a Doki Doki Literature Club! mod, right in Xcode. I’ve been more active in the Doki Doki modding community lately, and I’ve certainly been sharing these insights on using Xcode with them. Recently, I had collaborated with one of the staff members of the server to add Xcode project support to the default template used to get started on making DDLC mods. As of very recently, these changes are ready from the get-go on GitHub; it even supports opening the template directly in Xcode. Imagine that!
Hopefully in the coming days, I will continue my work with the DDLC modding community to incorporate a new tutorial that also highlights the feature set and process of using Xcode for DDLC mods.
For those wanting to mod, check the template here: https://github.com/GanstaKingofSA/DDLCModTemplate2.0