Hi, sorry if i’m writing this in bullet points instead of usual ‘human-like’ paragraph (cuz i don’t really know how to deliver my message best). Anyway, here, we go.
Problem:
- Player jitters when ‘getting into’/moving into corners.
- Player can jump from the wall (basically, doing wall jump). (no, i don’t want this feature)
- Tunneling when jumping from a really high place
What i’ve tried:
- Checking the documentation on ( Resolving kinematic collision in Defold ) ← i started out with this, ( Platformer Defold Tutorial ) ← I tried upgrading into this (i assume this cover for slope?).
- Tried playing this ( Github | pixel-line-platformer-defold) and saw the player.script within (i assume this doesn’t cover for slope?).
- Looking into this ( From jittery to smooth: A practical guide for physics games ) but, i assume this is mostly for dynamic-heavy physics?
What I want:
- Just to fix the corner jitter, wall jump and tunneling
Current game state
- Just a protoype, pretty much just beginning doing things
- Plan on heavy bullet hell platformer (not too fast, and parryable by player)
- May not even release this game, just wanna practice
What must be kept:
- The keyboard inside my input has no ‘action.pressed’ (intentional), cuz i want continous jumping while it is being held down.
- Speed & gravity (yes, the platformer i planned on is something like a bullet-hell combination with high-speed movement)
- (optional) Although my game won’t be introducing slopes currently, I want my collision handler able to handle slopes (for future games)
Additional notes:
- No, i don’t use AI to write this forum (if you care) however, i do refer to Gemini to help resolving the problem, and no, the problem still persists.
- I’m not really a super-beginner (somewhat intermediate) , just never really make my own ‘first game’
- I came from Love2D background with a little bit of Unity (this was about 2 years ago, so yeah, you guys can ignore this)
Technical notes (refer gamefile):
- I have “fall_vel_cap” to prevent vertical tunneling, but it doesn’t work?
- I thought about putting NORMAL_JITTER_TRESHOLD thinking it would fix the jitter by “refixing” the normal into a 0 and avoid floating value (snap into pure x/y-axis). (referenced from pixel-line-platformer) but I think this would prevent slope handling latter in the future.
- I tried updating go.set_position both in update(+ velocity) and on_message(+ self.correction). I assume this would be correct since other example just update the GO position within on_message? Idk if i should change into fixed update or anything?
- I did tilemap collision refering to this ( Tilemap Collision | Defold)
My Game:
- My_Game.zip (77.9 KB) (Don’t mind the game name)
What I plan on doing:
- ( Struggling with kinematic physics ghosting collisions and jittering ) Idk much about this ‘raycast’ thingy, but, this forum might worth a try. However, i assume I’ll have to change the way i handle collision then.
Anyway, thank you for reading, and any comment or help is welcome. (Not sure if I got the time to instantly reply tho)
* the forum limit the link only for 5, so, just assume the thin inside parenthesis was the topic i searched on Defold’s official documentation.
UPDATE:
- RaycastLearning.zip (82.9 KB) I followed Sebastian Lague code of Unity’s kinematic platformer. And at “most basic” this is the result i got (which, im SUPER satisfied with as it can handle bullet speed).
Note that I separate player’s control (player.script) away from raycast handling (utils/controller_2d.lua). The collision of my tilemap(and tilesource) are both grouped as “solid”. With my player hitbox grouped as “player” (not really needed tho, cuz raycast was the one handling the collision).
I’ll just leave this .zip here for any beginner(including myself) wanting to learn raycast collision with Defold API. Also, this basic code is only basic at most, so, don’t expect any moving platform or slope handling.
And, if you’re wondering, yes, I used AI (for anyone’s concern) to code this one(with some adjustment and tinkering). So if any of you don’t get what a certain line does, just ask AI. I’m too lazy to put detailed comments.
Well, all in all, feel free to refer this basic starting code of mine. If you want something advance, I recommend checking out “Defold’s Platypus”. - I tried doing this “high-speed” platformer test with dynamic body for the player, and adjusting it’s velocity. But, even after adjusting the body’s restitution, mass, and game.project’s gravity; the player keep on “jitter bouncing”.
I assume it has something to do with how I setup the tilemap’s collision? (It’s grid-based, although, not that I know if tilemap hitboxes get stitched together) - Do check out this forum (Discussion: Ideal Collision Algorithm), as the idea of Parallelogram Raycasting sounded very robust.