A small RPG & video game company

Name: Pinball Disc Room
Version: 1.0
Author: Dennis Payne
License: MIT
Operating System: Web, Linux and Windows

Disc Room

As part of the Disc Room Game Jam, JW released a tutorial on creating a simple Disc Room. To learn more about Godot, I recreated the game. The movement of the player was a little different but otherwise the game was about the same.

During the tutorial, JW explained that the safest area in the room were the corners. To prevent the player from hiding out in the corner, a disc rotated around the walls of the room. I pondered other ways to prevent the players from being in the corners. A tentacle creature which would push you back into the room was considered but I settled on a pinball theme with flippers.

Pinball Disc Room

In an ideal world, Pinball Disc Room would be rectangular. There would be all sorts of bumpers. The blades would be bouncing off of them. However I had little experience with Godot and limited time. I kept close to the simple disc room example.

The room would be square without an bumpers. A plunger launched the blades but a teleporter transported them into the center of the room. The flippers would be found in all the corners. I also wanted a passageway that was opened up by knocking down some popups. This would give you a short period of safety at the expense of not controlling when you come out.

Giving the impression of a pinball game was key to the concept. For the playing field, I looked online and found a simple design on iStock. I used Gimp to create the background with dark and light blue coming out of the center. Triangles arranged in a circle with circles surrounding it became the transporter. The walled off area was light red with some dark red circles.

Originally I tried to implement the plunger and disc launch with the physics engine. My inexperience with Godot made this problematic. I examined Professor Pinball to see how it functioned. In the end I simply hardcoded the launching sequence as the physics simulation would stop once it hit the teleporter anyway.

My reimplementation of the simple disc room heavily borrowed from the "Dodge the Creeps!" tutorial. This meant the player was an Area2D. Unfortunately this limited the options for having the flippers hit the player. Turning the player into a RigidBody2D caused problems with the blades. Rather than spend a lot of time on the issue, I simply hardcoded the effect of the flippers into the player object.

This left the passageway as the remaining gameplay elements. While I was only building one, I coded the implementation to support any number. If you ran into a wall, it would check for open paths within 20 pixels of the player. The open path was a Path2D object. The player would be placed on the nearest end and moved through the path until reaching the other end. At which point the path would close.

For opening the path, the popups would start in the down state without any collision area. After two seconds they switched to the up state and enabled collisions. First attempt used a line segment for the collision object but the player moved fast enough that it wouldn't consistently trigger. A larger rectangular collision shape worked better.

With all envisioned gameplay features implemented, it was time to improve the look. Some stars were added to the game field. I attempted to add a rocket ship around the passageway but didn't like how it came out. In the lower part of the game field, I added a bunch of lights with numbers. If you survived that long the lights would activate.

I should have corrected the player movement at this point. It was the number one comment on the game. The popups were hard to hit due to the speed of the player. Otherwise people enjoyed the theme.

Pinball Disc Room Screenshot

Gamerzilla

Before using Godot, I wanted to add support for Gamerzilla, an open source achievement system. Godot has native library capabilities for it gdscript. I wrote a simple C gdnative library following the example. With OS.get_user_data_dir(), I passed the directory to save the user data to Gamerzilla but Gamerzilla needed to read game data for achievement information.

During development, Godot had all the files on the disk in various directories but when you released a game it packaged them into a single file. To read a file, you needed to use the Godot functions which did not seem to be accessible with the C API. C++ gdnative library gave me access to the File object which could read data out of the packed file.

LibGamerzilla used the standard file functions for reading data. To support Godot, it needed to be modified to support callback functions to handle file access. When packed together, Godot's file functions allowed you to read past the end of the file so additional checks had to be added. Of course this was only a problem if the files were in the packed file.

I had everything working in the Godot editor but the Gamerzilla integration failed when exported. I suspected that not everything was included in the packed file. While there were tools to look into the packed file, the project could be exported as a zip file which contained the same content. From that I determined that the json achievement file and the png images were not included. To include the json file, it needed to have a .tres extension. Image files were automatically converted to make them easier to load into Godot. In this case, I wanted them left unchanged so I needed to give them the .res extension.

The gdscript code in the game was pretty simple. Initialized Gamerzilla with the start() and setGameFromFile() methods. Then called setTrophy() to give the player the achievement. Everything checked if the Gamerzilla object existed so that the game still worked on platforms without Gamerzilla support like html export. The setup to use a gdnative library in Godot was not pleasant.

You needed to download the cpp interface and build it. After building your gdnative library, it needed to be added to the Godot project and a separate native script resource needed to be added for each object. I have only tested the Linux build because building a Windows gdnative library required Microsoft Visual Studio. I have yet to experiment with what you need to ship with your game to make it playable everywhere.

Godot Experience

It was easy to recreate the simple disc room in Godot. The screen shake and movement added a lot to the game experience and would have taken some effort to program manually. The ease of creation was one of the reasons I continued to create with it. I already envisioned other projects which could make use of the program. Integrating with Gamerzilla wasn't as smooth as I'd like but once setup it is easy to use.

Comments

No comments yet.




(optional, e-mail address only visible by admins)

Last modified: 2020-11-10, 02:42

© 2009-2022 Identical Games

powered by phpSQLiteCMS