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
107 stars 83 forks source link

Player can snap outside the layout with 8Direction, Solid and Wrap behaviours together #6274

Closed williamcdubois closed 1 year ago

williamcdubois commented 1 year ago

Problem description

With the behaviours Solid, Wrap, ScrollTo and 8Direction, when snapping the head on the wall on top, if doing it while pressing the left arrow, instead of normally wrap, the player can noclip out of the layout if my walls don't have higher width than layout width. In the other case, will get stuck by an invisible force.

Attach a .c3p

Download link from my Google Drive https://drive.google.com/file/d/1MwhcFIxJFBfwbAMAmFrlmAVt8-2cKpAY/view?usp=share_link

Steps to reproduce

Test No.1

  1. With the keyboard arrows, move up to stick the player's head on the wall above the player.
  2. While never stopping touching the same wall, move to the left to trigger the Wrap behaviour.
  3. Going to the left is fine, but then going back to the right to Wrap again, will get stuck between the frontiers of the Wrap.

Test No.2

  1. Adjust the size of both Tiled_wall_1 to get the same width as the layout (same 0,0).
  2. With the keyboard arrows, move up to stick the player's head on the wall above the player.
  3. While never stopping touching the same wall, move to the left to trigger the Wrap behaviour.
  4. Magic, you are outside the layout by noclip between the Wrap frontiers.
  5. I don't know how to go back into the layout there, so reset the preview, I guess, for more testing.

Observed result

After the recent update, the Solid and 8Direction with Allow sliding on caused some speed issues (getting a tiny faster than my max speed value somehow).

As long as the Wrap behaviour is not triggered, the player can easily leave the layout if safety walls are not added.

If safety walls are added but get stuck by the Solid behaviours at the frontiers of the Wrap behaviour.

Expected result

The player should still have his head stick on the wall but nicely translated to the other side by the Wrap behaviour.

More details

The left click enables the full-screen mode on PC when the code is made with a Touch object for mobile, which is not theoretically possible.

Normally I removed the third plugins so you can test it without them (happening also without third-party plugins). If still asking them, I will add a link here asap for them.

Affected browsers/platforms:

Happening on Google Chrome on Windows 10.

Construct 3 Editor is broken on my latest version of Firefox anyway for a few days, so I can't verify on Firefox: firefox_zdi3EXu92n

Construct 3 is not usable on my Opera GX anyway for a while (bug report closed by staff for "can't reproduce"), so can't test there either: opera_BnE6KEbQvz

First affected release:

Construct 3 r317.2 (stable)

System details

View details Platform information Product: Construct 3 r317.2 (stable) Browser: Chrome 107.0.5304.107 Browser engine: Chromium Context: browser Operating system: Windows 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/107.0.0.0 Safari/537.36 Language setting: en-US Local storage Storage quota (approx): 536 gb Storage usage (approx): 103 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. (NVIDIA) Renderer: ANGLE (NVIDIA, NVIDIA GeForce GTX 1050 Ti Direct3D11 vs_5_0 ps_5_0, D3D11) 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_draw_buffers_indexed 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.265 (video/mp4; codecs=hev1.1.2.L93.B0) H.264 (video/mp4; codecs=avc1.42E01E) Supported encode formats: WebM VP9 (video/webm; codecs=vp9) WebM VP8 (video/webm; codecs=vp8)
AshleyScirra commented 1 year ago

I think this is a problem with your level design, rather than specifically being to do with Construct. Both issues are fixed if you extend the Tiled_wall_1 objects at the top and bottom to extend further outside the layout.

I think what is happening is those barriers end pretty much at the edge of the layout, and with "allow sliding" on 8 direction, the player can start to slide upwards past the edge of the barrier before it wraps. That means when it does wrap, it's already overlapping the barrier at the other side, which blocks the movement, so it either immediately wraps back again or gets stuck. By extending the barriers further you prevent the player sliding upwards, and the wrapping works fine.

I don't think that's Construct doing anything wrong really, it's just a consequence of the level design - the barriers need to extend further to prevent the player being able to move slightly upwards before the wrapping happens.

williamcdubois commented 1 year ago

I tried like you said to make the walls wider and you were right, it was the solution. Thanks!