Are tanks always more viable than mechs in a realistic scenario. Could a war within certain environments lead to construction of mech like machines? Tanks are usually simply faster and more versatile than bipedal machines, but could rocky terrain realistically effect this?
Mechs are strictly worse than tanks of comparable size. There is no environment where a mecha is going to be superior to a tank.
The upright posture makes them easier to detect and target than a tank.
A smaller contact area with the ground means that they will get bogged down in soft or unstable terrain easier.
Their upright posture makes them a less stable firing platform. The higher center of gravity makes them more likely to be knocked on their side due to driver error or impact.
A tracked vehicle is more energy efficient and less mechanically complex than a mecha.
We live in a world where man portable anti tank missiles exist. If there existed an environment where a mecha could travel it would be an easy target to any well equipped infantry group.