It’s a difficult task, but having hills is much better than having only squares. I would gladly settle for triangles. This is one of the few things that would greatly improve games. I spent about 20-30 minutes to make this little physics engine, and I can say the results are much better than I had anticipated, especially when compared to my past attempts at making hills.
Test the engine here: http://flowlab.io/game/play/290014