Monday, January 30, 2017

From Pong to Racquetball, or Somewhere In-between

This is the continuing saga of my efforts to make my own Pong clone. I actually made a lot of changes to it since I last wrote about it, so I think what I’m going to do is simply make a bulleted list and then go from there. My first post, where I described my early progress, can be found here: http://bitsandpixelsdev.blogspot.com/2017/01/and-so-it-begins.html

Changes

  • Made the ball start in the middle of the screen and move in a random direction
  • Updated the textures used for the ball and walls
  • Added left and right player paddles
  • Added collision detection for the walls and paddles, so the paddles won’t move into the walls and the ball will bounce off of everything
At this point, I was pretty happy with things. I had something that worked! The ball moved and bounced, and player interaction was possible. I was especially proud of the fact that I was able to work out how to change the direction of the ball when it bounced off of something on my own. I know it’s a small detail, because it’s actually a really simple calculation for the new direction, but that was one of my goals with this whole project: see how much I could do on my own without looking for help.
However, I suddenly realized something. I had put in two paddles simply because I had the normal game of Pong in my mind, but I didn’t really have any intention of creating a two player game; at least not at that moment. And I didn’t want to try to create an AI for the second player either (more complexity, and all that). So I decided to remove the left paddle and put in a wall instead.
Easy. Except now I don’t have pong; I have racquetball instead. And that leads to something else: how do I handle scoring for racquetball? Points don’t make sense. So I think what I’m going to do is implement two game modes, just for fun. There will be racquetball with a timer, and the goal is to see how long you can hit the ball before it goes past your paddle, and then there will be proper two-player Pong with point scoring. In both cases, I’ll speed up the ball slightly every time it’s hit by a paddle. And maybe I’ll try to implement an AI in the future; I haven’t decided yet.
So, next steps...
  • detect when the ball leaves the window for scoring, and reset the ball back to the middle of the screen
  • add a second game mode for two-player pong proper, and a way to switch modes
  • add scoring for both game modes
  • oh, and change the color of that left wall :)
But for now, at least I have progress!

Monday, January 2, 2017

And so it begins...

So I want to use this post to talk about what I've accomplished so far in the little bit of time I've spent learning about game development. It may not seem like much, but it's actually been a lot of fun for me.

After doing a little bit of reading about some of the more popular frameworks and game engines that are out there and talking to one of my coworkers who has experience with game development, I decided to start off with the MonoGame framework. If you don't know what MonoGame is, their website has a nice and concise history of the project and you can find more info on it with some quick searching. Briefly, it's a re-implementation of Microsoft's XNA video game framework, which they stopped developing in 2013. The goal was to provide support for XNA on more devices and continue to support the API once XNA was discontinued. Why MonoGame? Mainly because it allows me to write my code in C#, which I am very familiar with. I wanted to start off with something that would be easy to pick up and get stuff done in.

After installing MonoGame I started looking for good tutorials, and found RB Whitaker's Wiki, which seems to have a plethora of information on XNA, MonoGame, and game development in general. I went through some of his MonoGame tutorials which take you through the very basics of the framework and some simple 2D stuff. In the process I learned for the first time about what a game loop is (as I said, I knew little and was starting at the basics). In the end though, I learned my way around the framework a bit and ended up with a cool little program of swirling lights to demonstrate additive blending using sprites. Not a game, but fun to watch nonetheless.

I tried to make a GIF but it looked terrible. It is pretty fun to watch the colors change.

After going through those tutorials I wanted to start working on an actual game and I figured a good place to start would be a Pong clone. It seems relatively simple, but I'm sure it's also going to be a good challenge for me. I'm trying to see how much of it I can get done on my own without having to look up examples of Pong games from other people. So far, this is what I have:



Notice there's absolutely no collision detection yet. That ball will just keep moving in the same straight line forever. But look, I also added walls!



And that's as much as I've gotten done so far. I haven't had much time to work on this during the busy holidays, but I'm hoping to get a little more done this week. I suppose I'll try to make it bounce off the walls next, which I'm sure is going to be an interesting challenge.

So what are my goals for the future? I'm still trying to figure that out, to be honest. I want to also play around with the Unity game engine sometime, since it also makes use of C#. I think it would be interesting to compare it to MonoGame and try to get a sense of which I prefer, since they're really different beasts. So I had the idea of attempting to make a Pong clone in Unity as well. I may also try to make some more clones of other really old games for fun, like Breakout. And after that? I have no idea. I don't really have any original ideas yet, but that's the goal that I eventually want to work toward. And if I do come up with an idea and actually make it, maybe I'll put it up on itch.io and see what happens. I'm not doing this with profit as the main goal, after all. I just want to have fun with it.

But for now, I'm just going to focus on making this ball bounce around the screen. :)

Until next time!