Implementing a spawnable attack
Hi there,
In this update, I wanted to talk about the design and implementation of a new spawnable "laser" attack in my game. One of the features, I have lately added to the game are traps that can be enabled by the player to kill or incapacitate enemies. This makes the level design much funnier and open to possibilities. These traps are no more than "attacks" that are spawned at a specific location in the scene. When designing and implementing such a system, one should handle all the different events separately. The attack starts with a trigger. The player needs to interact with something in the scene, which I call an Interactable, that will spawn the corresponding attack at the right place. This attack is no more than a different entity with its own behaviour. The attack has also a trigger, it needs to detect when an entity enters in its range. Whenever this happens, the so-called hitter system takes the main role. This system will start looking for other systems and components within the entity target. Does this entity has a hittable? In other words, does this entity accepts hits? If yes, the hitter system creates and passes the hit to the hittable. Here, we move to the hittable system. This one will look for health components to process the damage related to this hit. But, this is not where the hittable ends. Attacks can be very diverse and dynamic. We have created a Hits decorator system, so we can add some effects to the attatcks, such as changing the status of the entity or just producing a noise effect. This decorators are processed by the target entities (if they have to process them!). Finally, we have a death component which handles the moment the health becomes zero. This component will trigger several actions and disable the target entity. One of this actions is pooling a ragdoll to simulatie the death having a beatiful skeletal animation.
This process is explained in detail in the following video, where I show how it is implemented in the editor and part of the code related to it.
Thanks for reading and feel free to leave any comment.
Get 3D game project
3D game project
3D game development project using the OpenTK framework
More posts
- New enemy visuals and covering mechanicJul 26, 2024
- Implementing an inventory systemJul 19, 2024
- Graphics upgradeJul 13, 2024
- Prototype level designJul 02, 2024
- Implementing world events and cutscenes systemJun 21, 2024
- How game development process looks like when using a custom-made game engine.Jun 18, 2024
- Testing stealth prototype game mechanicsJun 17, 2024
- Enemies field of view rendering and detectionJun 07, 2024
- Demo of the prototype available to download!May 25, 2024
Leave a comment
Log in with itch.io to leave a comment.