
Making a multi-characters controller system in Godot 4
Audio Summary
AI Summary
This video explains how to implement a multi-character control system in a game engine, useful for local co-op or solo games with multiple on-screen avatars. This feature is central to the presenter's new game project, "Cursor Cursor," a bullet hell arena shooter where players control two cursors to protect a central core.
The core idea for implementing this mechanic in Godot involves assigning unique IDs to each on-screen avatar and defining matching input actions. If two characters share the same movement logic, they can use the same script but receive a unique ID. In the project settings' input tab, various input actions for each character are defined, with the character's ID included as a suffix in the action names. This allows the character script to check for specific inputs tailored to that character's ID within the input hook. For example, the first character might use WASD controls, while the second uses arrow keys, as defined in the project settings.
This method leverages the benefits of input actions, such as handling multiple device types like keyboards and gamepads, and remapping inputs at runtime. For games with dual controls, displaying these controls on screen can be helpful. The video suggests a free add-on called "controller icons" from the Godot Asset Library. This plugin displays dynamic icons of keys associated with input actions, adapting to active device types (mouse/keyboard or gamepad) and reflecting runtime input changes.
Setting up a multi-character control system is a foundational step. Further development might involve implementing interactions between characters, which could be a key part of game design. For instance, in "Cursor Cursor," a mod creates a continuous laser beam between the two cursors, damaging enemies. The video concludes by inviting viewers to comment if they'd like a tutorial on implementing such a weapon.