Stuck on balls bouncing off walls

The Partridge Family were neither partridges nor a family. Discuss.
migueltherat
Posts: 5
Joined: April 22nd, 2017, 1:42 am

Stuck on balls bouncing off walls

Post by migueltherat » May 6th, 2017, 5:48 pm

I've been working through the tutorials and for the last week on the Fart-Annoyed game. I got stuck on the part where we teach the ball to bounce off the walls. I haven't attached code yet because after I cleaned and zipped it, the folder was still 119 mb, I was afraid of clogging the website with an oversized folder. But I have the cleaned and zipped file ready in case I should share it anyway.

What seems to be happening is that the ball's GetRect call is not initializing rect with its left, right, top, and bottom floats. It gets the position, halfWidth, and halfHeight fine but with the rest uninitialized it immediately thinks the ball is outside the walls and overcorrects its position.

I'm using Visual Studio 2017 for this in case that makes any difference.

So I have multiple questions - Has anyone else had this same problem? Is it normal to have such a big solution folder after cleaning and zipping? And should I share it anyway?

Pindrought
Posts: 432
Joined: September 26th, 2013, 4:57 pm
Location: Kentucky
Contact:

Re: Stuck on balls bouncing off walls

Post by Pindrought » May 6th, 2017, 6:07 pm

migueltherat wrote:I've been working through the tutorials and for the last week on the Fart-Annoyed game. I got stuck on the part where we teach the ball to bounce off the walls. I haven't attached code yet because after I cleaned and zipped it, the folder was still 119 mb, I was afraid of clogging the website with an oversized folder. But I have the cleaned and zipped file ready in case I should share it anyway.

What seems to be happening is that the ball's GetRect call is not initializing rect with its left, right, top, and bottom floats. It gets the position, halfWidth, and halfHeight fine but with the rest uninitialized it immediately thinks the ball is outside the walls and overcorrects its position.

I'm using Visual Studio 2017 for this in case that makes any difference.

So I have multiple questions - Has anyone else had this same problem? Is it normal to have such a big solution folder after cleaning and zipping? And should I share it anyway?
No it should be under 1mb most likely unless you've added large asset files.
PM me if you need to contact me. Thanks to all the helpful people on this forum especially to Chili.

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

Re: Stuck on balls bouncing off walls

Post by albinopapa » May 6th, 2017, 6:21 pm

The only time I've seen solutions that large are with sounds and images. The Visual Studio files that accompany your solution can usually be around 50MB+. The only things necessary ( with the exception of assets like sound or images ) are the .sln file and the sub-folder with all your .h, .cpp, .vcxproj and .vcxproj.filter files. The .filter file is what keeps track of any filter folders in the Solution Explorer. The .vcxproj file is all your project settings. All Debug and Release folders ( including the ones in your project sub-folder ) should be deleted.
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: Stuck on balls bouncing off walls

Post by albinopapa » May 6th, 2017, 6:21 pm

The best thing to do then is create a GitHub account and post to there. Then share the link here.
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

migueltherat
Posts: 5
Joined: April 22nd, 2017, 1:42 am

Re: Stuck on balls bouncing off walls

Post by migueltherat » May 6th, 2017, 11:40 pm

Thanks for the help. I'm trying to upload my branch onto a new GitHub account I just created, but so far when I try to sync it to my new repository, Visual Studio keeps telling me that my branch doesn't exist in the repository. I'll tackle it again tomorrow.

User avatar
krautersuppe
Posts: 91
Joined: September 14th, 2015, 10:58 pm
Location: Istanbul

Re: Stuck on balls bouncing off walls

Post by krautersuppe » May 7th, 2017, 4:55 am

migueltherat wrote:I've been working through the tutorials and for the last week on the Fart-Annoyed game. I got stuck on the part where we teach the ball to bounce off the walls. I haven't attached code yet because after I cleaned and zipped it, the folder was still 119 mb, I was afraid of clogging the website with an oversized folder. But I have the cleaned and zipped file ready in case I should share it anyway.

So I have multiple questions - Has anyone else had this same problem? Is it normal to have such a big solution folder after cleaning and zipping? And should I share it anyway?
Did you use ChiliClean http://www.planetchili.net/downloads/chili_clean.zip ?
I used it and had the same issue.After you have executed chiliclean just delete a hidden folder named .vs and it should be fine.
DSU
Discord: dsu1, GitHub: https://github.com/DSpUz

migueltherat
Posts: 5
Joined: April 22nd, 2017, 1:42 am

Re: Stuck on balls bouncing off walls

Post by migueltherat » May 7th, 2017, 5:43 pm

Thanks, krautersuppe. I'm having no luck uploading to GitHub. I had used ChiliClean before, just tried your suggestion and it worked.

So here's the solution folder down to less than 1 mb attached. I'm still new enough at this that I think but am not sure that the folder includes everything I downloaded from the tutorial GitHub page plus my changes. My changes are on a branch that I called T20MainBranch. The commit that I'm stuck on I called Stuck on DoWallCollision in Ball.cpp.
Attachments
Fart-Annoyed Game.zip
(670.14 KiB) Downloaded 160 times

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

Re: Stuck on balls bouncing off walls

Post by albinopapa » May 7th, 2017, 10:15 pm

Here's the problem

Code: Select all

RectF::RectF(const Vec2 & topLeft, const Vec2 & bottomRight)
{
	RectF(topLeft.x, bottomRight.x, topLeft.y, bottomRight.y);
}

RectF::RectF(const Vec2 & topLeft, float width, float height)
{
	RectF(topLeft, topLeft + Vec2(width, height));
}
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: Stuck on balls bouncing off walls

Post by albinopapa » May 7th, 2017, 10:22 pm

Same issue as this one
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

migueltherat
Posts: 5
Joined: April 22nd, 2017, 1:42 am

Re: Stuck on balls bouncing off walls

Post by migueltherat » May 8th, 2017, 12:03 am

Excellent, that did it. Thank you very much, albinopapa. The one thing I'm still scratching my head about is that the same change was not needed for the function that DoWallCollision was calling. I'm guessing that's because it isn't a constructor even though it's imitating one?

And for future reference is that preferred for constructors in general - put the parameters between the colon and the first curlybrace rather than within the curlybraces?

Post Reply