[engine] Design of [query_location]

Brainstorm ideas of possible additions to the game. Read this before posting!

Moderators: Forum Moderators, Developers

Forum rules
Before posting a new idea, you must read the following:
User avatar
Ravana
Moderator
Posts: 1832
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

[engine] Design of [query_location]

Post by Ravana » January 25th, 2018, 3:05 pm

Idea description: https://github.com/wesnoth/wesnoth/issues/2325

I am looking for comments on how such function should work. Current plan:

Parameters

Code: Select all

-- location filter - unsure what to do when missing or when it matches no location
-- whether to fire old callback - or just disallow that if it allows attacking otherwise
-- WML variable for result - optional
-- custom confirm message - optional
-- custom overlay - optional
Result

Code: Select all

Function returns table {x=x,y=y}
WML variable with .x and .y is created
Design

Code: Select all

Overlay is added to all matching locations while selecting
Locations with fog/shroud are undecided how to handle
Ending turn is not possible while selecting
Attacking/moving/recruiting/basically everything I could think of to try is disabled
After selection there is confirm message to choose different hex
Cursor change is not possible.
Not sure how cancel should be reported.

Tad_Carlucci
Developer
Posts: 301
Joined: April 24th, 2016, 4:18 pm

Re: [engine] Design of [query_location]

Post by Tad_Carlucci » January 25th, 2018, 5:28 pm

My suggestions:
Location filter missing: select from entire map
Location filter, if present, must match at least one hex.
If filter only matches one hex, issue warning and select it automatically,
If filter matches no hex, issue error and select (-1, -1) in a (probably vain) attempt to proceed
Use (-1,-1) for cancel, just no error message logged.

Consider excluding fog/shroud from selection area by default and have options to enable it.

I envision an overlay masking non-selection area (ie., dark-gray/black where you can't select, normal map where you can)
And I envision another overlay showing what is selected (gold border?) click to toggle.

"Select All", "Select None" and "Toggle Selection" options might be good to have.

Options, default 1, for both min and max number of hex the player may select. Results are a table {x,y} or {{x,y},{x,y},...}

Translatable strings for title/heading and description.
While there should be fixed text about how, you do want to allow the UMC author someplace to explain the why.
I forked real life and now I'm getting merge conflicts.

User avatar
zookeeper
WML Wizard
Posts: 9734
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: [engine] Design of [query_location]

Post by zookeeper » January 25th, 2018, 5:34 pm

Tad_Carlucci wrote:If filter only matches one hex, issue warning and select it automatically,
I might be missing something since I haven't read the proposal very carefully, but the filter only matching one hex doesn't sound like it should result in a warnings; if there are limits on the allowed locations, then it's pretty likely that you regularly end up with situations with only one possible choice due to unit placement, terrain, whatever.

Tad_Carlucci
Developer
Posts: 301
Joined: April 24th, 2016, 4:18 pm

Re: [engine] Design of [query_location]

Post by Tad_Carlucci » January 25th, 2018, 5:45 pm

Entirely possible we can both read the idea and see our own ideas because it's rather nebulous. So I'm sorta brainstorming without a clear use case in mind .. just let the player select some hexes. Maybe if there is only one choice, you should stop and ask to proceed with that choice pre-selected. I was thinking "From these coordinates (oops only one here)" and that is not quite the same as "From trees in within 3 hex of this unit (oops, there are none, or only one)"
I forked real life and now I'm getting merge conflicts.

User avatar
Ravana
Moderator
Posts: 1832
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [engine] Design of [query_location]

Post by Ravana » January 25th, 2018, 5:49 pm

Adding option to request multiple locations is something I hadnt thought of, but seems useful. However, then I need some other way for user input than just clicking on hex (wesnoth.game_events.on_mouse_action).

Tad_Carlucci
Developer
Posts: 301
Joined: April 24th, 2016, 4:18 pm

Re: [engine] Design of [query_location]

Post by Tad_Carlucci » January 25th, 2018, 5:52 pm

How do you select a unit without a mouse? Arrow keys and some sort of hex selection outline? Tabbing from unit to unit? Same problem. Just act like every possibly selected hex has a unit you can't see on it?
I forked real life and now I'm getting merge conflicts.

User avatar
Ravana
Moderator
Posts: 1832
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [engine] Design of [query_location]

Post by Ravana » January 25th, 2018, 5:54 pm

Yes, but with initial plan clicking on hex selected it and went to confirmation message. When allowing multiple locations then it would be better for user to not have to go through that message for each added location.

Tad_Carlucci
Developer
Posts: 301
Joined: April 24th, 2016, 4:18 pm

Re: [engine] Design of [query_location]

Post by Tad_Carlucci » January 25th, 2018, 5:55 pm

Click on the unit, up pops a [message]-like area with icons and such.

"This unit has a Flame Thrower. Select up to 3 nearby forest tiles to attack this round."
I forked real life and now I'm getting merge conflicts.

User avatar
Ravana
Moderator
Posts: 1832
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [engine] Design of [query_location]

Post by Ravana » January 25th, 2018, 5:58 pm

Yes, that is what addon using this function might say.

I guess click to add location and next click on added location to finish might work.

Tad_Carlucci
Developer
Posts: 301
Joined: April 24th, 2016, 4:18 pm

Re: [engine] Design of [query_location]

Post by Tad_Carlucci » January 25th, 2018, 6:01 pm

Or a row of buttons along the bottom.

"Select All" "Select None" "Toggle Selection" "Done" and "Cancel" with appropriate hot keys etc.

The unit is on desert with no forest near, so "Done" is greyed and disabled. Nothing can be selected (so all and toggle probably can be disabled, too) but the user is seeing they could, if conditions were right but for now it's just "Cancel"
I forked real life and now I'm getting merge conflicts.

User avatar
Ravana
Moderator
Posts: 1832
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [engine] Design of [query_location]

Post by Ravana » January 25th, 2018, 6:01 pm

How to add such buttons without blocking game execution?

Tad_Carlucci
Developer
Posts: 301
Joined: April 24th, 2016, 4:18 pm

Re: [engine] Design of [query_location]

Post by Tad_Carlucci » January 25th, 2018, 6:06 pm

It's just a multi-select [option]-like box with buttons instead of a list of items. Seems to me it's just UI details. But it may not be possible without a lot of work .. I've not looked at how options work except to debug a couple mainline campaigns which used them like issuing AI priorities to allies.
I forked real life and now I'm getting merge conflicts.

User avatar
Ravana
Moderator
Posts: 1832
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [engine] Design of [query_location]

Post by Ravana » January 25th, 2018, 6:13 pm

[option] is only available in [message] which blocks game. And buttons can only be added to Lua dialogs, which also blocks game.

Tad_Carlucci
Developer
Posts: 301
Joined: April 24th, 2016, 4:18 pm

Re: [engine] Design of [query_location]

Post by Tad_Carlucci » January 25th, 2018, 6:33 pm

I'm lost. I'm thinking of a way for UMC to let the player do something at a distance from the unit or to multiple locations (like the flame thrower, above). So, yes, it has to be the player's turn and while it's up they can't end turn.

I don't really see a point to select a hex while another player is taking their turn. As I said, I'm not real sure of the possible use cases so I'm going with the one which popped into my head.
I forked real life and now I'm getting merge conflicts.

User avatar
Ravana
Moderator
Posts: 1832
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [engine] Design of [query_location]

Post by Ravana » January 25th, 2018, 6:58 pm

Implementation where when selecting game is blocked already exists.

I want minimal interruptions to chat - only when confirming selection if unavoidable, and even then doubleclick based timings would be preferred.

Post Reply