In order to make combat more flexible to different playstyles and simply more fun in general, players will be able to pick up and throw a bunch of different objects for an environment-specific ranged attack, but look out – some enemies will do the same!
In addition to picking up objects and throwing them at your enemies, you can also choose to place them down gently. This can be doubly used for puzzles involving floor switches or other situations where you want to place an object in a particular spot.
Currently I’ve just added boxes and bushes but there will be many more objects added, like rocks that hit enemies hard but don’t break on impact or bombs that explode. Here’s some classic bush-throwing, which will mostly be for fun as they don’t do a whole of damage:
The biggest challenge from all of this has been the enemy ai scripting for throwing boxes. It’s a rather complex task, and involves logic like searching for the closest object to throw, pathfinding to it, how to walk to a spot that’s in-line with a player to throw it at them, and how to handle interruptions at different at different moments. For example enemies will put down objects when the player moves far enough away, or simply drop their object when hit with something. Having an enemy that can both throw things and also melee attack presents another challenge in choosing when to do what and creating a smart enemy that when close to the player will just attack them with a melee attack and not just run away for a far-off object to throw. There’s also moments with an enemy ai throwing objects that you don’t typically consider when controlling a player throwing things, like ensuring the enemy doesn’t just throw an object into an obstacle.