Check "c_move(ENTITY* entity,VECTOR* reldist,VECTOR* absdist,var mode) " code in the manual.
Also, this: "Gamestudio Physics - Frequently Asked Questions" in the manual.

In a nutshell, players and NPCs use c_move and c_trace to simulate gravity and movement, there's a code equation for that, and the internal phisics engine simulates realistic collisions, but only between rigid bodies (the models won't animate or morph).
Usually, the same "funtion gravity()" is shared by all NPCs and stuff that needs to fall on the ground.