ihhub / fheroes2

fheroes2 is a recreation of Heroes of Might and Magic II game engine.
https://ihhub.github.io/fheroes2/
GNU General Public License v2.0
2.6k stars 365 forks source link

Right-click via Touchscreen input not working on devices with Windows 10 #5466

Closed admmlk closed 1 year ago

admmlk commented 2 years ago

Preliminary checks

Platform

Windows

Describe the bug

It should be possible to 'simulate' mouse right-click event with touchscreen input by touch-and-hold / double-hold / hold-and-drag - this is the way it works in other applications - however neither of it works in case using touchscreen input on Windows 10.

It makes the game "unplayable" (not able to inspect adventure map objects, hero/unit details etc.) on mobile devices with Windows.

Details: fHeroes2 version: any latest (0.9.14 or lower), SDL2 System: Windows 10 Device: Asus Transformer T101HA

Save file

Save file not needed for that issue.

Additional info

Not sure if that's a bug or improvement, please change the type accordingly.

oleg-derevenetz commented 2 years ago

Marking this as an improvement, because in its current state this game is designed to use either the mouse or game controller. Changes in the game control design may be required.

zenseii commented 2 years ago

I should be able to look into this as I have a Win10 device with touch input support.

oleg-derevenetz commented 2 years ago

Hi @zenseii BTW with initiatives like #5435 it may become even harder.

zenseii commented 2 years ago

Hi @zenseii BTW with initiatives like #5435 it may become even harder.

Yes. I believe they are talking about having a threshold for the amount of movement needed for the camera to move. Maybe @Laserlicht could share some thoughts about this? I believe the above PR was made to facilitate gameplay on a touch device/steam deck so there shouldn't be any fundamental differences from that to a Win10 touch device.

Nevertheless, this issue is quite relevant for the future planned port to smartphones, and would need to be addressed in time for that regard.

oleg-derevenetz commented 2 years ago

Nevertheless, this issue is quite relevant for the future planned port to smartphones, and would need to be addressed in time for that regard.

I have the impression that playing such strategies on smartphones will be inconvenient in any case - for example, I can't imagine how to simulate the adventure cursor on the touchscreen with the display of the number of days on the road when hovering over the tile. To be comfortable on smartphones, the game must be specially designed for them - with a seriously simplified gameplay, and HoMM series of the game (at least HoMM2-5) definitely aren't.

admmlk commented 2 years ago

Well, both HoMM3 HD (by Ubisoft) and fanmade mods (HOTA, H3SW) are quite playable on mobile devices (at least 7-10 inch tablets) and right-click is simulated w/o any problems by touch-and-hold event. Also I'm talking about playing on 7-10 inch tablets (with Windows), not necessarily only Android smartphones.

So I cannot agree with your statement:

To be comfortable on smartphones, the game must be specially designed for them - with a seriously simplified gameplay, and HoMM series of the game (at least HoMM2-5) definitely aren't.

as again - other HoMM ports work fine with touch controls.

Oh, even in this project, there's a lot of touch-friendly improvements already implemented: like drag&drop for army splitting, additional buttons for army splitting/hero swapping etc. so the only thing missing for the game to be playable with touch is simply handle the touch-and-hold event and trigger "right-click". I've got an impression the problem lies only in single event handle in SDK2 and no special 'reworks' in the 'game control design' are needed (I may be wrong ofc :))

If you look on this tread: https://heroes2.forumactif.com/t993-device-support-windows-tablet-touchscreen-support#9012 ,they even mention having special build OR special option in menu to support this control mode, if you're affraid this change may break some other functionalities.

oleg-derevenetz commented 2 years ago

@admmlk

Oh, even in this project, there's a lot of touch-friendly improvements already implemented: like drag&drop for army splitting, additional buttons for army splitting/hero swapping etc. so the only thing missing for the game to be playable with touch is simply handle the touch-and-hold event and trigger "right-click".

Please note that some of these improvements imply using of keyboard - for example, the Ctrl+LeftClick to move the single unit from the specific stack to a free slot while splitting the army or using the "Z" key to put a hero to the sleep mode, etc, etc. So, honestly, users with touchscreen will not be able to use all the features anyway. May be the game is "playable" on the touchscreen, but that's all - a PC player will always have an advantage in terms of UI capabilities.

zenseii commented 2 years ago

I just did a quick test and touch input works quite well, even for battle which I expected would be broken, but as stated the only major thing missing is to be able to register touch and hold as a right-click, which is the standard way for this to work in other situations. So this is good news.

As for other missing functionalities etc. they can always be improved. Like the mentioned example of sleep which right now is only accessible through pressing the hotkey, and any player, PC or not, has no intuitive idea of its existence (no one should be expected to randomly press every key available on the keyboard to find out what functionalities exist), at least not until now when the hotkey dialog was added in-game.

Anyways these accommodations for touch will come step by step as we realize things need to be adjusted. We already have adjustments for game controllers to work so this shouldn't be too hard to accomplish. Luckily the Heroes series are turn-based games so immediate access to action commands is not critical, just convenient.

admmlk commented 2 years ago

@oleg-derevenetz

Please note that some of these improvements imply using of keyboard (...)

I don't think you're right - in the current build I'm able to use these features with touch only - as I said: there are already dedicated UI BUTTONS to split armies, or you can right-click an army stack to open 'split' popup, so no keyboard needed. What you're saying WAS a problem in original Heroes 2, where you really needed to use SHIFT (not CTRL) to split stacks etc.

I would also notice that I'm playing this specific project (Resurrection) since your first appearance on Forums of Enroth, using the same touchscreen device, with mouse only and never needed to use a keyboard -> I would also like to get rid of the mouse too and the lack of right-click emulation on adventure map and battle map is the only thing that prevent me from that, so please do not try to tell us that playing with touch only will be inconvenient or inferior to playing on desktop PC

Again, other ports I mentioned earlier are playable w/o any problems (hell, even original Age of Wonders is!)...

oleg-derevenetz commented 2 years ago

@admmlk

I don't think you're right - in the current build I'm able to use these features with touch only - as I said: there are already dedicated UI BUTTONS to split armies, or you can right-click an army stack to open 'split' popup, so no keyboard needed. What you're saying WAS a problem in original Heroes 2, where you really needed to use SHIFT (not CTRL) to split stacks etc.

It seems that you just don't understand what I'm talking about - which proves once again that players who use touchscreens are limited in their capabilities. Please try to run the fheroes2 on PC and use Ctrl (not Shift!) + LeftClick on the army stack and see what happens. Then try to reproduce this effect using the touchscreen only. Eventually you will be able to do it - but in a much less convenient way.

zenseii commented 2 years ago

It seems that you just don't understand what I'm talking about - which proves once again that players who use touchscreens are limited in their capabilities.

I believe what you mean here is that this is because they're used to a limited capability of control and input, not that their capabilities are limited (which generally means disabled, mentally or otherwise 😅).

But yes it is a good point, but again it's a difference in convenience and not possibilities. Playing with a gamepad is also a compromise in convenience, but enough people enjoy it to make implementing it worth it, as I imagine many will use touchinput although it is less convenient than traditional mouse and keyboard. Heck, many enjoy playing the original Heroes 2 with its many inconveniences, which fheroes2 improves on like the aforementioned fast splitting 😎

admmlk commented 2 years ago

@oleg-derevenetz

It seems that you just don't understand what I'm talking about - which proves once again that players who use touchscreens are limited in their capabilities.

ouch, this one was weak and not really nice, you know? ;)

What I really don't understand is why you're trying to compare lack of some QoL improvement for army splitting with a game-breaking bug of not working right-click :D

@ihhub maybe you could give us your opinion?

ihhub commented 2 years ago

@zenseii , @oleg-derevenetz , @admmlk , please cool down guys :)

@oleg-derevenetz explained that playing on a desktop version using mouse and keyboard is more convenient and has more options for players within the game. For example, some army distribution actions which aren't possible to have on touch control. Touch control is supported by default because touch screens interpret a click as a left mouse click.

I assume that the current implementation of touch control on other devices from Vita and Switch works in a bit fussy way as it doesn't properly support touches as they should. It's an emulation of mouse clicks. A way of play the game is up to players.

The issue is marked as beyond 1.0 because the primary goal of 1.0 version is to get a stable full working version of the original game. However, if someone expressed interest to implement such feature in a proper way (knowing how messy is SDL event code) then it would be great.

ihhub commented 2 years ago

The same inconvenience in the gameplay is applied when a user utilizes a touch pad. You simply cannot create a hold right mouse click event. We are aware of this and we will address this in the future.

admmlk commented 2 years ago

Thanks for your opinions :)

