Scirra / Construct-bugs

Public bug report submissions for Construct 3 and Construct Animate. Please read the guidelines then click the 'Issues' tab to get started.
https://www.construct.net
108 stars 83 forks source link

Platform behaviour is hovering 1 pixel off solid when it jumps at the right height #5115

Open eddynardo opened 2 years ago

eddynardo commented 2 years ago

Problem description

When a player with the platform behaviour jumps on a solid and touches it at the top of their jump height, the player will hover 1 pixel off the ground for about 0.5 sec before touching the ground again.

Attach a .c3p

https://drive.google.com/file/d/1LY6SiaC-Hpd5mTQfhiGduUbSMv0PERnR/view?usp=sharing

Steps to reproduce

I made the player in the .c3p jump at the perfect time so it reproduces the problem automatically. Just hit preview layout

Observed result

Player is hovering 1 pixel off the ground and can't jump

Expected result

Player should touch the ground immediately after reaching it and be able to jump.

More details

Affected browsers/platforms: Chrome

First affected release: This happens in construct 2 also... so it must be forever I guess

System details

View details Platform information Browser: Chrome Browser version: 94.0.4606.71 Browser engine: Chromium Context: webapp Operating system: Windows Operating system version: 10 Device type: desktop Device pixel ratio: 1 Logical CPU cores: 8 Approx. device memory: 8 GB User agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36 C3 release: r260 (stable) Language setting: en-US Local storage Storage quota (approx): 67 gb Storage usage (approx): 29 mb (0%) Persistant storage: No Browser support notes This list contains missing features that are not required, but could improve performance or user experience if supported. Nothing is missing. Everything is OK! WebGL information Version string: WebGL 2.0 (OpenGL ES 3.0 Chromium) Numeric version: 2 Supports NPOT textures: yes Supports GPU profiling: yes Supports highp precision: yes Vendor: Google Inc. (Intel) Renderer: ANGLE (Intel, Intel(R) HD Graphics 4600 Direct3D11 vs_5_0 ps_5_0, D3D11-20.19.15.4624) Major performance caveat: no Maximum texture size: 16384 Point size range: 1 to 1024 Extensions: EXT_color_buffer_float EXT_color_buffer_half_float EXT_disjoint_timer_query_webgl2 EXT_float_blend EXT_texture_compression_bptc EXT_texture_compression_rgtc EXT_texture_filter_anisotropic EXT_texture_norm16 KHR_parallel_shader_compile OES_texture_float_linear WEBGL_compressed_texture_s3tc WEBGL_compressed_texture_s3tc_srgb WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL_lose_context WEBGL_multi_draw OVR_multiview2 Audio information System sample rate: 48000 Hz Output channels: 2 Output interpretation: speakers Supported decode formats: WebM Opus (audio/webm; codecs=opus) Ogg Opus (audio/ogg; codecs=opus) WebM Vorbis (audio/webm; codecs=vorbis) Ogg Vorbis (audio/ogg; codecs=vorbis) MPEG-4 AAC (audio/mp4; codecs=mp4a.40.5) MP3 (audio/mpeg) FLAC (audio/flac) PCM WAV (audio/wav; codecs=1) Supported encode formats: WebM Opus (audio/webm; codecs=opus) Video information Supported decode formats: WebM AV1 (video/webm; codecs=av01.0.00M.08) MP4 AV1 (video/mp4; codecs=av01.0.00M.08) WebM VP9 (video/webm; codecs=vp9) WebM VP8 (video/webm; codecs=vp8) Ogg Theora (video/ogg; codecs=theora) H.264 (video/mp4; codecs=avc1.42E01E) Supported encode formats: WebM VP9 (video/webm; codecs=vp9) WebM VP8 (video/webm; codecs=vp8)
AshleyScirra commented 2 years ago

Platform behavior edge-cases like this are exceptionally difficult to deal with. There have been many stretching back over the years and I suspect it may not actually be possible to cover all of them. I'll look in to this but I'd advise trying to work around it instead as I can't guarantee if or when this could be resolved.

samuelfine commented 2 years ago

Just a heads up for @eddynardo or anyone viewing this in the future, it looks like making very minor adjustments can fix this quirk. In the case of this example, simply tweaking Jump strength Platform behavior from 135 to 137 results in an immediate jump as soon as the block hits the second platform. Adjusting the Y position of the second platform by 1-2 pixels also fixes the issue.

eddynardo commented 2 years ago

@samuelfine That was the first thing I did to my game a few months ago but unfortunately this doesn't solve the problem if you are using double jumps (since you can start your second jump from any height). My main issue now is that it happens with "coyote time" (when you allow the player to jump even a few frames after they missed a platform and they start falling) since the player is a few pixels lower than the usual jump, they can easily encounter the bug and get stuck unable to jump for a few frames. I managed to make a workaround that goes like this

If (player is not on floor && player is not overlapping floor && is overlapping floor at offset (0,1)) set player position to (self.X, Self.y+1)

the problem with this is that it doesn't work on 144 hz monitor for some weird reason but there are also some other things that work differently on 144 hz so I think I will try to lock it on 60 fps and stick with the workaround for now