C++ Progress ish

The Partridge Family were neither partridges nor a family. Discuss.
User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: C++ Progress ish

Post by chili » July 19th, 2017, 3:01 pm

Glad you posted this, it was something I was meaning to look at after things settled down fromthe move. Hotline looks tight. Implementing the line-of-sight stuff is impressive. What the heck are those images you posted? Look cool as fuck.

You're watching all the spoiler from the old series. Bad Ceo! Bad! XD

Good on you again for taking the initiative and coming up with your own sprite rasterization effects. If you like that shit, you're gonna live pixel shaders.

Nice job on the I6 homework as well. How did you like this style of homework challenge?
Chili

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

Re: C++ Progress ish

Post by ceofil » July 20th, 2017, 3:18 pm

To see if the tracking works properly I put this in the drawing function for enemies:
Spoiler:

Code: Select all

for (int i = 0; i < indexTrackingPoints; i++)
{
	gfx.DrawCircle(trackingPoints[i], 5.0f, Colors::Magenta);
	if (i < indexTrackingPoints - 1)
	{
		gfx.DrawLine(trackingPoints[i], trackingPoints[i+1], Colors::White);
	}
}
And if the enemies have the right amount of delay between them the tracking points spawn very nicely one after another and it forms some dna-looking stuff.

I really enjoy every homework so I don't know what to say. This time was nice that it had tests already implemented and that memory leak detection thing so you know if you fucked something up.

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

Re: C++ Progress ish

Post by ceofil » August 2nd, 2017, 2:14 pm

original game

github link

exe
Spoiler:
zigzag.rar
(8.94 MiB) Downloaded 135 times
extract this into the zigzag folder ( because of the 10MiB per attachment thing )
menuMusic.rar
(3.66 MiB) Downloaded 146 times
screenshots
Spoiler:
Image
Image

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

Re: C++ Progress ish

Post by albinopapa » August 2nd, 2017, 4:23 pm

Code looks super slick. My son loves the dancing lines game ( just like zig-zag ). Are you going to be adding more levels and music?
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

goldengamesTM

Re: C++ Progress ish

Post by goldengamesTM » August 4th, 2017, 6:56 pm

How Did You Get The Tank Rotation?

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

Re: C++ Progress ish

Post by ceofil » August 5th, 2017, 10:53 am

albinopapa wrote:Code looks super slick. My son loves the dancing lines game ( just like zig-zag ). Are you going to be adding more levels and music?
Just watched 20 minutes of Dancing Line gameplay...such a lovely game.
I think I'm gonna leave zigzag as it is for now. Maybe, in the future, I'll make it so the path fits any song automatically, so you can play with any song you want.

goldengamesTM wrote:How Did You Get The Tank Rotation?
Converting Vec2 to a float angle, doing things to that float, and converting back.
You can find the functions here at line 132 and 177.
or here
Spoiler:

Code: Select all

void Enemy::RotateToward(float wantedAngle, float dt)
{
	if (int((wantedAngle - angle) + 360) % 360 > 180)
	{
		angle -= rotationSpeed * dt;
	}
	else
	{
		angle += rotationSpeed * dt;
	}
	NormalizeAngle(angle);
	enemy.SetDir(AngleToVec2(angle));
}

Code: Select all

Vec2 Enemy::AngleToVec2(float angle)
{
	const float cos = std::cos(angle * pi / 180.0f);
	const float sin = std::sin(angle * pi / 180.0f);
	return Vec2(cos, -sin); 
}

Code: Select all

float Enemy::Vec2ToAngle(Vec2 vec)
{
	vec.Normalize();
	float angle = -asin(vec.y) * 180.0f / pi;

	if (vec.x > 0) return angle;
	else return 180.0f - angle;
}

for the tanks game is simpler because there is no AI

Code: Select all


	if (kbd.KeyIsPressed(left))
	{
		angle += rotationSpeed * dt;
		dir = AngleToVec2(angle);
	}
	else if (kbd.KeyIsPressed(right))
	{
		angle -= rotationSpeed * dt;
		dir = AngleToVec2(angle);
	}

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

Re: C++ Progress ish

Post by ceofil » September 1st, 2017, 6:58 pm

Image

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

Re: C++ Progress ish

Post by albinopapa » September 1st, 2017, 8:38 pm

Hmm, and then?
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
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: C++ Progress ish

Post by chili » September 2nd, 2017, 8:17 am

And then the GPU melted.
Chili

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

Re: C++ Progress ish

Post by albinopapa » September 2nd, 2017, 6:23 pm

NNNNNNNNNOOOOOOOOOOOOOOOOOOOOOO!!!!!!!!!!!!!!!!!!!!!!!!!!!
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