# Tagged Questions

Relating to the motion of objects through space and time. Including concepts such as acceleration (thrust and gravity), mass, collision response, friction and more.

68k views

### When should I use a fixed or variable time step?

Should a game loop be based on fixed or variable time steps? Is one always superior, or does the right choice vary by game? Variable time step Physics updates are passed a "time elapsed since last ...
36k views

### Good 2D Platformer Physics [closed]

I have a basic character controller set up for a 2D platformer with Box2D, and I'm starting to tweak it to try to make it feel good. Physics engines have a lot of knobs to tweak, and it's not clear to ...
17k views

### How do I create 2D water with dynamic waves?

New Super Mario Bros has really cool 2D water that I'd like to learn how to create. Here's a video showing it. An illustrative part: Things hitting the water create waves. There are also constant "...
7k views

### 2D Platformer AABB collision problems

I have a problem with AABB collision resolution. I resolve AABB intersection by resolving the X axis first, then the Y axis. This is done to prevent this bug: http://i.stack.imgur.com/NLg4j.png ...
2k views

### How to determine which thrusters to turn on to rotate the ship?

The configuration of the ship changes dynamically, so I have to determine which thruster to turn on when I want to rotate the ship clockwise or counter clockwise. The thrusters are always axis aligned ...
10k views

### Analysis of Mario game Physics [closed]

I know there's a breakdown of Sonic the Hedgehog physics found here, and I was wondering, does there exist a breakdown of any of the Mario games? Something similar to this but for Mario is what I'm ...
8k views

### How can I give the illusion of height to a ball in 2D?

In 2D top down soccer games, sometimes a ball is given the illusion of being in the air, like below: How can I achieve this?
8k views

### Why do we use the Pythagorean theorem in game physics?

I've recently learned that we use Pythagorean theorem a lot in our physics calculations and I'm afraid I don't really get the point. Here's an example from a book to make sure an object doesn't ...
7k views

### Water/Ocean simulation and physics

I'm looking for some references about water simulation, and how to model it's interaction with bodies (like boats, ships, submarines). I've found a lot of references on the visual aspects of water (...
3k views

### Movement prediction for non-shooters

I'm working on an isometric 2D game with moderate-scale multiplayer, approximately 20-30 players connected at once to a persistent server. I've had some difficulty getting a good movement prediction ...
12k views

### About floating point precision and why do we still use it

Floating point has always been troublesome for precision on large worlds. This article explains behind-the-scenes and offers the obvious alternative - fixed point numbers. Some facts are really ...
3k views

### Calculating the rotational force of a 2D sprite

I am wondering if someone has an elegant way of calculating the following scenario. I have an object of (n) number of squares, random shapes, but we will pretend they are all rectangles. We are ...
6k views

### Do 2D games have a future? [closed]

I'm currently working on a 2D soft-body physics engine (since none exist right now -_-), but I'm worried that there's no point to spending what will most likely be years on it. Although I love ...
37k views

### How can I implement gravity?

How can I implement gravity? Not for a particular language, just pseudocode...
6k views

### Implementing a wrapping wire (like the Worms Ninja Rope) in a 2D physics engine

I've been trying out some rope-physics recently, and I've found that the "standard" solution - making a rope from a series of objects strung together with springs or joints - is unsatisfying. ...
2k views

### How'd they do it: Destructible environments in BF:BC2 and BF3

How did the folks at Dice create the destructible environments in the more recent Battlefield games? Did they just assemble the buildings out of predefined sub-regions that break apart when there is ...
5k views

### How do I make a character capable of walking on walls?

I am trying to get a character to move like a spider: Given a rising slope which a ball would normally not be able to roll up, the spider would slowly crawl up. Similarly, given a mid-air rectangular ...
9k views

### Lag compensation with networked 2D games

I want to make a 2D game that is basically a physics driven sandbox / activity game. There is something I really do not understand though. From research, it seems like updates from the server should ...
33k views

### How to make a character jump?

I am currently making a game in C# using Direct X 9.0. The game remake is Donkey Kong NES. I have nearly everything completed, but I am having problems with the physics of Mario's jump. I have ...
4k views

### Simulating pressure in a grid based liquid simulation

I have a 2D grid based water system in my XNA game, we have a method using cellular automata to simulate water falling and spreading. Example of water flowing down a slope: Each tile can contain a ...
2k views

I'm building a space exploration game and I've currently started working on gravity ( In C# with XNA). The gravity still needs tweaking, but before I can do that, I need to address some performance ...
2k views

### What is the point of “delta” in this code? Does it reflect a standard thing in game dev?

I know very little about game programming but would like to learn more. I am trying to understand the code for this game. I am trying to understand why the code is passing a "delta" to Shipcontrols.js,...
5k views

### Pros and cons of different integrators [closed]

When creating things like physics in games you need an integrator. I've seen Verlet integration mentioned several places as a great alternative to Euler integration. For instance in the famous ...
3k views

### Optimizing gravity calculations

I've got a bunch of objects of varying size and velocity which gravitate towards each other. On every update, I have to go over every object and add up the forces due to gravity of every other object. ...
2k views

### How can I Intercept object with a circular motion

I am creating a 2d space game and need to make the spaceship intercept a planet. I have working code for straight line intercepts but cannot figure out how to calculate the planets location in a ...
3k views

### Momentum and order of update problems in my physics engine

This question is a "follow-up" question from my previous one, regarding collision detection and resolution, which you can find here. If you don't want to read the previous question, here's a brief ...
1k views

### Correctly Implementing a “Double Jump”

I'm working on a 2D iPhone game using Corona (Trial version, so I can't use their forums). The game involves the character falling through the sky, and I'm trying to implement a "double jump" for the ...
5k views

