C++ Progress ish

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
ceofil
Posts: 39
Joined: April 13th, 2017, 8:35 pm

C++ Progress ish

Post by ceofil » April 25th, 2017, 4:26 pm

Hi there!
So I want to make a thread/post where I post everything I make like a journal or something so I can look at it after years or idk. It just feels good.
I'm not good with words so I'll just jump into posting stuff.
Hope you find it not boring.
In
first stuff.rar
(998.84 KiB) Downloaded 179 times
u can find the some stuff I made with testColliding and some a few versions of some AI I tried to make for the poo game. I only have the source code for the last version because I worked in the same soultion.
I watched some video that ...basically the idea was dont leave things unfinished, so I gave the poo game some sort of final form.
After that I did some kind of font with the grid. It was mainly because I didn't want to use the debugger all the time but then I used it to display scores and stuff. Then I made it so it can display strings also.
After that I did the snek game witch is basically almost like the one Chilii did in the tutorial except the tail is drawn depending on it's verticality and you can't move backwards.
That's it. Have a nice day.

Links:
-AI source
-finished poo game
-font
-snek game
-arkanoid
-2048
Image
Image
Image
Image
Image
Last edited by ceofil on May 21st, 2017, 6:19 pm, edited 5 times in total.

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

Re: C++ Progress ish

Post by chili » April 26th, 2017, 1:46 am

Ooooh, I like these threads! Hopefully you can keep it going, looks good so far :D

The text rendering code is impressive, looks like you have some prior experience with C or a C-like language? You will not have trouble with the upcoming c-string lesson it seems.

The snek thing you did are things i had considered myself. The ability of the snek to move backwards and kill itself immediately has bothered me for a while :D And I was also considering drawing the head with eyes (which would necessitate keeping track of the last direction moved).

Keep up the good work, I'll be reading this. If it keeps active, I'll also shout it out in the next update video.

ps

What video are you up to now in the tutorials?
Chili

ceofil
Posts: 39
Joined: April 13th, 2017, 8:35 pm

Re: C++ Progress ish

Post by ceofil » April 26th, 2017, 4:14 am

Yeah, we have a computer science class at school. But it's kind of a joke. No one takes it seriously, not even the teacher. We've been doing it for 3 years and we're only at recursion. Divimp, quicksort, merge sort, that kind of stuff. It's nice to finallly find a community that likes coding. Also I really like when you turn code into "sexy code". If I do that at school it's not recieved very well. I mean I don't do it very often but I get a lot of backlash when I do it.
The last tutorial I've watched it's 19 but I'm sort of rewatching 15-19 and practicing more with git, chrono and vectors before I get into the next project.
One more thing. I've never used forums before. When I update this thread, do I edit the original text, or do I make another topic? Or do I post it here in the reply section and it willbe added to the topic text somehow?

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

Re: C++ Progress ish

Post by albinopapa » April 26th, 2017, 5:04 am

It would be more helpful to just click Reply and it will keep the thread running and active. If you just edit the first post, 1) it will get super long, 2) I don't think it counts as far as the thread getting bumped to the top of the forum posts.
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

ceofil
Posts: 39
Joined: April 13th, 2017, 8:35 pm

Re: C++ Progress ish

Post by ceofil » April 28th, 2017, 7:03 pm

So I'm doing the fart annoyed game and I wanted to make bricks have on-death effects, like in hearthstone or something. For example it explodes when destroyed and destroyes the bricks around it. But I want to make it so the bricks that get destroyed by the "bomb" also trigger their on-death effect(because they only trigger when they get destroyed by the ball). So I tought this would solve that

Code: Select all

void Game::doEffect(int i, int j)
{
	if (brickz[i][j].effect.bomb == true)
	{
		for (int li = 0; li < nrraws; li++)
		{
			for (int lj = 0; lj < nrbricks; lj++)
			{
				float dist = (brickz[li][lj].getCenter() - brickz[i][j].getCenter()).getLength();
				if (dist < 100.0f) {
					brickz[li][lj].destroyed = true;
					doEffect(li, lj);
				}
			}
		}
	}
   ................
}
but when the ball hits a bomb brick the framework crashes.
github link

ceofil
Posts: 39
Joined: April 13th, 2017, 8:35 pm

Re: C++ Progress ish

Post by ceofil » April 28th, 2017, 8:35 pm

the problem was that it checked to see if the brick[li][lj] is in a certain range of the bomb, but the bomb itself it's in that range. so it kept calling doEffect on the bomb.
but then if two bombs are in range of each other they call doEffect on each other so i screwed the whole recursion thing and did in a less elegant way (i mean it probabably wasn't elegant before but it was by my standards).

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

Re: C++ Progress ish

Post by albinopapa » April 28th, 2017, 9:13 pm

What about checking if li and lj are equal to i and j, skip if same else process as before.
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

ceofil
Posts: 39
Joined: April 13th, 2017, 8:35 pm

Re: C++ Progress ish

Post by ceofil » April 30th, 2017, 1:36 pm

I finished the fart annoyed game but it does not feel as good as I expected to. As I added more stuff the code became more messy because I didn't put too much effort into organazing the code and it gets harded to modify stuff. So I hope I will improve on that aspect. Feel free to critique the shit out of my code and make me cry.
GitHub link

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

Re: C++ Progress ish

Post by chili » April 30th, 2017, 2:04 pm

Dude, i just checked out some of your Repos. The Snek game crashes (exits immediately) in debug. It runs fine in release config though. Pretty sweet stuff, good on your for making your own digit font.

The dodge ball game is actually pretty damn awesome, I'm impressed. It uses a lot of the skills taught in that part of the tutorials, and makes something entertaining. I like how to dude picks up the ball, nice touch there. And the safe zone. This is the kind of creativity I talk about in the videos; making something cool with limited resources. Only one complaint: why didn't you make it Doge Ball???? :D
Chili

ceofil
Posts: 39
Joined: April 13th, 2017, 8:35 pm

Re: C++ Progress ish

Post by ceofil » May 6th, 2017, 4:27 am

A few months ago when I decided I want to practice c++ and try and get good at it I was fucking around with 2048 and told myself that by the end of this year I want to be able to make this game.
Anyway. I don't think that the way I did it (with a lot of for loops) it's the right way to do it. At the beggining I tried doing someting like just two loops and when pressing up,down etc the starting and the ending values of these loops would change but I fucked up and did it with a bunch of for's. Again, feel free to critique the shit out of it and/or give suggestions.

2048 GitHub link

Post Reply