If a building foundation sits on soft or filled-in soil, the whole building may fail in an earthquake regardless of the advanced engineering techniques employed. Assuming, however that the soil beneath a structure is firm and solid, engineers can greatly improve how the building foundation system will respond to seismic waves.
Another solution refers to base isolation which involves floating a building above its foundation on a system of bearings, springs or padded cylinders.