Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

880080 Posts in 33019 Topics- by 24386 Members - Latest Member: tu3sday

May 25, 2013, 05:17:54 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)Clever way of handling moving platforms in a platform game
Pages: [1]
Print
Author Topic: Clever way of handling moving platforms in a platform game  (Read 319 times)
ThemsAllTook
Moderator
Level 8
******


Alex Diener


View Profile WWW
« on: June 15, 2012, 10:27:27 AM »

Something I saw on Twitter (thanks @NoelFB!) that I thought was good enough to repost here. I've struggled with this problem before, and this solution is so clean and simple that I'm kicking myself for not having thought of it: http://gamedev.stackexchange.com/questions/3964/how-do-i-handle-moving-platforms-in-a-platform-game/3967#3967
Logged
Raptor85
Level 2
**

126746725
View Profile WWW Email
« Reply #1 on: June 16, 2012, 04:00:36 AM »

that's one way to do it, seems somewhat of a variation of how engines like the unreal engine handle it, though not storing position relative to the parent node, just attaching to it as a base for your velocity.

I do a somewhat similar method, create a collision list when objects collide with each other, then anything that adds velocity (simple movement, jumping, etc) is tested against the list to see how it should be modified, this lets you do things like have elevators that lift you up and a piston that pushes you off up top, i've used a variation of this "simple" physics engine for any platfomer type test i've done since I first came up with it as a solution while making my entry for QJ.net's 2008 "PSP Summer Homebrew" contest as it's simple but effective, far simpler than using a full physics engine or just doing simple "bump" collision like I used to (which makes stuff like elevators and moving platforms jittery)
can toy with it here to see how it works if you have a homebrew enabled psp https://www.midnightfragfest.com/psp-engine-test/

Logged

cross-platform rapid development game engine
Currently running a kickstarter to fund development of Aether
Aloshi
Level 2
**



View Profile
« Reply #2 on: June 16, 2012, 07:16:34 AM »

A while back I tried adding moving platforms into Torque 3D, and did a variation of this - all objects kept a list of children, and when a player stood on an object it added itself to the object's children list. Then, whenever the object's position changed, I calculated how much it moved from where it was and added that difference to the children's positions. It wasn't physically correct, but it worked well for what I was making (since not all objects have velocity, but they do have position).
Logged
InfiniteStateMachine
Level 10
*****



View Profile WWW Email
« Reply #3 on: June 16, 2012, 03:50:44 PM »

hmm that's pretty interesting. Actually seems so simple too. I was kind of bracing myself for dealing that issue if i ever work on a platformer.

I kind of have something like that in one of my frameworks now. The difference is it's just a parent/child system built into the object itself. The child gets whatever motion its parent has. I use it for a shmup with no complex collisions though (mostly for smaller items that follow the player).
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic