AGOS Engine & COMPOSER Engine & MADE Engine – Week 3

AGOS Engine finishing touches

In my previous post, I left it at the issue where in the game, when you pause the game, essentially it says, “press any key to continue”, I just wasn’t able to recreate it with Joy commands as the original code only triggered on keyboard input. But the mentors helped me identify that there was a way to access joy inputs and I was storing it in _joyaction and then that way I could record all inputs even if they were joy inputs.

And that is the last of AGOS Engine and here is the PR.

COMPOSER Engine

Composer engine is very unique in how it deals with keyboard inputs and doesn’t follow the conventional way to handle keyboard, maybe because the games can be completely played with the mouse and only requires keyboard for saving the game. Thus there was not much to add in the engine.

Here is the PR.

MADE Engine

MADE engine is more typical in its approach so I could relate it to previous engines to update. I was easily able to map the required inputs into the keymap but there was a small obstacle. As I was replacing EVENT_KEYDOWN with EVENT_CUSTOM_ENGINE_ACTION_START, I found out while testing that they work differently, so when the key is pressed EVENT_KEYDOWN is triggered in each loop and EVENT_CUSTOM_ENGINE_ACTION_START is triggered only once when key is pressed/held down, thus I had to introduce _action which would store the action then execute it each loop until EVENT_CUSTOM_ENGINE_ACTION_END(key is unpressed) is triggered, this way I was able to accommodate continuous input as key is held.

Here is the PR.

AGOS Engine – Week 2

DISCLAIMER: I had my exams for a week, hence I could not make sufficient progress

After my previous commit my mentors had made me realize that I did not take into account the game controller players. My keymaps would not identify controller key binds. Below review shows that I had made these two major errors, rest were small like naming conventions etc.

I was able to insert the yes/no option easily into the keymap. But the issue arose on how could we check if any of the controller key binds have been pressed. First I tried to loop through the const HardwareInputTableEntry defaultJoystickButtons[] and add all button into the keyMap action but I was advised that it is not the right way as it would look too cluttered when keyMap is accessed by the user. As of Saturday I am still stuck at this and hopefully I will be able to come up with a solution by the end of the day as next week I have to focus on another engine.

PR: Github

AGOS Engine – Week 1

The easiest way to start identifying where you need to replace the Enum values is to search the word “key” in that project. This way you can narrow down which files you have to go through.

Now in terms of how to define keymaps, there is initial documentation available in ScummVM website. But that won’t be enough to start, it is important to look through previous commits in ScummVM github to find similarities in the current engine in which keymap is being integrated. This is how I identified the keys and made initial keymap, I divided the keymaps into two, Engine(AGOS) Keymap and Game keymap. Engine Keymap contains key bindings which are same throughout the all the games of that engine and Game keymaps are specific to that engine.

 

There were two issues I faced, in the previous commits when they were adding custom key binds, they would usually customize or replace Event object based methods for example here. But AGOS engine in most places did not use event.type to identify key binds, rather it used _keyPressed.keycode, but there was a solution, I searched previous commits thoroughly and thankfully I found SKY engine commit which would track EnumAction _action and then make necessary changes to it.

Another issue I ran into was that after I had completed my keybind was that my method wouldn’t take continuous input when key was held down, The mistake I was doing was I would reset the –
   _action = kActionNone
each time after the keys were processed, instead I should’ve  reset it when
   event.type == EVENT_CUSTOM_ENGINE_ACTION_END.
Hence, that solved the problem.

My Commit: AGOS: Add keymapper support

Introduction

My name is Nabeel (Markhor), For my Google Summer of Code programme I’ve been assigned with adding custom Key Mappers to variety of engines in ScummVM. ScummVM includes a global fully configurable keymapper, but this requires engines to be adapted to use it. Hence the goal of this project is to integrate the customised ScummVM keymapper into the engine’s input handling system. This involves modifying the engine-driven input handling code for mapping user input to in-game actions.