3d FPS Platformer help?

How do you stop a player from falling off a platform and limit the player to jumping between a set of platforms without falling off in to the game space and dying?

Would appreciate some help, very stuck atm!