Farming Game
Autumn 2023
In this project, my primary goal was to learn Rust and gain the ability to apply its advantages when working with C++ in the future. I opted for the Bevy game engine as I aimed to explore a more comprehensive implementation of the Entity-Component-System (ECS) architecture. Additionally, in this project, I aimed to delve into complex AI and optimizations, including techniques like chunk loading.
Key Features
- Tilemap and Chunk Loading: I integrated a tilemap system and chunk loading mechanism, enabling efficient performance over a large tilemap world.
- Crop System: I designed and implemented a sophisticated crop system that supports various aspects of farming, including seed planting, crop growth, and harvesting. Currently, the crops are automatically sold for money, but they will also serve the purpose of feeding animals in the future.
- Custom Animal Behaviour AI in progress: I have currently developed an Behaviour tree for my animal AI decisions. This implementation allows actions to be long running but interruptable via higher priority conditions. This framework is all functional, then next step is to now implement the different actions as the only working one makes the animal randomly wander. As a part of this I will develop a pathfinding approach, most likely using A* with custom heuristics to traverse to a location. I also want to have a herd system which have shared memory of resource locations such as water & food source locations.
- Resource Management (TODO): I implemented an inventory system for the player, enabling the collection of crop and animal produce. This system allows the player to decide what to do with these items. The game follows a simple resource loop, where players can sell their produce and use the proceeds to acquire more capabilities for producing items.
Challenges, solutions and lessons learnt
To enable chunk loading while separating entity visuals from the tilemap, I faced the challenge of storing all data within the tilemap while accommodating various types of plants. To address this, I leveraged Rust's enums, which not only facilitated straightforward comparisons of tile types but also enabled the storage of structs. These enums allowed for the storage of additional data specific to different tile objects.
Trello
![](../Assets/FarmingTrello.png)