Thanks for the suggestions so far, guys. I know for sure that I'm anchoring directly to the studs, since we own the house and plan to live in it for ~10 years; however, I still want it to be somewhat modular so I can remove it mostly intact when we do move. I was originally thinking of using shelf brackets to support the layout, but they may not be rigid enough to suit me, so I think I'll end up using the sort of support that kenw mentioned. I think at some point I want staging about 6-8" below the layout, but I might be killing myself to try to include all that from the beginning, on the other hand if I don't plan for it now, it will be a royal PITA to add later. I want the staging because I'm modelling a busy mainline, and I want continous running, but I also want to be able to run a series of different trains around the mainline and need someplace to park them other than my main town's relatively small yard.
I was originally thinking of going with the 2" foam, but from my yard, one line goes uphill and the other goes downhill, and I was thinking it would be a lot of work to build up the foam to the desired height and then cut into it for the road bed and surrounding scenery. How hard is it to work with and shape this stuff?
Lots of stuff I'm still trying to figure out on paper before I start building, like a rough track plan etc....