Jump to content
  • Advertisement
Sign in to follow this  
  • entry
    1
  • comments
    0
  • views
    367

Pong! and a fortuitos November Challenge

reders

540 views

Hi everyone!

This is the story of how I started working on a Pong game for fun without even noticing that that was the month's challenge theme. 
 

I started developing a Pong game since I wanted to follow the suggestion of user Alpha_ProgDes (I think you all know what blog post I'm talking about).
I have some programming experience in C++ thanks to my university studies, but never (really) tried developing a game.
Since I already know how to use Visual Studio, that was my SDK of choice. The framework used is SFML since I read it was pretty easy to use and sufficiently complete for 2D games development. 

So I started developing a standard Pong game. Since my esthetic sense is pretty sucky I followed the Material Design color palette to choose the colors of the game elements. I'm probably not experience enough to tell you what to do, but I think it's a good idea to follow this design standard since they are made to be pleasing to the eyes.

The graphic is entirely vector based, with shapes defined using the SFML libraries.
This choice made the collision detection easy and reliable. 

After developing a working version I published it on the For Beginners forum to get reviews of the code.
I really need to thank users h8CplusplusGuru and frob for their suggestions and insights. 

When I was finally satisfied with the results I started working on a modified version for the November Challenge.
The "twist" idea came to me practically instantly. Instead of having a standard rectangular game space I wanted to use a round arena with the paddle moving around the circumference and the ball bouncing inside of it.

The first step was to realize the paddles.
Since I wanted to stick to vectors shape, I developed a custom shape class following the preexisting classes in the SFML library.
For the rest of the code (i.e. collisions, bouncing etc..) it was all a matter of trigonometry.
I encountered some problems in the algorithm, since I'm used to a coordinate system starting from bottom left instead of the top right one used in programming.
Nothing that couldn't be solved with a bit of logic. 

Anyway, there's my story. Hope you like my game and sorry for my bad English.

Code reviews are highly appreciated guys :)



0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Advertisement
  • Blog Entries

  • Similar Content

    • By methinks
      I'm trying to write a simple server application using Winsock2. I have a socket listening on port 80 (for http traffic). When I run the program and use my browser to connect to 127.0.0.1, the server receives the connection and displays it as expected.
      New Connection Recieved message: GET / HTTP/1.1 Host: 127.0.0.1 Connection: keep-alive Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 DNT: 1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8 Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9 The problem comes when I try to close the socket. I'm using the following two commands: 
      closesocket(currentSocket); FD_CLR(currentSocket, &socketList); When I do this, the program keeps repeating the output as if it was getting the same request over and over. If I remove either of these commands it only displays the output once, as it should.
      The complete source code is as follows. This is a simplified version of the code that will duplicate the behavior, so I've omitted certain checks for clarity.
      #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif // !WIN32_LEAN_AND_MEAN #pragma comment(lib, "ws2_32.lib") #include <WinSock2.h> #include <iostream> void runTest() { ////// SETUP /////// const int LISTENING_PORT = 80; const int BUFFER_SIZE = 4098; WSADATA wsa; sockaddr_in listeningAddress; listeningAddress.sin_family = AF_INET; listeningAddress.sin_port = htons(LISTENING_PORT); listeningAddress.sin_addr.S_un.S_addr = INADDR_ANY; WSAStartup(MAKEWORD(2, 2), &wsa); SOCKET listeningSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); bind(listeningSocket, (sockaddr*)&listeningAddress, sizeof(listeningAddress)); listen(listeningSocket, SOMAXCONN); fd_set socketList; FD_ZERO(&socketList); FD_SET(listeningSocket, &socketList); ////// MAIN LOOP /////////// bool isRunning = true; while(isRunning) // endless loop, normally has interupt mechanism { fd_set socketListCopy = socketList; int socketCount = select(0, &socketListCopy, nullptr, nullptr, nullptr); for (int i = 0; i < socketCount; i++) { SOCKET currentSocket = socketListCopy.fd_array[i]; if (currentSocket == listeningSocket) { std::cout << "New Connection\n"; SOCKET client = accept(listeningSocket, nullptr, nullptr); FD_SET(client, &socketList); } else { char buffer[BUFFER_SIZE]; memset(buffer, 0, BUFFER_SIZE); int bytesIn = recv(currentSocket, buffer, BUFFER_SIZE, 0); std::cout << "\nRecieved message:\n" << buffer << '\n'; // Using the following two lines causes the output to loop closesocket(currentSocket); FD_CLR(currentSocket, &socketList); } } } WSACleanup(); }  
    • By Sleeping Daemon
      So I am currently on the Game Design aspect of an ambitious MMOFPS project. I need to know if having either full body awareness or floating arms be best to achieve better performance? or if it doesn't matter. I see some FPS's feature full body awareness but I would like to know why most of them don't have them? 
    • By Samuel Aponte Sustache
      Ok am not an game developer but I really got annoying when a player uses aimbot and no way as a player to do a thing. Im graduated as electronic technician and I study the nand.
      This guy can be implemented on our game program as a protection in case of cheating.  The objective of a cheater is for example 7, 10, 15, kills on a row but what if the player install a nand program and instead of the cheater kill he automatically dies....."wtf" he will be confuse.  What about a nand program.  If the player suspects cheating or server admin then you will apply the cheater the medicine and he will eventually goes.
       Thanks
      Samuel Aponte 

    • By LonelyStep
      PROGRESS
      Thought I'd reach out for some feedback on my little project. This is an android two-player game for top-down boxing matches. The core mechanics are all that I have accomplished thus far, later I want to add different configurations for your boxer (special effects, increased health or damage, etc) and maybe even a single player AI to practice against.

      SCREENSHOTS
      #1

      *****************************************************************

      #2
       
      FEEDBACK
      Right now the gameplay feedback I'm looking for is on the fundamental mechanics of the game.

      One area of particular concern is the window of opportunity for a player to block after their opponent has begun a punch. Currently that window is one-tenth of a second, otherwise you will be to late to counter their blow. I want it to be difficult to successfully pull off a block and have it be something that requires real attention to accomplish. I'm wondering though if it isn't too difficult right now, which may encourage mindless button mashing, which is certainly not what I want to condone.

      Another consideration is whether having three main actions (block, attack, charge) provides a good balance. My idea with having three main areas is that your two thumbs will have to leave one section uncovered at all times. This should result in hand movements that telegraph actions to the opponent.

      Aside from these, any other constructive criticism is very welcome.

      LINK
      My game can be found at the Google Play Store here:
      https://play.google.com/apps/testing/com.meatandgrain.PunchABunch

      NOTE There is a known graphics error when performing a special punch. There are no doubt other unknown errors as well.

        Thank you for your time, I hope you'll be able to find some fun in this little game!
    • By Vandallord
      Link: https://www.kongregate.com/games/Vandallord/idle-stone-history

      A wicked witch turned the main hero into the stone, you need to find a way to break the spell.
      INSTRUCTIONS
      Click on the objects and they will open.
      Click on the stone and its skill to attack the animals will grow as well as a the losses from clicking on animals.
      Click on the river to improve the function to manage time and clicks on the animals will be more precise.
      Click on the tree and it will give you things from animals and the level of luck will grow which give you an opportunity to Harder hits.
      The higher the level of monsters the more animal can visit the stone and give presents which are essential to make a portion.
      Screenshots:
       
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!