Spatial patterns in the abundance, distribution and characteristics of organisms are a fundamental feature of all ecosystems. However, achieving a mechanistic understanding of the forces behind these population patterns is a major challenge for ecologists due to the number and diversity of variables and relationships involved. Here, we developed a spatially‐explicit agent‐based model to determine the minimum individual characteristics and environmental relationships necessary to reproduce population patterns observed in the field across habitat quality. We designed the model so each trait and mechanism could be independently included or excluded allowing us to systematically identify their impacts. The model was parameterized and outputs compared to natural population patterns using data collected on an archetypical species, the mud crab Panopeus herbstii – a species that experiences drastic habitat degradation when oyster reefs are harvested or deteriorate. Surprisingly few parameters were required to reproduce field patterns. Food availability was the primary environmental determinant of spatial patterns, as crab abundances increased almost directly proportional to this variable. The main individual level mechanisms were the ability to detect food as well as size‐ and personality‐dependent movement, since proportionally more active individuals aggregated in high quality habitat. Although habitat‐ and size‐dependent mortality influenced the magnitude of differences in population demographics across habitats, these relationships did not impact the nature of the predicted patterns. Our model demonstrates that a few simple rules can underlie complex population patterns and highlights the importance of phenotypic differences, particularly in movement, for shaping populations across heterogenous terrain. The approach used here provides a framework for identifying the roles of multiple mechanisms in structuring complex systems, and demonstrates the importance of sensory limits, movement propensity of individuals and the availability of limiting resources for producing quantitative predictions of population responses to habitat change, such as degradation or restoration efforts.