Can you look at my patch?

For code related discussions and questions
Post Reply
wuz21m
Trained
Trained
Posts: 36
Joined: 18 Dec 2014, 20:57

Can you look at my patch?

Post by wuz21m »

Dear all,

I had this big issue with WZ2100 when rapidly clicking to get units to move (like when running from artillery :lol2:), some would register as drags few pixels across and it would deselect the units.

Some games avoid this by using right-click to move and left-click for selection (like Starcraft)

However, WZ2100 uses left-click for both selection and moves.

I wrote a patch that checks any drag events. If the Manhattan Distance of the drag is smaller than 50 pixels (it is hardcoded but worked well enough for my preliminary tests) it would not register as drag.

The patch is here: http://developer.wz2100.net/ticket/4261
I think it would improve the experience.

And sorry for posting about this patch here. It has been 10 days and I only got a single comment. I worried that my patch is going to rust and thus I created this post. I think the issues have been ironed out and code syntax has been improved (thanks to NoQ).

Can people test this patch and give me feedback?

Thanks!
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Can you look at my patch?

Post by NoQ »

Forum is actually a good place for discussion, because we could use some feedback from people who actually encountered this problem.

50 pixels is actually a lot (we still insist on supporting 640x480, and it's like 10% of the screen in this case, so it should look like a valid selection). Do you really manage to accidentally drag mouse that far instead of pressing? I'd expect 1-2 pixels at most.
It has been 10 days and I only got a single comment.
Well, many people don't have free days that often. It's actually a very short period of time.
wuz21m
Trained
Trained
Posts: 36
Joined: 18 Dec 2014, 20:57

Re: Can you look at my patch?

Post by wuz21m »

Forum is actually a good place for discussion, because we could use some feedback from people who actually encountered this problem.
I didn't want to appear self-important...
Well, many people don't have free days that often. It's actually a very short period of time.
...but it seems that I was a bit hasty
50 pixels is actually a lot (we still insist on supporting 640x480, and it's like 10% of the screen in this case, so it should look like a valid selection). Do you really manage to accidentally drag mouse that far instead of pressing? I'd expect 1-2 pixels at most.
Based on my observations, 25 pixels was the average and the worst cast was 50 pixels at 1280x720.

What we can do for small screens is to scale it. For 640x480, it will be about 33 pixels across (%7 of 480), 272 (16.5^2) square pixels at most (0.08% of 640x480). For selection, I think we must focus on area.

Of course, circular distance calculation can be implemented with a small cost (1 sqrt per render loop I believe).

For now I am gauging interest. This issue irritated me at Warzone 2100, I wanted to see if that is the case for others.

A possible alternative is supporting Starcraft style control (e.g. an extra option in the controls menu?). So if people want, they can use Click for selection and buttons and use right click for move commands.
User avatar
MaNGusT
Art contributor
Posts: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Can you look at my patch?

Post by MaNGusT »

you could just change in-game mouse options..
Image
wuz21m
Trained
Trained
Posts: 36
Joined: 18 Dec 2014, 20:57

Re: Can you look at my patch?

Post by wuz21m »

Is there an option for using left-click for select/click and right-click for move and attack?
If there is, I'm afraid that I have missed it.
User avatar
MaNGusT
Art contributor
Posts: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Can you look at my patch?

Post by MaNGusT »

wuz21m wrote:Is there an option for using left-click for select/click and right-click for move and attack?
If there is, I'm afraid that I have missed it.
on start menu, go to options, then go to mouse options. If you play 3.1.1 release ofc.
Image
wuz21m
Trained
Trained
Posts: 36
Joined: 18 Dec 2014, 20:57

Re: Can you look at my patch?

Post by wuz21m »

Oh, so that's what "Switch Mouse Buttons" means
:eek:
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Can you look at my patch?

Post by Per »

wuz21m wrote:And sorry for posting about this patch here. It has been 10 days and I only got a single comment.
Well, it is holiday season, and some of us at least have been away from keyboard travelling :)

I'll try to have a look at it soon.
wuz21m
Trained
Trained
Posts: 36
Joined: 18 Dec 2014, 20:57

Re: Can you look at my patch?

Post by wuz21m »

MaNGusT wrote:
wuz21m wrote:Is there an option for using left-click for select/click and right-click for move and attack?
If there is, I'm afraid that I have missed it.
on start menu, go to options, then go to mouse options. If you play 3.1.1 release ofc.
I tested this new mode for a number of the initial missions. But there is still one important difference compared to Starcraft.
While similar to Starcraft left-click is used for selection of units, when you use the left mouse button for selecting nothing in particular, you don't lose the previous selection. I will look at the code to see if I can propose a patch so if you select nothing, you would not lose the previous selection.
Per wrote:
wuz21m wrote:And sorry for posting about this patch here. It has been 10 days and I only got a single comment.
Well, it is holiday season, and some of us at least have been away from keyboard travelling :)

I'll try to have a look at it soon.
Thanks a lot!
Post Reply