I would like only to add, that the convenience is subjective and personal thing as I haven't found any other issues with playing with touchscreen other that this one and find it quite enjoyable. I would even say that playing on tablet lying on the bed etc. may be more convenient that sitting for hours by keyboard, mouse and desktop PC. So generally, convenience is not an argument.

ihhub commented 2 years ago

@admmlk , if you enjoy our project then it is the most important :)

oleg-derevenetz commented 2 years ago

@zenseii

I believe what you mean here is that this is because they're used to a limited capability of control and input, not that their capabilities are limited (which generally means disabled, mentally or otherwise 😅).

I mean their in-game capabilities OFC, not their capabilities in general :) It turned out to be ambiguous :)))

@admmlk

ouch, this one was weak and not really nice, you know? ;)

I'm sorry, I didn't mean to :)

I don't mind at all trying to adapt the game to touchscreens, especially if it doesn't break anything. Apparently @zenseii wants to try to do this and have the proper device. I'm just afraid that it will be incomparable in convenience with mouse+keyboard and it will be a definite disappointment for many players who use phones or tablets and used to games specifically designed for these devices with simpler in-game controls.

admmlk commented 2 years ago

@admmlk , if you enjoy our project then it is the most important :)

Yeah I enjoy it a lot and track it since the 2000's, the old builds for android devices, then ciplogic's FH2enhanced and so on... Then I found your Resurrection project on Forums of Enroth and I'm looking forward for every monthly release now.

I was simply thinking the problem lies in single SDK event so implementing it would not be very hard. Ofc as I said I'm not an expert :) (fun fact: for some older version of SDK1 there were once a 'mod' that displayed left and right mouse buttons on the left side of the screen so you can click it and touch to simulate the mouse clicks)

So that you for all the hard work, I'm looking forward for bugfixes, enhancements and improvements especially the ones for touch devices :) ✌

zenseii commented 2 years ago

It turned out to be ambiguous :)))

The English language is indeed very stupid at times.

version of SDK1.

Note that it's called SDL1 and SDL2 @admmlk 😉

Players enjoy different setups. While I personally can't stand to play with any other setup than mouse and keyboard when on PC ( 90% keyboard/10% mouse ), we have experts like @LeHerosInconnu who prefers to only use the mouse, presumably because they are drinking beer or a glass of wine with the other hand 😂. (Or using a magnifying glass on the screen 🧐).

In addition, this is also a valid point for how we are making the game more accessible to various people, which in this case could apply to people who for example have lost one arm/only have one. This is in the same vein as the text mode for people with visual impairment. So not always is it about convenience but also about plain accessibility.

LeHerosInconnu commented 2 years ago

Hello @zenseii,

Players enjoy different setups. While I personally have to play with mouse and keyboard ( 90% keyboard/10% mouse ) we have experts like @LeHerosInconnu who prefers to only use the mouse, presumably because they are drinking beer or a glass of wine with the other hand joy. (Or using a magnifying glass on the screen monocle_face).

I could have said that when I play fheroes2, I play two scenarios simultaneously on two different computers with a mouse in each hand, but it is not the case. I could have said that when I play fheroes2, I try to make as little movement as possible so that all my blood flow is directed to the brain to set up elaborate and complex game strategies, but that is not the case either. No, the reality is that I try to expend as little energy as possible in order to reach a body mass of at least two hundred kilograms. A mass that I think I can reach within five years if all the actions of fheroes2 are achievable with only the use of the mouse. :rofl:

ihhub commented 1 year ago

Hi @admmlk , can you please test the latest build and confirm that this issue is gone?

admmlk commented 1 year ago

Hey I took the latest snapshot (22 Nov 2022) and checked it on my Windows device but it still does not work as expected :( The double-touch event is my case works currently like this:

Take a look on the recording below: https://user-images.githubusercontent.com/66256353/203527525-044ed9d4-bf1e-455e-a838-e30425f12a5d.mp4

@ihhub could this be related to the code in line 45 of localevent.cpp file, where TOUCH_SUPPORT is currently defined only for PSV, Switch and Adroid targets? This is later used as a condition for HandleTouchEvent() method, which is the one responsible for SDL_BUTTON_RIGHT.

From the good news: the touch-and-drag works perfectly well and makes both army split and scrolling adventure map a lot easier now!

ihhub commented 1 year ago

Hi @admmlk , can you please test a build from #6262 ?