Category Archives: Blog

pongodot day 6: scoring

Time to handle scoring. The first step is to create goals. For this we are going to use an Area node, attached to it is a CollisionShape2D that defines the region. We create one of these on each side of the field. Not sure why I’m saying we, I did it.

GOOOOOOOOOOOL!

Now, it’s time to learn a little bit about signals in Godot. Signals are Godot’s version of an observer pattern, they allow you to have a trigger on one node be reacted to from another. According to Godot’s documentation this is to help limit coupling and keeps your code more flexible. In our use case here, for example, we can send a signal from the goals to the game controller, allowing it to react to the ball entering the zone.

We’ll start with the player goal. In the editor we’ll go to the node tab to expose the available signals.

Double clicking on body_entered brings up this screen, where we hope to connect to the script on the game scene Node.

Not really a need to change the receiver method name, so I click Connect.

And now the editor has added a new function to our GameController script where we’ll process the signal.

For testing purposes we’ll start with something simple. When the ball enters the area, we’ll delete it. Also, I’m going to take this chance to fix some of last week’s tech debt, and make it so only one ball exists at a time.

comPaddle and ball are a bit too coupled at the moment, so it’s causing extra headaches.

With that we can now delete the ball, as well as prevent another ball from being fired while a ball is active.

Next, time to add a score. For this we are going to have our GameController handle and track the score for both the player and the com. When the PlayerGoal is entered we need to make sure to increment the Com score (and vice-versa for the other goal).

Next we need a way to display the score. I spent a bit of time to download a free pixel font, and spent a bit more time googling and learning how to import that font into Godot, but I finally got my two labels made, and I’m pretty happy with the look of them. Next I just need to change the label text for each to match the current score value associated with it.

$PlayerScoreLabel is another way in code to get the Node called PlayerScoreLabel

With this it’s just a matter of pressing go and seeing if it works.

And, almost immediately I ran into a problem.

No, this one isn’t a gif

Before even launching my first ball the score is already 3 to 2. It took me a bit to figure out the problem which is that my paddles are technically partially inside my scoring area, so they are triggering the scores to go up before the initialization even finishes…

The easy solution would be to simply move the paddles slightly so that they are not inside the score zone. The better solution was to learn a little bit about collision layers and masks in Godot.

By setting up separate collisions layers for the paddles and balls, and making the score area only care about the ball layer with a mask, it should solve my issue.

setting up the layers in project settings

In project settings I made three layers, named Paddles, Ball and Goals.

Player Paddle

In the inspector I can set the collision layers and masks for different object. For my Paddles I set them on layer 1, and have them mask on 1 and 2.

Ball

For the ball, it lives on layer 2, and has a mask on all three layers.

goals

And then the goals live on layer 3, and only listen to layer 2.

And that fixed my issue. Now, when I start up the game the score is 0 to 0. As much as I would have appreciated a bit of a handicap in my favor, better to fix the issue and have everything behave as I want it to.

And with that, we can finally play Pong!

pong

After each ball pressing spacebar will fire another ball from the player side. Of course, you can’t win or lose yet, as you play the scores will just increase with no real end to the game. But, that’s a problem for another day. Here is the final code for my GameController script after today:

extends Node2D

var ballscene = load("res://Ball.tscn")
onready var comPaddle = get_node("Com Paddle")
onready var playerPadd = get_node("Player Paddle")
var current_ball

var playerScore = 0
var comScore = 0

func _init():
	playerScore = 0
	comScore = 0

func _process(_delta):
	$PlayerScoreLabel.text = str(playerScore)
	$ComScoreLabel.text = str(comScore)
	if Input.is_action_just_pressed("launch"):
		if current_ball != null:
			return
		current_ball = ballscene.instance()
		current_ball.position.x = playerPadd.position.x + 20
		current_ball.position.y = playerPadd.position.y
		add_child(current_ball)
		comPaddle.ball = current_ball

