[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
Chipmunk Physics • View topic - Best practice for game movement

Best practice for game movement

Official forum for the .

Best practice for game movement

Postby HunterZolomon » Fri Jun 13, 2014 8:09 am

Hi all, I just joined and I'm new here and to Chipmunk. I'm currently working on a little game project where I want to use Chipmunk.js + Pixi.js for a WebGL rendered javascript game. So far it's working great, Chipmunk has been very easy to implement. I have a few noob questions though:

1. Is there any best practice when it comes to movement in games? I'm not using gravity but I need to have some kind of friction or dampening to the players character in the Chipmunk space. What I need to do is apply a motion vector (with speed constraints) to the player body and have that fall off once the user lets go of a directional pad. I can think of a few ways, but this is the first time I use a proper physics engine so I'd appreciate if anyone could give me any pointers to what is best practice when atttempting this kind of functionality. Applyforce with some kind of deceleration?

2. I'm building the game world with tiles constructed from segments. Sometimes the segments connect from tile to tile to form one long line and when the body is touching that line while moving it will sometimes "bump" where the segments connect. I know this is a common physics engine issue, but is there a good workaround in Chipmunk?
I currently use the segment radius function and it helps quite a bit. But since you need to compensate for the radius padding the solution doesn't feel very elegant. Neither do I want to go through the world (it's quite large) and replace the segments that align with one segment since performance tweaks will be a bit more tricky when segments are shared between tiles. Any thoughts?

Lastly, thank you for a great physics engine! Even though I'm just getting into Chipmunk it feels like a solid choice.
HunterZolomon
 
Posts: 4
Joined: Fri Jun 13, 2014 7:15 am

Re: Best practice for game movement

Postby maximile » Tue Jul 01, 2014 8:20 am

Surface velocity tends to be handy for player movement. You can see how we did it in a small project here:

https://github.com/maximile/Your-Story/ ... haracter.m

(Look at playerUpdateVelocity. In action: https://www.youtube.com/watch?v=AHaOfBp-raY )

Unfortunately, I think merging the collision shapes is the only way to go for eliminating the bumps. This might be sorted in a future release, see here: http://howlingmoonsoftware.com/wordpres ... pmunk-6-2/
maximile
 
Posts: 157
Joined: Mon Aug 20, 2007 12:53 pm
Location: London, UK

Re: Best practice for game movement

Postby HunterZolomon » Wed Jul 02, 2014 6:42 pm

Most appreciated, thanks! I'll have a look at your links and see what I can discover :)
HunterZolomon
 
Posts: 4
Joined: Fri Jun 13, 2014 7:15 am


Return to Chipmunk2D Physics

Who is online

Users browsing this forum: No registered users and 1 guest