"Only an idiot goes out at night," said a surgeon who has been removing bullets from Ugandans in this city for 15 years. For most of that time, Uganda has been terrorized by its own soldiers. Human rights groups estimate that a half million people have been killed, mostly by men in uniform.

A judge here recently examined a list of bail applicants charged with capital offenses, such as murder and armed robbery. He found that 60 to 70 percent of them belonged to the Ugandan Army, special security forces or police.

The violence, which has wrecked Uganda's once-thriving economy, is rooted in the traditions of rival East African kingdoms that have fought each other for centuries. They were joined together as a British protectorate in 1894. But rivalries were exacerbated by the British, who favored the southern-based Baganda tribe, the largest and most advanced kingdom.

Since independence in 1962, the history of this country is, to a large extent, the story of northern tribal groups cutting the Baganda and other southern tribes down to size, and of the south fighting back.

That struggle now appears to have reached a stalemate, with southern rebels having taken the southwestern third of the country from the northern-controlled national government. A peace agreement signed last month appears to be going nowhere, and the Kampala area has settled into a familiar routine of nighttime gunfire, car hijackings, armed robbery, rapes and murder.

Amid the lawlessness, people earn a living. What follows are sketches of four men who are, either willingly or in spite of their best efforts, caught up in Uganda's culture of violence. A General

Maj. Gen. Issac Lumago came home to Uganda after the most recent coup. He was Army chief of staff under his fellow Kakwa tribesman, Idi Amin, and had to escape to Sudan when Amin was overthrown in 1979.

"We all know our politics in Uganda. When a new leader comes in like Milton Obote," a member of the Langi tribe, who took over after Amin, "you flee or die."

When Obote was overthrown last July, Lumago and about 1,500 veterans of Amin's army came back. A fit man of 50, Lumago now commands the Former Uganda National Army, or FUNA. It is one of four fighting forces that have allied with the military government against the southern rebels of the National Resistance Army.

Like the officers of the other fighting forces, Lumago has set up a command headquarters in one of Kampala's hotels. He lives in that haven, at government expense, attending meetings, giving interviews, occasionally traveling to the southern front to lead his troops in battle against the National Resistance Army.

"People talk that we are killers because we served under Idi Amin. But I tell you that was a handful of people, ill-trained, who happened to spoil all our names," Lumago said.

"I am a professional soldier. We are appealing to soldiers who are disciplined, with a clear record. They are professionals. We are very happy with them."

Despite Lumago's claim for the high-mindedness of his men, officials of the military government and western diplomats say his soldiers have been responsible since their return for the looting and rapes in Kampala, as well as for indiscriminate killing of civilians in Mityana tea country, about 60 miles west of here. Lumago denies the charges.

The rebels say that Amin's former soldiers do not honor human rights, "do not want democracy" and should be punished for crimes committed during Amin's 1971-79 rule. If the December peace agreement between the government and the National Resistance Army were implemented, the rebels would share power. The peace agreement also says that former members of Amin's regime "shall have to be carefully screened and vetted to be eligible to be admitted to the new national Army" and that "said persons must have clean records."

"I have a clear record. I am not worried about what they will find," said Lumago, who said he would rather face prosecution in his home than return to a farm in southern Sudan.

"Home is home," he said. "My coming home is enough for me. I don't need a ministerial post. We (FUNA officers) are experts in training soldiers."

Like the other fighting forces here, Lumago's soldiers control a sector of Kampala where they man roadblocks and are supposed to maintain order. Since the peace agreement was signed, however, there have been reports of fighting in the city between FUNA soldiers and the Ugandan Army. Lumago denies the reports.

The general said that there are about 9,000 other former Amin soldiers still in exile awaiting word from him to come home.

"I believe they should be the backbone of the new Army, once the peace agreement is implemented," Lumago said. A Banker

Thomas is a banker. His brother, a Princeton-trained professor, fled to Kenya. His brothers-in-law, a doctor and a pharmacologist, both fled to Saudi Arabia. But Thomas, who says he would be in danger if his names were used in this story, has stayed, bucking the exodus that has bled Uganda of thousands of its educated elite.

The 48-year-old, London-trained lawyer directs one of Kampala's major banks. But these days, he says, the bank job gives him little to do. With uncertainty over the peace agreement and a third of the country sealed off by rebels, it is difficult to make loans and even harder for the bank's borrowers to repay them.

Yet, dressed in a pin-striped suit, seated behind his desk in a high-rise office building in downtown Kampala, Thomas has the slightly overweight look of many prosperous, middle-aged African businessmen. His relative affluence in a country with a per capita annual income of $240 comes from his ability to extemporize in a crumbling, war-crippled economy.

The banker owns two trucks, which he says cruise around Kampala, looking for free-lance hauling jobs. They do both civilian and military work. Earnings from the trucks match his bank salary of $13,000 a year, he said. The bank also supplies him with a house and a car.

