Page 2 of 2

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

Posted: June 21st, 2017, 5:05 pm
by xu2201g
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/

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

Posted: June 22nd, 2017, 12:03 pm
by Naewulf
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.

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

Posted: June 22nd, 2017, 4:33 pm
by Battlefrog
Delete for the jump button? Seems odd.

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

Posted: June 22nd, 2017, 7:51 pm
by Naewulf
Battlefrog wrote:Delete for the jump button? Seems odd.
it's easier to pretend i'm working. xD

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

Posted: June 22nd, 2017, 7:58 pm
by Naewulf
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!

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

Posted: June 23rd, 2017, 11:56 pm
by xu2201g
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?

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

Posted: June 25th, 2017, 5:50 pm
by Naewulf
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.

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

Posted: July 1st, 2017, 5:07 am
by chili
This shit is mesmerizing. Sweet stuff.

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