-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Describe the problem you are having in your project
- Implementing a combo system
- Implement a cheat code system
Describe the feature and how it helps to overcome the problem
Input Buffering is common in various game even nowadays like in dark souls used for combat system, also heavily used in fighting games like street fighter and Mortal Kombat, Cheat codes can be easily implemented using input buffers
Describe how your proposal will work, with code, pseudo-code, mockups, and/or diagrams
Implementing a Inputbuffer class:
//Emitted when a registered command is identified by the buffer
signal on_command_identified()
//Register the ID of the input
void register_input(int value);
// name -> the command name (used for signal when archived
// sequence -> the int array representing input sequence e.g [1,2,2] = Up,Left,Left
// total_time -> time in seconds to do the sequence
void add_command(name:String,sequence:PoolIntArray, total_time:float);
// need to rely on _process() to check for time between key_presses
void update(float delta)
The class must inherit Resource, this way the user can save the sequences.
Use case example:
extends Player
var input_buffer:InputBuffer = InputBuffer.new()
func _ready()
input_buffer.add_command("haduken", [1,2,2], 0.5)
connect(self,"on_identified",input_buffer,"on_command_identified")
func _process(delta):
if ( Input.is_action_just_pressed("ui_right"):
input_buffer.register_input(1)
elif ( Input.is_action_just_pressed("ui_left"):
input_buffer.register_input(2)
input_buffer.update(delta)
func on_identified(name:String):
match name:
"haduken":
# haduken execution here
Is there a reason why this should be in Goost and not in Godot?
I like to think goost as a bridge for perfect Godot PRs, first make it work, then PR it to godot!
Solve a already made proposal?
Yes, it solves godotengine/godot-proposals#100
** Observations **
Yeah this can be implemented by the final user via GDScript, but I'm into performance, to archive this I'm proposing this relying on bitsets (direct bit manipulation) and way less memory usage, to check in a case where for example a character has like 30 combos into his moveset, the same for cheats and so on!
Pure c++ implementation can be found here -> https://repl.it/repls/RubberyCruelRectangles