func _delete_ball():
	if current_ball != null:
		current_ball.queue_free()
		current_ball = null
		comPaddle.ball = null

func _on_PlayerGoal_body_entered(body):
	_delete_ball()
	comScore += 1

func _on_ComGoal_body_entered(body):
	_delete_ball()
	playerScore += 1

Tomorrow I plan to add victory/defeat, and maybe a start screen.

-Ike

a quick update

*cough

Man, it’s a bit dusty in here. It’s been, what, two years since my last post?

I mean, to be fair, the last two years have been, well, 2020 and 2021, so updating my personal blog that no one reads hasn’t been the highest priority, but I figured I’d post a quick update here anyway.

Last year I participated in Ludum Dare 48 with some gamedev friends, and that went pretty well. After the initial 72 hour jam we spent a few weeks polishing our prototype a little bit and posted it in itch.io, we’re pretty proud of it, so you should definitely check it out.

I had intended to write a devlog for it, but oh well.

I also started a webcomic. I have no artistic ability, so I am working with Madeleine Keene, who has been knocking the art out of the park. Just last week we finished the prologue, which you can read here. We are taking a two week hiatus before we start chapter 1. I’m very excited to be sharing that world and story.

I’m hoping to do Ludum Dare 50 in a month, and hopefully I’ll actually write a devlog for it, in the meantime I have a side project that I’m starting later today that I intend to post about, so there’s that.

So, that’s my life, and now, empty void, you have been informed.

Oh, also I came out as non-binary at the end of last year. My pronouns are they/he.

-Ike

Weapon Durability in Breath of the Wild

I wrote this essay as part of my graduate school application, posting this here now as a blog post. I’ve added a few extra asides and links to it, enjoy.

 

The Legend of Zelda: Breath of the Wild was one of the best games to come out from 2017. A refreshing change to the Zelda formula, Breath of the Wild has received no end of critical and fan acclaim, and was a massive win financially for Nintendo as well. I myself consider it a near perfect game, it blew me away.

One of the only complaints that I have heard consistently, however, is the weapons durability system. All weapons (with the exception of the Master Sword, but we’ll talk about that one later) have durability, and when they run out, they break. Throughout my own journey through Hyrule I found myself hoarding the most powerful weapons for the more dangerous fights, while I spent the rest of the time fighting weaker enemies with clubs, rusty swords, and even mops. From private conversations with friends who have played the game, to reviews and discussions online opinions are mixed as to how much of an actual problem in the course of the game. For some it was a minor inconvenience, and for others it did seriously disrupt their enjoyment of the experience. (such as in this article where he calls it a “tiny bump sticking out of an otherwise mirror-smooth surface”, but considers it enough of a problem to complain throughout the entire piece about it)

Durability systems can serve several different purposes. They can be used to add to a sense of verisimilitude in the game world. In Breath of the Wild the world is untamed, vast, and dangerous. The once great civilization of Hyrule is long fallen, and the hero must make due with what he is able to find lying around. In this regard the use of weapon durability adds to the overall atmosphere of the game.

Weapon durability can also be used to encourage players to use a variety of different weapons. The player is unable to simply rely on a couple of favourite weapons and instead needs to cycle through different weapons. This also justifies the fact that every single enemy in the game drops their weapon when they die. Throughout the game experience the player is constantly picking up weapons that they might otherwise never use (such as the aforementioned mop), and using them.

Lastly, these systems add challenge and difficulty to the experience. The player is forced to be more resourceful and choosy in how and when they use certain weapons. Fights are less straightforward, one has to consider what weapons they have, what weapons they are going to use, and when the better weapons break, improvisation becomes necessary. If all their weapons break, the player may then be forced to find a stick and a weak enemy just to get a slightly better weapon again. Overall, this makes the game more difficult, which may or may not be a good thing, depending on what the player wants out of the experience. (The unbreakable nature of the Master Sword, which I’ll discuss in more detail a bit later, almost completely removes the macro level weapon management, somewhat undermining this part of the experience)

