core.game_input
core.game_input#
The game_input module provides an interface to trigger keystrokes from within the gym.
- class soulsgym.core.game_input.GameInput(game_id: str, game_speed: float = 1.0)#
Trigger keystrokes by calling the Windows user32 API.
- add_action(action: str)#
Queue a single action for the next game input.
Action string has to be contained in
static.keybindings.- Parameters
actions – The pressed action.
- add_actions(actions: list[str])#
Queue multiple actions for the next game input.
Action strings have to be contained in
static.keybindings.- Parameters
actions – A list of pressed actions.
- update_input()#
Update the pressed keys state with queued actions and execute key presses/releases.
Actions have to be queued with
GameInput.add_action()andGameInput.add_actions(). Some actions (e.g. rolling) require an immediate release after pressing the key, or else the player would perform a different action such as running. All other keystrokes remain pressed as long as successive updates contain the corresponding action (e.g. running).
- reset()#
Release all keys and set the press state to False.
- single_action(action: str, press_time: float = 0.15)#
Perform a single action for a given amount of time.
- Parameters
action – The action to trigger (see
static.keybindings).press_time – The duration of the key press.