The ancient Khmers were a traditional agricultural community, relying heavily on rice farming. The farmers, who formed the majority of kingdom's population, planted rice near the banks of the lake or river, in the irrigated plains surrounding their villages, or in the hills when lowlands were flooded. The rice paddies were irrigated by a massive and complex hydraulics system, including networks of canals and "barays", or giant water reservoirs. This system enabled the formation of large-scale rice farming communities surrounding Khmer cities. Sugar palm trees, fruit trees, and vegetables were grown in the orchards by the villages, providing other sources of agricultural produce such as palm sugar, palm wine, coconut, various tropical fruits, and vegetables.