Breakable weapons present a lot of problems in the actual gameplay. This is not something that is unique to Breath of the Wild. Many other games use these kinds of systems, and they all suffer from some of the same issues.

One issue is that weapon breakage can lead to a player to play in a sub-optimal way. An example of this is “too-good-to-use syndrome”. Because weapons break,, when the player is given a particularly strong or advantageous weapon, they may think the weapon is too good to use. Their fear of losing that weapon results in them never using it. I experienced this frequently when playing Breath of the Wild, where I would carry around a handful of strong weapons that never went to use until they were the only ones I had less. This is also something I experiences regularly playing Fire Emblem games. In the Fire Emblem series all weapons have a limited number of attacks that they can be used before breaking. The game also has a rock-paper-scissors style circular weakness system, different weapon types are strong against other weapon types. When attacking the optimal strategy is to use a weapon type that is stronger. However, the fear of losing your best weapons frequently led me to using less effective weapons so that I would not lose them.

Another issue is that when weapons break it can leave the player in a really bad position. This is related to the difficulty point I made earlier, and with proper planning and resource management this can be avoided by the player, but it still carries the risk of presenting a problem for them as well. In Breath of the Wild there is a particularly rewarding and difficult overworld enemy called a Lynel. On more than one occasion during my playthrough I attempted to fight one when I thought I was well stocked and well prepared, only to completely run out of weapons. In such cases I would either die or be forced to flee, weaponless and without any reward for my efforts. This can create interesting and fun scenarios for gameplay, but more often than not it’s simply frustrating for the player.

Breath of the Wild curiously does have one weapon that does not break. The Master Sword, Link’s legendary sword throughout the entire series, makes an appearance in Breath of the Wild. Getting it is an ordeal in and of itself, and the weapon itself never breaks. It does have a really strange cool down system of sorts, where instead of breaking the weapon becomes unusable for a time after it has run out of durability. It’s not the strongest weapon in the game, but it’s reliability make it an obvious choice for a majority of mundane tasks in the game. The entire thing, however, results in the Master Sword mostly being used to chop down trees during the Terrytown questline, making the epic weapon of Hyrule feel just a little less epic.

There are a few different solutions that could be used to help combat the complaints about durability while attempting to maintain its benefits. One possible solution is to introduce ways to repair or reinforce weapons. Dark Souls takes this approach, and in the first game of that series it was pretty effective. Weapons would eventually break if used too much, however there was a smith you could go to to repair your weapons. This approach keeps the difficulty and verisimilitude aspects of the durability systems, however, because you can repair your favourite weapons the player is no longer encouraged by the game to try out all the weapon types in the game. This system also allowed for interesting balance opportunities. In Dark Souls, katana-type weapons are very strong, but have low durability, choosing to use them has an interesting trade off. Later games in the series made the system less impactful by making all durability reset when you rest, which lost most of the weight behind the weapon durability. When implementing this kind of solution you would likely want to limit the availability of repairing weapons, but not so much that it might as well not be there at all.

Another possible solution would be to apply a cool down system similar to the Master Sword to more weapons throughout the game. This could likely be limited only to late game weapons, there isn’t much point in making mops and basic clubs not breakable. It would make the Master Sword less “special”, however it could potentially alleviate a lot of the grief and frustration, especially when dealing with late game enemies and bosses. Because the lower level weapons still break you would still get the advantage of encouraging players to try out different weapon types during the early game.

In spite of the annoyances caused by the durability systems Breath of the Wild is an excellent game, and very deserving of the near ceaseless praise that has been heaped upon it. While exploring possible solutions to the potential problems of weapon durability in the game is a useful exercise, at the end of the day weapon durability is part of what made Breath of the Wild the game that it was. I thoroughly enjoyed my own journey through Hyrule, and I look forward to playing it again soon now that the DLC has come out.