In reverse time, do objects at rest fall upwards?
The direction of the gravitational force would not change under time reversal. Your object would feel a force downward, just as it does usually.
It might be easier to imagine you had a movie of an object under the influence of gravity. Drop the ball from rest some distance above the floor. You'll see it move downward and speed up. You'd interpret this as a gravitational force downward.
Then, upon playing the movie in reverse, you'll see the ball move upward with decreasing speed. This observation is still consistent with a gravitational force downward.
There is no mistake. The laws of physics themselves are reversible in time, but the solutions not necessarily so. Thus, the "behavior" of the universe itself does not show symmetry under time reversal, primarily due to the second law of thermodynamics. The second law is about the behavior of the solutions, is not a fundamental law in itself. In your specific example of the object being "repulsed" when the movie is running backwards, the physical reason is not that gravity becomes repulsive. Gravity will still be attractive. The reason why the object moves back upwards is the unlikely chance (due to the second law) that the motion of the molecules on the floor, air, and electromagnetic radiation coordinate, by chance, to push the object up (the reversal of what happens when a non-elastic object hits the ground). That is, the energy of the system, which is spread out into many particles, gets back together into a macroscopic object, a very unlikely event (but one that does not violate the laws of physics. Of course, this would be the cause in the physical world where the laws are time symmetric. In your simulation, which is not made up to microscopic detail, the reason is that the laws themselves are irreversible (the way you implemented the code).
For more details, see here and here.
One of the problems you will encounter is causality.
Imagine you have a ball resting on the ground.
Without already knowing how it behaved in the past you cannot uniquely define the next frame of your game. You cannot tell if the ball should:
- move upwards vertically.
- move upwards in any direction.
- roll on the ground towards any direction.
- do nothing.
You could use it as a part of your game design to decide which one of the above it should be.
Note that if for instance you decide that the ball must move upwards at the speed of 40 m.s^-1 in the next frame, then in the consecutive frames it must keep its direction and have a position/speed consistent with the acceleration (deceleration in reverse time) so that after 1 sec, the speed of the ball is 40 - 9.81 = 30.19 m.s^-1. Integrate speed for position in each frame.