Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: My First Game: Jong (A Pong Clone)  (Read 4515 times)

0 Members and 1 Guest are viewing this topic.

lightningblah

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
My First Game: Jong (A Pong Clone)
« on: March 18, 2014, 08:22:14 pm »
Hey guys,

I've been working on this game on and off for about 2 months now while I learn C++ and SFML. 

It features a vs AI mode (with 3 difficulties) and a vs player mode. Player one can switch between mouse or keyboard control, and player 2 will default to whichever option player one is not using.

The game is only available for Windows at the moment. It was compiled using VS C++  2010 Express.

Versions:

Version 1.2 offers the following updates:
  • Increased the ball's speed
  • Fixed bug where "enter game" music only played on vs Player and not vs AI
  • Fixed bug where, if game was already paused and it lost focus, it played the pause noise again
  • Fixed movement interpolation of paddles so they do not appear to go into the borders at high speeds
  • Enabled vsync to limit framerate
  • Slightly improved ball collision detection with paddles (in the player's favor)
  • Allowed for a wider range of "spiked" angles to make the game more interesting
  • Modified AI difficulty to make the game more accessible
  • Smoothed out AI movement quite a bit

I  have a short video showcasing release version 1.2:



I'm looking for any type of feedback, especially any bugs that are encountered or if you have any issues initially running the game.

Unfortunately, I haven't been able to try my game out on many other computers yet to test my deployment DLLs. My biggest concern is whether or not including msvcp100.dll and msvcr100.dll is enough to run this program on a machine that hasn't already installed VS C++ 2010 Express.
« Last Edit: March 28, 2014, 07:41:04 pm by lightningblah »

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: My First Game: Jong (A Pong Clone)
« Reply #1 on: March 18, 2014, 08:32:15 pm »

lightningblah

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Re: My First Game: Jong (A Pong Clone)
« Reply #2 on: March 18, 2014, 08:49:58 pm »
I think you may find these two links interesting/useful:
http://www.microsoft.com/en-us/download/details.aspx?id=40784
http://www.dependencywalker.com/

Thank you for this! I was trying to avoid forcing users into installing the redistributable package, but I think that may be naive/selfish on my part since it probably will do a much better job at preparing the user's computer than I can. My hesitance stems from the fact that when I tried sharing programs with my friends years ago, and they had to install something, it always brought up red flags that it was just another thing they would need to uninstall in the future.

With that being said, I used Dependency Walker and noticed I included the x64 versions of the files in question, so I just changed them to the correct x86 versions and updated the link above. I'm trying to get my feet wet in understanding what I'm seeing with Dependency Walker, but I'm hoping (and it looks like) I have my bases covered.

Thanks again!

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: My First Game: Jong (A Pong Clone)
« Reply #3 on: March 18, 2014, 08:52:21 pm »
I tried it and here is what I thought.

  • Very cool sound effects, did you make them yourself?
  • Limit the framerate with VSync, at the moment the game consumes an entire core of my cpu (and burns my leg with my laptop)
  • Work on the AI, he seems to move the paddle in a very jittery fashion
  • If you want feedback on your code put it on github or bitbucket (and learn git at the same time - source control is another crucial part of development)
  • Another thing about the paddles and I don't know if it was intentional, but if I slightly move my paddle down it will go down but also move back up.
  • Preferably, don't use Media Fire, instead use a hosting site like hashcookie.net
  • Good job and keep up the good work with SFML
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

lightningblah

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Re: My First Game: Jong (A Pong Clone)
« Reply #4 on: March 24, 2014, 12:01:40 am »
I tried it and here is what I thought.

  • Very cool sound effects, did you make them yourself?
  • Limit the framerate with VSync, at the moment the game consumes an entire core of my cpu (and burns my leg with my laptop)
  • Work on the AI, he seems to move the paddle in a very jittery fashion
  • If you want feedback on your code put it on github or bitbucket (and learn git at the same time - source control is another crucial part of development)
  • Another thing about the paddles and I don't know if it was intentional, but if I slightly move my paddle down it will go down but also move back up.
  • Preferably, don't use Media Fire, instead use a hosting site like hashcookie.net
  • Good job and keep up the good work with SFML

Thank you so much for the quick reply!

  • I cannot take credit for the sound effects; I happened to stumble across this amazing site/program: http://www.bfxr.net/. All I did was use different random effects until I found one I liked and slightly modified it until it suited my needs. I recommend this site to anyone who's into old-school sound effects for games (think Megaman!). I put a link to it in the credits section of my main menu because whoever made it deserves to be recognized!
  • I enabled Vsync.. very good point. I spent a lot of time trying to implement a fixed time step with unlimited FPS but now realize truly unlimited FPS is a little.. much ;).
  • The AI was a struggle and I must admit I "settled" with jittery movement. With my player paddle, it was very easy to implement acceleration to my velocity. While a key is held down, += acceleration to velocity (which has a cap) and when the button is released, -= acceleration. Now, when I tried this with AI.. it was more complicated than I thought. My AI's "brain" just looks if the center of the ball is away from the center of itself, and if they're different it moves at a fixed speed in the direction of the ball until their positions are equal. The easy difficulty just has a slower speed than the hard difficulty. When I tried to add acceleration to this movement, I made it so if the ball's center != the paddle's center, += acceleration to its speed. If they do equal, -= acceleration from speed. The issue was the paddle and ball's position became equal after just a few game ticks so the speed constantly fluctuated.
  • I do plan on posting my code for review, although right now it is very ugly, and I plan on cleaning it up a little more beforehand.
  • I think this effect happens because of my acceleration and decceleration of my player paddles, but also because I interpolate their positions based on their velocity in order to give them a smooth movement speed with a fixed timestep. When the paddles move their position is therefore displayed a little ahead of where it actually is in the logic portion of my game so once the paddle stops it looks like it goes back a little too far (sorry this is hard to explain in words..) This also caused my collision detection to act a little wonky, for instance, if you have a paddle at the top of the screen and hold the down key until you collide with the bottom border, you can see the paddle enter the border for a second since the interpolated position is not checked for collision. I'm still trying to research a better way to go about doing this.
  • When I've made a few more changes to my game I will switch over to this site for hosting!
  • Thank you and I really really appreciate your critisism. I'm very new at this, and having someone give me advice when most of my learning on the subject is (unfortunately) self-taught by researching, is very helpful and refreshing. Sorry if I was too wordy or off-topic with my response.


