Monday, February 6, 2017

Pongcquetball

Time for another Pong update! Er, well, racquetball, I mean. Pongcquetball? Yeah, that sounds about right.

I am very happy with the way it's coming along. I have finally reached the point where I have a basic working game! Here's a list of changes and updates I made since my last post:
  • Reset the ball position back to the center of the screen when it goes out of bounds
  • Use a stopwatch to track seconds while the ball is in play and display this as the score (I love how C# has a stopwatch class built right into it)
  • Reset the score when the ball goes out of bounds
  • Increase the ball's speed (by 0.5) every time it hits the paddle (it's actually challenging now!), and reset that speed when it goes out of bounds
  • Display a static high score beneath the normal score
  • Add a simple title screen
  • Wait two seconds after the title screen disappears before showing and moving the ball; basically, give the player a couple of seconds before the game actually starts
So this is what it looks like now...




I'm especially happy with the font. It's called Press Start 2P. I happened to find it in the comments of a post on the gamedev subreddit the other day, and it's the perfect fit for this project.

So yeah, I have an actual playable game now! I know it's really simple, but it's something that I made, and I'm really proud of it. Overall, this hasn't been too challenging so far, but I know that's mostly because I'm only making a clone of Pong, of all things. Not exactly a complex game. And even then what I have so far is simpler than the actual game. But still, to have gotten this far means a lot to me.

So what am I going to do next? Well, my next immediate task is to save the high score when the game exits so that it isn't lost every time you quit; probably just in a text file. Nothing fancy. After that, I've made a nice little to-do list of other features I want to add and things to change, such as adding another small delay after the ball goes out of bounds and before the game starts over, and increasing the score counting speed, just because I feel that counting normal seconds is too slow. Also, my wife suggested that I make the color of the ball change every time it bounces off of something, just for fun, so I am going to see if that will be possible to do. :) And I have a few bugs to fix as well, the most amusing of which is the fact that if the ball's speed is very high and it hits the left wall in just the right way multiple times rapidly, it turns into The Flash and phases right through it, never to be seen again. So the whole game breaks. That's going to be a challenge to fix, I'm sure.

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!

Sunday, December 25, 2016

Hello, world!

Welcome to my humble game dev blog! So, I've struggled over the last few years to come up with coding projects that I could work on in my free time, outside of work, for the purposes of learning and improving my development skills. I would think of an idea, maybe get beyond that phase to actually beginning to work on it, and then I would always eventually lose interest. But one thing that I've kept thinking about is video games. Why not try my hand at learning to make games? Surely that would hold my interest better, right? The problem is that I had convinced myself that it wasn't even worth trying, because what good idea could I come up with?

Well, a couple of months ago I decided why not, I want to give this a try. If anything is going to motivate me to code at home and stick with it, it'll probably be this. So I have finally gotten around to dipping my toes into game development a little bit. And that's what this blog is for. I'm going to use this to document what I'm currently working on and what I've accomplished, as well as anything that I've learned that I think is interesting. I'm starting at pretty much the most basic level and trying to go at it slow so that I don't overwhelm myself and give up again. But that's going to be the focus of my next post: where I'm starting at and what I've accomplished so far, complete with pics and code bits!