OUTSIDE AVDIIVKA, Ukraine — The headquarters of one of the battalions in Ukraine’s 53rd Mechanized brigade smells of fresh cut pine trees. The scents are from the wooden support beams in the labyrinth of trenches that make up most of the unit’s rudimentary base outside the embattled town of Avdiivka.

In the main command room, flat-screen televisions, computers and satellite internet pipe in images from small drones, as a cadre of Ukrainian soldiers keeps tabs on their portion of the front line.

What they mostly see is a violent stalemate.

As the war enters its 17th month, the fighting has developed a noticeable rhythm. Russia and Ukraine are locked in a deadly back and forth of attacks and counterattacks. Russian artillery no longer has the clear advantage and Ukrainian forces are struggling with staunch Russian defenses, grinding on in their southern offensive, slowed because of dense minefields.

Small territorial gains come at an outsized cost. Field hospitals that were closed after the battle for the eastern city of Bakhmut have been reopened, volunteers said, and Ukrainian soldiers described a determined foe.

“We’re trading our people for their people and they have more people and equipment,” said one Ukrainian commander whose platoon has suffered around 200 percent casualties since Russia launched its full scale invasion last year.

This New York Times analysis of the war is based on a dozen visits to the front line and interviews in June and July with Ukrainian soldiers and commanders in the Donetsk and Kharkiv regions, where many of the battles are being fought.

Those visits showed the Ukrainian military facing a litany of new and enduring challenges that have contributed to its slow progress.

Ukraine has done well to adapt a defensive war — wiring Starlink satellite internet, public software and off-the-shelf drones to keep constant tabs on Russian forces from command points. But offensive operations are different: Ukraine has made marginal progress in its ability to coordinate directly between its troops closest to Russian forces on the so-called zero line and those assaulting forward.

Ukrainian infantry are focusing more and more on trench assaults, but after suffering tens of thousands of casualties since the war’s start, these ranks are often filled with lesser trained and older troops. And when Russian forces are driven from a position, they have become more adept at targeting that position with their artillery, ensuring Ukrainian troops can’t stay there long.

Ammunition is in short supply and there is a mixture of munitions sent from different countries. That has forced Ukrainian artillery units to use more ammunition to hit their targets, since accuracy varies widely between the various shells, Ukrainian soldiers said. In addition, some of the older shells and rockets sent from abroad are damaging their equipment, and injuring soldiers. “It’s a very big problem now,” said Alex, a Ukrainian battalion commander.

Finally, in the summer months, camouflage and greenery remain crucial factors on whether a battlefield operation will be successful. Defending forces almost always have the advantage, whether it’s because of unseen trenches or hidden electronic warfare units that use deceit and concealment to throw off attacking forces.

The setup the soldier named Valerii was watching in the command center is common among a majority of Ukrainian units fighting in the east. Unlike the United States and other NATO countries that use intricate military communication equipment to monitor the battlefield, Ukrainian troops use less sophisticated, but easier-to-use programs like smartphone messaging apps, private internet chat rooms and small Chinese-made drones to watch the goings on along the front line.

It’s an ad hoc, but effective, communication suite that is overlaid with homegrown Ukrainian software, providing the location of Ukrainian units and suspected positions of Russian forces.

The downside of this system is that it’s almost entirely tethered to Starlink satellite internet. That means when Ukrainian units are assaulting — absent a Wi-Fi router — it takes longer to communicate important information such as artillery targets because attacking troops have to reach someone with an internet connection to call for support.

Ukrainian troops are also contending with Russian forces jamming the radios soldiers are using to try to reach their comrades with internet.

“Mostly we receive coordinates via the internet — it is secure, and as soon as they are transmitted to us, we use them immediately,” said Anton, the head of an automatic grenade launcher unit.

In one case in the country’s south earlier this year, soldiers fighting for Ukraine tried to wire Starlink internet to an armored troop transport as they assaulted a Russian position, but the antenna was shot by friendly fire during the attack.

This month, the system worked as intended. A Ukrainian drone watched as the dirt from a Russian soldier’s shovel piled up next to a trench he was digging: it was a priority target. A new trench meant Russian forces were getting that much closer to Ukrainian lines and would be one more fortification for Ukrainian forces to assault.

The coordinates for the trench were sent via smartphone, and minutes later explosions from a Mk 19 automatic grenade launcher erupted on either side of the Russian soldier.

The squad of Ukrainian soldiers from the 59th brigade were soaked through with sweat. It was the end of June and they had performed the same drill — assaulting a trench used for training, just miles from the front line — countless times, navigating through the overgrown grass, fake-firing their Kalashnikovs, resting and doing it all over again.

The aim of the repetition was to make the process mechanical, so when the new group of mobilized soldiers, whose ages ranged between 25 and 40, finally made it to the front line, they wouldn’t flinch when it came time to attack a well-defended Russian trench.

“We haven’t been in active combat yet but we are preparing for it,” said Mykola, one of the younger soldiers in the group.

