The carpenter ants you see typically are the black ones that end up in your house. These ants typically prefer wooded environments where they can nest in dead or decaying trees, but they aren't opposed to seeking shelter in the wood of your home. They don't eat the wood, but rather dig tunnels for protection. Carpenter ants function differently than many other species with some special adaptations.
Carpenter ants adapted to nighttime conditions as a way to reduce competition and predation. They share territories with other ant species and often forage in the same areas, but instead of competing with these ants during the day, carpenter ants forage at night. Extremely territorial, running into other ant groups can lead to fierce battles that aren't in the best interests of either group, so foraging at night helps eliminate this problem. Nighttime foraging also allows the ants to be active without the worry of most ant predators, such as birds.
Moving by Touch
Carpenter ants don't have much better nighttime vision than most ant species, but they've adapted to move around at night. Their sensitive antennae and incredible spatial memories allow them to follow structural cues in their environments, creating trails for other colony members. They use landscape items, such as trees, to help guide them as well.
Just as many animals use the sun as a guide, carpenter ants use the moon, when it's visible. They don't rely on just one sense to get them to their food and back to the nest. Instead, they use a combination of adaptations, including sight, when light allows. Moonlight lets carpenter ants see where they're going, helping them recognize landmarks, but it also serves as a navigation tool. Long-lived queens help the colonies stay in one place for long periods of time, so the ants learn how to follow the moon to get where they're going.
It's common for ants to use pheromones to lay trails for other ants to follow, but with carpenter ants, this skill is refined to help guide colony members in the darkness of night. As more carpenter ants use the trail and add their own pheromones to the mix, they create trunk trails, which are almost like interstates to the ants. These typically lead to long-term food sources, such as aphid colonies, a main source of sugary nectar for the ants.