[Game Development] Building System with Terraforming

Hey guys,

I want to make a little game, in which the player can build.
First of, I’m not sure yet weather to do a Building System (BS) on a grid or a free one. Neither I’m sure, weather to allow the player to build freely or “just” place pre-defined buildings.
Maybe you can give me some suggestions, and furthermore, maybe some of you guys can teach me some of the code behind those BSs.