I know I should bite the bullet and find a way to clean up my AI plus interpolation process before I move on to a new project. The only reason I left it like this is because I plan on revisiting all of my projects and revamping them as I learn more from new projects, but it does feel lousy setting the game aside without these few things that bug me all cleaned up. I am glad the Vsync was such a quick fix! I will comment my original post when I reupload the game with as many fixes I add before the month ends.
« Last Edit: March 24, 2014, 12:07:57 am by lightningblah »

lightningblah

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Re: My First Game: Jong (A Pong Clone)
« Reply #5 on: March 28, 2014, 07:17:47 pm »
I edited the first post with a version 1.2!

I tried to address all of the issues you mentioned zsbzsb, and again appreciate the advice. I could not use hashcookie.net for my new update because it appears to be down (as soon as you hit upload it brings you to an error page right now).

I'll be putting this game to rest for quite some time while I move onto a new project, but I have a file that I'm using to record any bugs, criticism, or suggestions people give me for the day I revisit it.

Thank you all again. I'm excited to post some early versions of my Snake clone in the months to come that I will be starting on Tuesday.

On a side note, if anyone is interested in helping me with art, music, or sound effects please email me at jon@error151.com!

Raincode

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: My First Game: Jong (A Pong Clone)
« Reply #6 on: March 29, 2014, 05:21:39 pm »
Not bad :)
I especially like how you already have a Menusystem implemented.
Personally, I think the sound effects are a little too much/too dense, but that's just a matter of taste.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: My First Game: Jong (A Pong Clone)
« Reply #7 on: March 30, 2014, 12:27:19 pm »
The sound effects are hilarious, especially when navigating in the menu :D
But I can imagine that it becomes annoying after some time ;)

Getting feedback to code is a good idea. Also, small projects like Pong or Snake are a great opportunity to experiment with advanced C++ concepts and OOP designs. Don't do what you already know, learn new things. I also suggest having a look at your old code and thinking about how you could possibly improve it, even if you won't. Similarly, you could have a rough idea about the code of a new project before you start developing.

When you learn these things already for small projects, you won't have to do so in bigger ones. Suddenly recognizing that a 10k code base is a huge mess beyond the possibility of reasonable refactoring can be very frustrating, especially when you've spent a lot of time in it.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: