My 2D platformer shit so far...

The Partridge Family were neither partridges nor a family. Discuss.
xu2201g
Posts: 33
Joined: April 19th, 2017, 12:49 pm
Location: Germany

Re: My 2D platformer shit so far...

Post by xu2201g » June 21st, 2017, 5:05 pm

Thanks for posting your code. I didnt found a solution for the problem yet, but i get the effect even in bullet time and it increases with growing speedMultiplier.

Code: Select all

void Game::Update()
{
	if (wnd.kbd.KeyIsPressed(VK_SHIFT))
		speedMultiplier = .1f;
	else
		speedMultiplier = 1.0f;

	player.Update(timer.MarkTime() * speedMultiplier, map);
}
Im not sure but i think the framerate/update rate respectively the timesteps causes this effect.

Here is a good article imho about different approaches of updating your game:
http://gafferongames.com/game-physics/f ... -timestep/

User avatar
Naewulf
Posts: 10
Joined: June 19th, 2017, 5:01 pm
Location: Brazil

Re: My 2D platformer shit so far...

Post by Naewulf » June 22nd, 2017, 12:03 pm

xu2201g wrote:Thanks for posting your code. I didnt found a solution for the problem yet, but i get the effect even in bullet time and it increases with growing speedMultiplier.

Code: Select all

void Game::Update()
{
	if (wnd.kbd.KeyIsPressed(VK_SHIFT))
		speedMultiplier = .1f;
	else
		speedMultiplier = 1.0f;

	player.Update(timer.MarkTime() * speedMultiplier, map);
}
Im not sure but i think the framerate/update rate respectively the timesteps causes this effect.

Here is a good article imho about different approaches of updating your game:
http://gafferongames.com/game-physics/f ... -timestep/
Oh... thanks bro, gonna check that out. I have removed the files from the git because I'm going to try some other things here, including what's described in that link you provided.

TryBane from discord helped me out yesterday and he found out that what was fkn up the jump is the float rounding, so i did some tests and figured that even the small difference between one jump and the other out of the bullet time mode is gone after you round elapsedTime to 2 decimal places.

Now what I'm going to try is instead of allowing the boost for 0.2s, i will allow it for like 200px or so, and rely less possible on the float type... If you want I can reupload my files, but you already have a copy in case you want to mess with it, right?

If you need me to upload them again just say the word.

User avatar
Battlefrog
Posts: 69
Joined: March 31st, 2015, 10:10 pm
Location: Florida, United States of America

Re: My 2D platformer shit so far...

Post by Battlefrog » June 22nd, 2017, 4:33 pm

Delete for the jump button? Seems odd.
Broc W.

Sole Member of Sledgehog Software, trademark and LLC status pending.

User avatar
Naewulf
Posts: 10
Joined: June 19th, 2017, 5:01 pm
Location: Brazil

Re: My 2D platformer shit so far...

Post by Naewulf » June 22nd, 2017, 7:51 pm

Battlefrog wrote:Delete for the jump button? Seems odd.
it's easier to pretend i'm working. xD

User avatar
Naewulf
Posts: 10
Joined: June 19th, 2017, 5:01 pm
Location: Brazil

Re: My 2D platformer shit so far...

Post by Naewulf » June 22nd, 2017, 7:58 pm

xu2201g wrote:Thanks for posting your code. I didnt found a solution for the problem yet, but i get the effect even in bullet time and it increases with growing speedMultiplier.

Code: Select all

void Game::Update()
{
	if (wnd.kbd.KeyIsPressed(VK_SHIFT))
		speedMultiplier = .1f;
	else
		speedMultiplier = 1.0f;

	player.Update(timer.MarkTime() * speedMultiplier, map);
}
Im not sure but i think the framerate/update rate respectively the timesteps causes this effect.

Here is a good article imho about different approaches of updating your game:
http://gafferongames.com/game-physics/f ... -timestep/
Fixed the jumping issue. Thanks for the link bro!

xu2201g
Posts: 33
Joined: April 19th, 2017, 12:49 pm
Location: Germany

Re: My 2D platformer shit so far...

Post by xu2201g » June 23rd, 2017, 11:56 pm

No problem :)
Naewulf wrote: Now what I'm going to try is instead of allowing the boost for 0.2s, i will allow it for like 200px or so, and rely less possible on the float type... If you want I can reupload my files, but you already have a copy in case you want to mess with it, right?
You fixed the issue by that or how did you solve it?

User avatar
Naewulf
Posts: 10
Joined: June 19th, 2017, 5:01 pm
Location: Brazil

Re: My 2D platformer shit so far...

Post by Naewulf » June 25th, 2017, 5:50 pm

xu2201g wrote:No problem :)
Naewulf wrote: Now what I'm going to try is instead of allowing the boost for 0.2s, i will allow it for like 200px or so, and rely less possible on the float type... If you want I can reupload my files, but you already have a copy in case you want to mess with it, right?
You fixed the issue by that or how did you solve it?
basically the problem was the float and rounding. so instead of using a float to represent the time the button could stay pressed and sum it every loop to see if enough time passed, i started to control the max height he could reach while keeping that button pressed. that way every time the player goes out of full boost its always the same speed (different from when i controlled the time instead of height) no matter what so the jump has always the same max height on full boost.

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

Re: My 2D platformer shit so far...

Post by chili » July 1st, 2017, 5:07 am

This shit is mesmerizing. Sweet stuff.

The curves are so smooth and sexy. I'm all out of Kleenex.
Chili

Post Reply