How far from the castle you situate your trebuchet matters for a few reasons. The closer the trebuchet, the more likely you are to hit your target. However, the opposite is also true, which is that the closer you are, the more likely it is that enemy soldiers will hit you—with an arrow.
The farther away your trebuchet, the farther you'll have to send your missile. And the farther your missile must travel, the longer the force of gravity will be pulling on its flight. To counteract gravity's steady pull, you must convey more energy to the ball. A few adjustments to your trebuchet will do this, including:
There is another solution, which is to reduce the weight of your ball as you move it farther away. A lighter ball will travel farther because there is less mass to move. However, a problem arises when this principle is taken too far. A lighter ball will hit with a weaker force than a heavier one. The result could be a stone dud that bounces harmlessly off the castle wall.