Thursday, September 21, 2017

It Is Finished!

I did it. I have finally finished a substantial hobby coding project for the first time since...high school, I believe. That was 12 years ago, so yeah, it's been a while. And I have actually made my first video game, to boot. Now, by "finished" I mean "works well enough to be functional and playable". I know I haven't fixed every bug. And I don't really intend to. My goal when I started working on this in January was just to make something that worked; something that I could use to begin to learn. And I must say, it's been really fun so far! :)

I also decided to upload it to the indie game website itch.io as a free download, just because I could.


But anyway, time for a final change log!
  • Remove the incomplete controller support
    I had originally planned for this to have controller support but eventually it just felt like a waste of time, so I gave up haha.
  • Add sounds
    Pretty self explanatory, but this was a big one. It's amazing how even the simplest of sounds can make a game so much more enjoyable. I had downloaded a few free collections of random sound effects and just started going through them until I found the right blips and bloops, lol. I added sounds to the main menu and paused/game over menu, ball-to-paddle collision, and when the ball goes out of bounds. I didn't record any video to demonstrate this, so you'll just have to play it for yourself if you want to hear it in all its glory. ;)
  • Redo the paused and game-over text so it's readable over the dotted line in a 2-player game, and also add a simple menu that allows you to restart/play again and return to the title screen
    It's much more functional now.
  • Only run the score timer on a one-player game
    This is just a behind-the-scenes change. The timer was still running unnecessarily on two-player games, and I wanted to make sure I fixed that just to make sure it wouldn't screw up the high score at all
  • Change how the initial ball movement direction is calculated
    This one bugged me ever since I first wrote this little bit of code. Here's how it initially looked:
    private float GetVelocityValue(float seed)
    {
        int posNeg = random.Next(0, 2);
    
        if (posNeg == 1)
            return seed * -1;
    
        return seed;
    }
    So it's picking a number, either 0 or 1, and if it's 1 I'm negating the "seed" number that was sent to the function. The returned seed number, either positive or negative, was then used for the speed of the ball. This function was horribly written though. For one thing, there was no need to send a seed number to it in the first place, because I was always using the same number for the ball's initial speed. But more importantly, it was terrible at determining a direction because it was only choosing between two numbers. It was common for the ball to start moving in the same direction 4, 5, or even more times in a row. Turns out, randomly selecting between only two values doesn't really work so well, lol. So I changed the function to this:
    private float GetVelocityValue()
    {
        int posNeg = random.Next();
    
        if (posNeg % 2 == 0)
            return BallSpeed * -1;
    
        return BallSpeed;
    }
    
    I'm not sending a seed value; instead I'm using a pre-defined BallSpeed variable that is declared up at the top of the file, which just makes more sense. Also, I'm selecting a random number from the full range of numbers that C#'s random number generator uses, 0 ≤ n < 2,147,483,647, and if it's even I'm making the ball speed negative. After a little bit of testing it seems to be better.
  • Update the window title so it longer says "Pong Clone"
    Consistency is important. :)
Sooooo...that's it! Like I said, it's not perfect. I've seen the ball collision detection act up every once in a while when it gets going pretty fast, but eh, at this point I'm not going to take the time to try to fix it. I did this just to get my feet wet and my hands writing *something*, and I would say "mission accomplished"! My next plan is to start playing around with the Unity game engine (which I may have already started doing) and maybe try making a 2D game with that. Breakout, maybe? It's an idea at least. I'm probably gonna stick with Unity for a long time, because I know there's a lot you can do with it, and I do have the start of an original idea that I eventually want to work toward. I figure Unity will be the perfect tool for the job. So with that...onward! :D

No comments:

Post a Comment