"The paradox about Uganda is that somehow we are managing," said Thomas, who is married and has six children. He said that he and his family cannot afford to live anywhere else. "People depend on their wits here," Thomas said. "If our people were given peace, they could produce a lot more." A Judge

In Amin's day, Judge Peter A.P.J. Allen had trouble with soldiers bursting into the courtrooms of his junior magistrates and beating them up. "I found that the effective way of dealing with this was to put it all in writing and send it to Amin. I never got any reply, but I always found that something was done to the men interfering with my courts.

"Amin had a rather drastic way of dealing with problems," said Allen.

Allen, 56, a thin, blue-eyed Englishman, came to Uganda as a colonial policeman 30 years ago. His first duties were in the north, in Karamoja District, policing cattle theft and the mass murder that often accompanied it. "We tried to keep the tribes apart, and when we couldn't do that and there was killing, we arranged for blood money to be paid . . . . Killing is a common solution in Uganda to tribal or personal conflict."

Allen became a magistrate in 1970 and three years later Amin appointed him a judge of Uganda's high court. As a judge, a good part of Allen's work has been dismissing trumped-up cases against Amin's and, later, Obote's political enemies. Diplomats here say the survival of Uganda's British system of jurisprudence is due in large measure to Allen's courage and that of the judges and magistrates he has trained.

Shortly before Obote's overthrow last July, Allen had his bailiffs hold government security men in his chambers while he personally saw to the safety of a man whom he had ordered released from custody. Allen ushered the man to the gate of the High Court and told him to make a run for it. The new military government, which toppled Obote and purged many of his senior ministers, informed Allen at 2 p.m. on Aug. 15 that he was to be promoted to chief justice of Uganda.

"I wasn't asked; I was told," he said. "They called me up at 2 p.m. and I was sworn in at 4."

For 16 years, the judge has been the only non-Ugandan in the judiciary. "My view has been that in my position I was able, perhaps in a small way, to help a few people, save a few people, make sure they didn't suffer the extreme penalty, that sort of thing," he said.

"If the good ones all packed up and left, and many did, this would leave the country in the hands of the unscrupulous and the bad."

Allen was blown out of his bed by artillery fire during the 1979 Tanzanian invasion of Uganda. At one point he kept looters away from his house with a club. He is unmarried and said: "I don't think I would have inflicted this on a family."

In his 30 years in Kampala, he says he has seen the city decline from one of the most pleasant, livable places to an armed camp where he never goes out at night. "I often feel full of despair when I see this city, knowing what it was. But there it is, I elected to stay. And the climate is good. It has kept me in good health all these years." A Mercenary

Sajjad Soori Mohammed Sajjari was blown out of a Land-Rover last September. It ran over a land mine near Mityana, at the western front of the government's war with the southern rebels. The driver and two other passengers were killed. Soori said he landed in nearby grass, unhurt.

"It is quite exciting to be here. I like the excitement," said Soori, a burly, 34-year-old Pakistani.

He is a captain in the Uganda Freedom Movement, a fighting force allied with the military government. Soori, who served in the Pakistani military, said he fights not for Uganda, but out of personal loyalty to the force's leader, Lutaakome A. Kayiira, whom he met several years ago in New York. (Kayiira, who has a doctorate in criminal justice from Southern Illinois University, is on leave from Marist College in Poughkeepsie, N.Y., where he is an assistant professor of criminology.)

Soori talked of his life late one night in the lobby of the Speke Hotel in downtown Kampala. He was drinking scotch and chain-smoking cigarettes, charging them to a hotel bill. For four months, he and a score of other officers of the Uganda Freedom Movement have been staying at the Speke at government expense.

They drive off to the western front during the day, and repair in the evenings to the Speke, where they frequently stay up late, drinking and womanizing. "I have 200 of them; I call them all 'honey,' " he said. He also said that he enjoys ordering the hotel's barman out of bed to fix drinks for himself and his men.

Before his stay at the Speke began, courtesy of the coup that toppled Obote, Soori had been residing for two years and eight months in nearby Luzira Prison, accused of aiding and abetting "warlike undertakings" against Uganda.

In 1982, Soori had fought for the Uganda Freedom Movement against Obote's government from the bush in southern Uganda. He took a leave from the fighting, he said, in July of that year to travel to London and Tripoli, Libya.

In Nairobi on Dec. 10, 1982, when he was headed back to Uganda, Soori says he was kidnaped. "Obote's NSA (National Security Agency) people broke into my apartment at 5 a.m. With the help of their guns, they gagged me and gave me some injections," Soori said.

He said he was driven to a private Nairobi airport and flown in a small plane to Kampala. The same day, without mentioning the kidnaping, the Ugandan government announced that it had arrested Soori, whom they called "a Pakistani employed by Libya." He was charged with promoting war against the government.

Soori, who spent most of his time in prison in solitary confinement, denies that he worked for the Libyan government. When political prisoners were released after the July coup, Soori said the Uganda Freedom Movement recruited him back to train its soldiers.

"I came back to the UFM here because UFM had some principles, freedom, democracy and all that bull----."