With the war in its second year and both armies well-versed in constructing and defending fortifications, assaulting trenches has become one of the most dangerous and necessary tasks for Ukrainian troops trying to retake territory. Training for more specialized skills, such as for snipers, has been sidelined in favor of trench attacks.

Around the eastern city of Bakhmut, which was captured by the Russians in May, Ukrainian forces have made progress on the city’s flanks because Russian forces have had less time to dig in. Some elite Ukrainian units in the area are proficient in attacking Russian trenches with good communication and coordinated assaults.

But other Ukrainian formations elsewhere on the front have had trouble filling their ranks with the caliber of soldiers capable of carrying out successful trench attacks, given that months of fighting have exhausted their ranks. New replacements are often older recruits who were forced into action.

“How can you expect a 40 year old to be a good infantry soldier or machine-gunner?” asked the Ukrainian commander who’s platoon had taken dozens of casualties. Youth not only means better physical prowess, but younger soldiers are less likely to question orders.

In recent days around Bakhmut, Ukrainian casualties have mounted, a byproduct of Ukraine’s strategy to tie up Russian forces around the city to complement the ongoing counteroffensive in the country’s south. Russian forces have rushed more artillery units to the area so that even if they lose a trench to a Ukrainian assault they can quickly shower their lost fortifications with shells, forcing Kyivs troops to retreat from newly recaptured ground.

Outside the eastern town of Siversk, a team of Ukrainian troops manning a U.S.-supplied 105 mm howitzer listened to its “neighbor,” a self-propelled howitzer, fire several rounds. Then the 105 mm’s team received their own fire mission, via smartphone and Starlink internet, targeting a Russian mortar team.

The crew peeled back its camouflage netting, fired twice, and then concealed again.

The fire mission was successful. But for many Ukrainian artillery units it’s not that simple.

Ukrainian artillery crews are navigating an assortment of munitions delivered from countries such as Pakistan, Poland, Bulgaria and Iran, forcing gun crews to adjust their aim based on which country the ammunition comes from, and sometimes how old they are, even though they are all the same caliber.

Frequent artillery fire almost always brings retaliation. Twenty minutes after a Ukrainian 105 mm fired a salvo, the Russians fired back, showering the area with cluster munitions, a class of shells and rockets that explode and distribute smaller explosives over a wide area. Both Russia and Ukraine have used the weapons, though many countries banning them.

The Russians used cluster munitions, the gun crew said, because they didn’t know exactly where the Ukrainians were, so they opted instead to blanket the area with the small exploding bombs with the hopes of hitting their target somewhere among the trees.

One of the defining features of summer combat in eastern Ukraine is the foliage. Covering a tank or artillery piece with camouflage is called “masking” by the Ukrainians, and the routine is critical to avoid detection from drones and the artillery fire that is sure to follow. Around Bakhmut the fields and tree lines are known among Ukrainian troops as the “green zone.”

Outside the Russian-held town of Kreminna, farther north, where pine forests dominate the terrain, Russian forces there frequently shell the trees with incendiary munitions to burn through the foliage, soldiers from the 100th Territorial Defense Brigade said. On that front line, Ukrainian troops often go so far as to bury their trash to stay hidden from drones.

Often, to fire or maneuver, Ukrainian combat vehicles have to forego any type of camouflage, exposing them to another weapon that has proliferated across the front line in recent months: Russian GPS-guided Lancet drones.

Often called “kamikaze” drones, they have forced Ukrainian artillery and tank crews to take extensive measures at concealing their positions. Some tank crews have even welded homemade armor to their turrets to stop the self-exploding machines.

Roughly 40 miles away, on another portion of the front line, soldiers from the 15th separate artillery reconnaissance brigade were monitoring a range of radio frequencies from their computer screens, and trying to figure out how to deal with the Lancets. Jamming them was impossible, at least for now.

Lancets are hard to shoot down because they operate more like guided bombs than drones, the Ukrainian soldiers said. Instead their electronic warfare radar, known as a NOTA, tries to jam the nearby Russian drone presumably sending coordinates to the Lancet. But it’s a difficult science, the soldiers said.

“We don’t know exactly how they communicate,” said Marabu, a junior sergeant working inside the NOTA.

Another electronic warfare soldier added that they can only see Lancets briefly on their screen when it turns on its connection to stream video, but that usually only lasts around 15 seconds.

Electronic warfare is a hidden hand behind much of the war, with Russian capabilities outmatching that of the Ukrainians. Russian forces can detect cellphone signals, jam GPS and radio frequencies and are often looking for Starlink Wi-Fi routers to target with their artillery.

“It’s a very big problem for us,” said Marabu, referring to the Russian forces’ ability to switch the frequency output of their drones. That makes it harder for the NOTA to tell where the drones are on the front line.

Earlier this month, Marabu watched a Russian surveillance drone somewhere over the town of Svatove. Out of range from the NOTA’s jamming radar, all Sgt. Marabu could do was look as red dots cascaded down a blue background on his screen: the Russian drone was communicating back to its operator, sending grainy footage of the war below.