IT was planned with military precision, with rail and road contingencies to help funnel tens of thousands of people into ­Stirling for one of country's biggest weekend festivals.

The Ministry of Defence had been called in to help with the logistics of the double celebration of Armed Forces Day and the 700th anniversary of the Battle of Bannockburn, but despite extra trains, shuttle services and ­satellite parking positions being set up, visitors were still warned over traffic chaos.

About 40,000 are expected at Stirling Council's free Armed Forces Day and by yesterday 13,000 of the 25,000 Bannockburn Live event tickets had been sold, with organisers VisitScotland saying booking had reached targets and that many were expected to pay on the day. ­Dignitaries include the Prime Minister David Cameron and First Minister Alex Salmond.

Visitors are being urged to use public transport, to help prevent the city coming to a halt, with limited car parking available.

The call came yesterday as the countdown continued for Armed Forces Day, a celebration of Britain's servicemen and women which takes place today when crowds will be entertained by aerobatics from the world-famous Red Arrows, a parachute display and demonstrations by Typhoon and Tornado jets.

It comes on the same weekend the country marks the 700th anniversary of the Battle of Bannockburn with re-enactments of the legendary clash that saw Robert the Bruce defeat the English army led by Edward II in 1314.

More than 300 "warriors" will perform in scenes choreographed by the team behind the battle sequences in hit films Gladiator and Robin Hood, and visitors will have the chance to trace their ancestral roots.

The festivities began last night with Pipefest, when pipe bands, clans and Highland dancers joined a parade from the gates of Stirling Castle through the city.

The National Trust for Scotland and Historic Scotland have been working for months to transform the Bannockburn site ahead of the 700th anniversary celebrations, but the budget had to be scaled back by £300,000 off the original £950,000 after poor early ticket sales.

Historic monuments have been restored and the £9 million new visitor centre has welcomed thousands of visitors since opening earlier this year.

Visitors to Bannockburn Live will get the chance to see armour and swords being made in a blacksmiths and watch as men are "treated" in hospital as they come off the battlefield.

VisitScotland chairman Mike Cantlay said: "Never before has this stunning city hosted as many tourists from all over the world and it really is Stirling's time to shine."

Armed Forces Day was established in 2009 to celebrate the contribution of Britain's servicemen and women and their families across the Army, Navy and RAF. It was held in Edinburgh in 2011. The estimated cost of hosting the event is about £524,000, but organisers suggest it will earn about £1m for the local economy as well as boosting Stirling's profile as a tourist destination.

This evening the streets will host Stirling's Big Night Out, with open-air performances, street art, entertainers and music. Stirling Council chief executive Bob Jack said: "We're expecting tens of thousands to visit Stirling for the Armed Forces Day National Event alone."

l Scotland's first Veterans Commissioner has been appointed to provide greater support for Armed Forces personnel. Eric Fraser CBE, a former senior Navy officer, will work with charities, local authorities and health boards on veterans' issues and help shape future policy developments.