Camaderie is formed when people spend time working together on hard problems or tasks.
If problems were easy, the sense of community wouldn't be as strong because the strength of the task is correlated with its binding power. If the problems are hard, people are forced to rely on each other for help, thus binding them.
If the time spent together were short, likewise the sense of community likely won't be as good if the time spent was longer. But overall between time spent and hard tasks/problems, the stronger weighting has to go to hard tasks/problems.
Camaderie is a powerful motivator. A mission is likely the best motivator, because it compels an individual personality to align with a goal, but camaderie is a close second. If you know the other person is working hard, you're likely going to work hard together to pass the time better.
Camaderie can rewire the brain. People are inherently self-interested, but camaderie can force people to put the group first. This is likely a function of how difficult a task is, rather than time spent together.