looking for critique on first game.

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
coolmoon
Posts: 7
Joined: April 7th, 2017, 12:17 am

looking for critique on first game.

Post by coolmoon » April 23rd, 2017, 3:59 pm

so i am only to lesson 12 but wanted to try a game on my own.
I made a straight up game of pong and called it ping.

Game play
left player "w" and "s" for up and down.
right player up and down arrows
enter to start game
space bar to serve
ball speeds up every 3 hits and resets each serve
first to 10 wins

I did jump to lesson 15 first so I could get it up on GitHub.
https://github.com/CoolMoon1/Ping

it is only self commenting, I hope well enough.

I know there better ways to get this done code wise but the only thing I used not in the lessons was a switch/case for the score, my main concern is the game development ie..

I would like to know if my commits to GitHub were timed / spaced right and what order of game development might have made it easier. this is just how it fell out of my head without planning it out on paper.

all comments on code or development are welcome

Thanks for your time.
CoolMoon

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: looking for critique on first game.

Post by albinopapa » April 23rd, 2017, 9:44 pm

My first critique would be the Ball class handling score and game over conditions.

Good use of const

Code: Select all

Player::Player( int in_x, int in_y, int in_width, int in_height, int in_speed )
{
	x = in_x;
	y = in_y;
	width = in_width;
	height = in_height;
	speed = in_speed;
}
I don't remember at what point chili covers constructors, but for future reference when initializing class members, it's better to use the initializer list opposed to the constructor function body like so

Code: Select all

Player::Player( int in_x, int in_y, int in_width, int in_height, int in_speed )
	:
	x( in_x ),
	y( in_y ),
	width( in_width ),
	height( in_height ),
	speed( in_speed )
{}
Not so much an issue for small applications or objects you create during application startup, but it is a good habit to get into. There are going to be times you are required to do so, and it is actually more efficient to do so.

Try to keep game logic out of your drawing routines, in Player you have clamping code in the draw function, you could move this to the Update function. Also, in your Game::ComposeFrame function

Code: Select all

	if( !ball.InPlay() && wnd.kbd.KeyIsPressed( VK_SPACE ) && isStarted )
	{
		ball.ResetBall();
		wnd.kbd.Flush();
	}
This looks like game logic, so should probably go in Game::UpdateModel
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: looking for critique on first game.

Post by albinopapa » April 23rd, 2017, 10:09 pm

Just saw something else that might be useful to you and maybe others.

In VS there is something called a Task List, by using those //ToDo or //TODO tags, you can keep track of your "TODO's". If you don't have that tab at the bottom, you can go to View / Task List to add it.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

coolmoon
Posts: 7
Joined: April 7th, 2017, 12:17 am

Re: looking for critique on first game.

Post by coolmoon » April 23rd, 2017, 10:48 pm

Thanks albinopapa,
all feed back is welcome. I want to start forming good habits from the start.
I will study up on the initializer list.
Also the //ToDo tip will be helpful, I found myself lost a couple of times or at least wondering what I needed to do next.

Thanks again

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: looking for critique on first game.

Post by chili » April 24th, 2017, 10:06 am

Looked at your code, looks like good stuff. Same comment as papa really, ball should not be responsible for score.

And I also was not aware that VS now has a todo tracker. I'll have to use that myself, maybe in a future video.
Chili

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: looking for critique on first game.

Post by albinopapa » April 24th, 2017, 4:50 pm

The only thing I don't like about the Task List is it only shows the todos when those documents are open. So if you have a bunch of todo comments in several files, you'd still have to open them up before the Task List would show the comments. Though if the file is really long, using the Task List to navigate to that comment by double clicking is nice.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

User avatar
LuisR14
Posts: 1248
Joined: May 23rd, 2013, 3:52 pm
Location: USA
Contact:

Re: looking for critique on first game.

Post by LuisR14 » April 26th, 2017, 7:10 am

has been available on vs2015 (don't remember if even earlier)
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat :mrgreen: --

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: looking for critique on first game.

Post by albinopapa » April 26th, 2017, 7:56 am

Yeah, if I remember correctly, VS2013 had it and had more options like User Tasks which allowed you to add a task list and check them off as you completed them. It was removed in VS 2015 though.

Visual Studio Task Lisk
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

Post Reply