Image copyright AFP Image caption How do you get ready for unprecedented meeting between two wildly unpredictable men. And is there time?

Back in September, North Korean leader Kim Jong-un vowed to "tame" Donald Trump, deriding the president as a "mentally deranged US dotard".

President Trump replied by calling Mr Kim a "maniac" and a "madman", and warning he would be "tested like never before". Later they traded barbs over who had a bigger nuclear button.

Six months on, those high-stakes playground spats form part of a bizarre diplomatic backdrop to a summit no-one saw coming. Mr Trump surprised the world on Thursday when he announced, via a South Korean official, that he had agreed to meet Mr Kim.

The major negotiating point of their meeting will be de-nuclearisation of the North Korean regime. Beyond that, little is yet known about potential objectives and concessions on either side.

It is a remarkable gamble by the US president, one that would make him the first American leader to meet a North Korean counterpart. The careful choreography and delicate diplomacy required by international talks have not always come naturally to the Trump team, and now its staff have on their hands one of the most high-profile bilateral summits in US history.

The talks are scheduled to take place within two months. For both sides, preparation will be key, but how do you prepare for an unprecedented meeting between two wildly unpredictable men?

The US will begin with key Korea positions in the state department vacant. Chief North Korea envoy Joseph Yun resigned in February and the widely expected appointment of Victor Cha as ambassador to Seoul fell through the same month, over a policy disagreement.

"I expect they are going to face a few problems," said Jim Hoare, a former British charge d'affaires in Pyongyang, of the American effort.

"If they had a proper apparatus to deal with East Asia, it might be different. But they have only an acting officer in charge of East Asian matters, the state department has been battered and there's no ambassador in South Korea. So I don't know who Trump is talking to about North Korea, I'm not sure anybody does."

The decision to agree to the historic meeting is said to have unfolded in an impulsive and haphazard way not uncommon to the new administration. The New York Times reports that the president, upon hearing that South Korean official Chung Eui-yong was in the White House, summoned Mr Chung to the Oval office and asked about Mr Kim.

Media playback is unsupported on your device Media caption The South's Chung Eui-yong talks to reporters at the White House

When Mr Chung said the North Korean leader wanted to meet Mr Trump, the president immediately agreed and told the South Korean official to make the announcement to the press.

Not for the first time, Mr Trump's own Secretary of State, Rex Tillerson, was caught on the hop. "In terms of direct talks... we're a long ways from negotiations," Mr Tillerson had told reporters just hours before the surprise announcement.

Previous presidents have resisted visiting North Korea, leery of conferring prestige on the regime. Bill Clinton reportedly considered a trip to Pyongyang in late 2000, shortly after a visit by then-Secretary of State Madeleine Albright had laid potential groundwork, but ultimately focused on late-term priorities elsewhere.

Media playback is unsupported on your device Media caption The unlikely triangle: Trump, Rodman and Kim Jong-un

"A meeting with the US president is the coin of the realm," said Christopher Hill, a former US ambassador to South Korea, "and here we have a president just prepared to do it without too many details of what the North Koreans have in mind."

But the president's oft-derided impulsiveness may prove to be an asset in this case, said Stephen Hadley, a former national security adviser to George W Bush.

"His style has already produced a breakthrough," said Mr Hadley.

"He was much criticised for rhetoric on North Korea that was viewed as irresponsible and bellicose but it got both North Korea's attention and China's attention.

"The trick now is to convince China that the status quo is not sustainable and convince North Korea that holding on to nuclear weapons might be more of a risk to their security than giving them up.

"And I think Trump's approach has had a pretty good impact in both of those directions already."

The speed of the decision leaves significant details up in the air. The location presents an interesting conundrum. Mr Kim has not left North Korea since becoming leader and is unlikely to accept an invitation to Washington. A visit by Mr Trump to Pyongyang would be a considerable PR gift to the North Koreans and is equally unlikely.

"It's going to be difficult getting the protocol right, who defers to who and under what circumstances etc, so it's important to find a place that's neutral," said Mr Hoare.

Possible contenders include China, the demilitarised zone between the two Koreas and somewhere in international waters. In 1989, George HW Bush met the Soviet leader, Mikhail Gorbachev, on a Soviet cruise ship off the coast of Malta.

More important still than the location for Mr Trump will be a meticulous understanding of both the US and North Korean objectives. For a president known to struggle with dense briefing papers - preferring instead short, image-led presentations - preparation could be a challenge.

"If he doesn't do the homework he's going to have a problem," said Mr Hoare. "He will be facing people who have been working on US matters for years and years and years. They won't speak but they will have briefed Mr Kim very thoroughly."

Another key consideration will be the way things look. The summit will take place in a media ecosystem completely different to that of 1961, when President John Kennedy met Nikita Khrushchev in Vienna, or of 1972 when Richard Nixon made his famous overture to China. Every word will be covered in real time on cable news, every stray bit of body language subjected to rigorous analysis.

But if Mr Trump can avoid diplomatic gaffes and get along well enough with Mr Kim, his straight-shooting style of politics may prove to be as much of an asset in dealing with North Korea as it has been a liability elsewhere.

"He has already surprised a lot of people by bringing Kim to the table," said Mr Hadley. "It just might be that his unconventional style produces a surprising result from the meeting."