### How to deal with corner collisions in 2D?

I'm writing a top down 2d XNA game. Since its my first I'm trying to write the physics and collision stuff myself to learn it. Whenever my player sprite character attempts to move into a position ...
2k views

### How does one avoid the “staircase effect” in pixel art motion?

I am rendering sprites at exact pixel coordinates to avoid the blurring effect caused by antialiasing (the sprites are pixel-art and would look awful if filtered). However, since the movement of the ...
8k views

### Is there a 2d physics engine that can model fluids and gases? [closed]

At this point the platform and programming language don't matter I would just like to know if something out there exists for this. Any help is appreciated.
1k views

### Data structures for interpolation and threading?

I've been dealing with some frame-rate jittering issues with my game lately, and it seems that the best solution would be the one suggested by Glenn Fiedler (Gaffer on Games) in the classic Fix Your ...
32k views

### In Pong, how do you calculate the ball's direction when it bounces off the paddle?

I'm trying to wrap my head around this very Hello World-y problem in game development. I've created a TicTacToe game in XNA so I guess the next step would be a Breakout clone. Keep in mind that I ...
3k views

### How can I create a stretchy, breakable pizza cheese material?

I want to create realistic pizza and allow user interact with it. What I want: What I created: I created model of the pizza (8 pieces) in Blender, then imported it into Unity. The piece of ...
10k views

### Quad tree vs Grid based collision detection

I'm making a 4 player co-op r-type game, and I'm about to implement the collision detection code. I've read a lot of articles and stuff about how to handle collision detection, but I'm having a hard ...
12k views

### How do I build a 2D physics engine? [closed]

The most advanced games I've made are a 8-ball pool game made with the physics engine Box2dFlashAS3 and a platform game with levels. When I did platform games, I've always wished to know how to make ...
6k views

### Why is RK4 better than Euler integration?

At the end of these great slides, the author compares all the different integrators presented. One way or another, they all fall short except for Improved Euler Integration and Runge Kutta 4 ...
2k views

### AI control for a ship with physics model

I am looking for ideas how to implement following in 2D space. Unfortunately I don't know much about AI/path finding/autonomous control yet. Let's say this ship can move freely but it has mass and ...
11k views

### What is a good book on physics for game development? [closed]

I'm looking for a good beginners' book on the subject of physics in game development. Something that focuses on 2D games would be preferable.
4k views

### How are physics or graphics components typically built in a component-oriented system?

I have spent the last 48 hours reading up on Object Component systems, and feel I am ready enough to start implementing it. I got the base Object and Component classes created, but now that I need to ...
4k views

### Ideas for 2D Water Simulation

I am looking for any input on simulating water in 2D, against a rather large (call it) blocked/not blocked array (viewed from the side). I have come up with the following ideas: Cell Automata Do a ...
761 views

### Recreating retro/NES style physics with intentional imprecision

Background: I'm having a problem getting the jump curve correct for a retro platformer remake project of mine. The original game is for the NES, and the player's velocity is stored in two separate ...
8k views

### 2D Planet Gravity

I'm trying to make a simple game where a spaceship is launched and then its path is effected by the gravity of planets. Similar to this game: http://sciencenetlinks.com/interactives/gravity.html I ...
652 views

### Solids as high viscocity Liquids

A friend of mine and I were discussing different idea for allow materials in a world to be destroyed in a very piecemeal fashion and he proposed the idea of representing solids as very viscious fluids....
4k views

### How do I handle moving platforms in a platform game?

I don't want to use box2d or anything, I just want simple moving platforms (up-down, left-right, diagonal and circular paths). My question is to handle the update order / control hierarchy so that the ...
2k views

### How could you parallelise a 2D boids simulation

How could you program a 2D boids simulation in such a way that it could use processing power from different sources (clusters, gpu). In the above example, the non-coloured particles move around ...
3k views

### Where to start for implementing vehicle physics? [closed]

A little background for myself. I am relatively experienced with 3rd part physics engines such as Havok, Box2D, Bullet and have successfully integrated them in custom engine(s). I have also made a ...
3k views

### How do I calculate rotation caused by bounce friction?

Following on from my previous question: I have the ball quite realistically bouncing from surfaces it hits. Now I'd like to make it spin from the friction of the hit. Showing this is simple enough: I ...
3k views

### Any fixed-point portable open-source 3D physics engines?

I'm looking for a fixed-point 3D physics engine (basic kynematics and collision detection-resolution... nothing too fancy.) I need fixed-point math because I'd like to have deterministic results, for ...