My first finished project is now live and on the web! This is a momentous occasion, and I couldn't be more proud. Before I go on any further, though, I'd like to start by saying a few words about Mr. Iwata and our loss this weekend.
Satoru Iwata
I would like to take this opportunity to offer my deepest condolences to Mr. Iwata's family and friends.
What more can I say that hasn't already been said about Satoru Iwata. Stephen Totilo wrote a great piece about him over at Kotaku, and it's a great read about his early life and his role within Nintendo. I was fascinated to learn that Mr. Iwata was not only a business man, but a programmer as well. I had previously read about how he got down and dirty during the development of SSBM by fixing a myriad bugs, but it didn't occur to me that he was a full-time programmer at one point.
I became familiar with Iwata when Nintendo started doing the Directs. The way he would motion "direct" would make me smile each time, and Mr. Iwata always came across like a fascinating person.
Thank you for your contributions to gaming, Mr. Iwata. You will never be forgotten. Erste has been updated to reflect gratitude for Satoru Iwata.
My first project
When I set out to learn programming, I quickly realized the importance of coding on a regular basis, and seeing projects to completion. Once I had decided that I would be using SFML for my first few projects, I started playing with the tool and becoming familiar with it. It was easy to create the game loop, add and draw sprites, animate those sprites, and even add support for multiple players.
The first idea I had was for an awesome brawler in the style of SNES games like Final Fight or Turtles IV. However, I realized that what I was trying to do was way too ambitious, and decided to start small. Way small.
One of the first video games created was Pong. The minimalistic style of that video game was perfect for a first project, I thought. And with that idea, I also added a challenge: start and complete one project per month.
I started Erste in May and was finished with it by the second week in June due to a few setbacks. However, I'm currently on track with the schedule, and I'll be adding my recent projects to the website soon.
Development on Erste
First of all, the name Erste means "First" in German. I learned that while taking some German classes from Hillevi at work, and I thought it would be a great name for my first game.
The game features two-player gameplay, different screens, and an elaborate credits class that I'm particularly fond of, but more on that later.
For the two players, it was relatively easy to implement this feature. You can simply tell SFML that you have two sets of buttons and then tell it what those do. The hardest thing, and where I hit that roadblock that I was referring to, was when it came to the screens. Initially, I wasn't aware that if you have an inner loop for screens—think pause screens—you also need to add an Events object before the while loop. This is only the case when you're working on a Mac, I believe. If you don't have this Events object, the window doesn't render. What happens is that the game actually keeps running in the background, and is even playable(!), but you just can't see anything.
Once that Events object is added, the inner loop works as expected.
As for the Credits class, I have to say I'm proud of it. What it does is it takes in a text file, reads it line by line, and decides what to do based on a character that you add at the beginning of that line. For example, adding '#' at the beginning adds a large heading, '*' adds a middle-sized heading, and '%' is the smallest. You can see the credits file on the left, and the final result on the right in the gallery below. I'm also happy with the fact that it uses vectors instead of regular arrays to take in the strings. It doesn't remove vector elements that have left the screen, but that will be added to version 2.0.
The game is currently only available for Macs, but I'll update this post as soon as the Windows version is ready.
Lastly, there are a few bugs that I won't bother fixing, but that shouldn't break the game:
- Not sure why, but when you download the game from this site, there is no "boop" sound when the ball hits a surface. I thought I knew what the problem was, but I can't seem to find it.
- If the ball is caught on the top or bottom surfaces of a paddle, it bounces back and forth until it comes out at on the opposite end. I call this a feature, not a bug, since you can use this to your advantage.
- If the ball's vertical position is either zero or equal to the height of the window, and the horizontal position is the same as one of the paddles, it reacts the same as the bug above.
I would have liked to have made it so that the speed of the ball and paddles are dependent on the game speed. Instead, right now there is a set frame rate that you can enable with SFML:
window.setFramerate(60);
In closing, I'd like to say that I'm proud of this tiny game, and can't wait until one day I can look back on this and appreciate where I came from.
Please download it and let me know what you think. Don't forget to also share it with your friends, family, and on social media.