Keycap Kevin: I'm learning to code for my keyboard video game
I use the Ren'Py software to programme my first game. I was told it was easy to learn. I realise that this is indeed the case.
I'm giving away the Lego-compatible Pixel keyboard. To make it easier and hopefully more fun for you, I want you to play a game. I'm programming a game - for the first time in my life. I've already found the software for it: Ren'Py. Now I just have to turn the story I already have in my head into code. If you missed the last part of the series, you can read it at the following link
Simple scripting language
I download Ren'Py from the official site. The programme runs on Windows, MacOS and Linux. No other software or drivers are required on these platforms. I can use the installed editor app for coding. I programme with a text-based scripting language. I can even game on iOS and Android.
I can start or edit my project via the launcher. You can also see the title of my game "The Keyboard Theft" in the picture. You already know that my game is about stealing a keyboard.
I can add images, videos and music to the text. I define my characters, images etc. centrally. This allows me to make changes quickly. Example: I define my main character Stevie with "define stevie = Character("Stevie", colour="C4A277")". If I now type "stevie" and the text behind it in inverted commas, Ren'Py knows that it is a character. The character is identified as the speaker - with the corresponding hex colour code. If I want to adjust something, I only have to do so in my definition.
It's even easier with images. For example, if I want to insert a background image, all I have to do is enter "scene" followed by the file name. For example, "scene bg_room_1". I always store the images in the same folder. If I need to change something in the image, I overwrite the file in this folder. This way, Ren'Py immediately shows the current image.
Effects made easy
I can add effects to images, videos and music. This allows me to use simple commands to animate images, move them around on the screen, rotate them or scale them. For example, if I want a new background to push the old one upwards, I can do this with the command "scene bg_introduction_carol with wipeup". I could even specify the duration of the effect. All these commands are explained in the Ren'Py documentation. I just need to look them up and insert them accordingly. In the video you can see the first few seconds of my game with a few effects. Nothing earth-shattering, but they help to create the desired mood.
Ren'Py supports many formats. JPEG and transparent PNG for images, WAV and MP3 for music and WEBM or MPEG 4 for video, to name but a few. But be careful: not all formats are the same. Certain WAV files can still not be played by Ren'Py. If this is the case, no music will be played. For my project I therefore use the format with which I never have problems in Ren'Py: MP3. The quality is easily sufficient for my game. Of course, music can also be faded in and out or paused.
The challenge is not the coding, but the images
Coding is actually very easy. When I've written a new scene, I always start the project to look at the changes. That way I can see straight away if something is wrong. For example, if a sound effect is not playing. As mentioned, this has to do with the fact that Ren'Py does not recognise the file format. In this case, the programme does not display an error message, which makes troubleshooting more difficult the first time. However, as soon as I know the reason, this no longer happens. It's easier with code. Here, Ren'Py displays an error message with the line of code, as you can see in the following image.
In this case, I didn't end Stevie's statement with an inverted comma. These error messages are handy and I find the bug quickly. This way I can make quick progress with coding and it turns out to be easy. As Youtuber Visual Novel Design told me, with Ren'Py it's more or less copy and paste.
However, I'm making less progress with the images, i.e. my graphics. I'll tell you about the challenges I encounter here next time. <p
From big data to big brother, Cyborgs to Sci-Fi. All aspects of technology and society fascinate me.