thewierdnut / endless-mobile

Space exploration, trading, and combat game.
https://endless-sky.github.io/
GNU General Public License v3.0
91 stars 6 forks source link

controlling fleet through touch #57

Closed zuckung closed 1 year ago

zuckung commented 1 year ago

Problem Description

Not sure if its just me, but i cant find a way to control my fleet in space through touch. 'gather' around me' and 'hold position' seems pretty important for capturing and saving captured ships.

Related Issue Links

-

Desired Solution

Maybe two new buttons to the lower right? Enabling/disabling on the same button, and text when changing this condition.

Alternative Approaches

-

Additional Context

No response

Lawrence-Krystal commented 1 year ago

Could be nice on the go honestly, I'm loving playing this game with a bt keyboard. But more on screen controls would be nice too. Granted it could get overcrowded...

thewierdnut commented 1 year ago

The overcrowding has been my primary concern. For the most part, I have kind of assumed that playing on the touchscreen would just have to be a different game experience than playing with a keyboard. There are a couple of competing concerns here...

  1. Stay true to the original source code, to make rebasing as painless as possible when new versions come out.
  2. Prevent overcrowding of controls in the bottom right.
  3. Keep gameplay usable on a touchscreen, where you essentially only have two thumbs to work with, instead of an entire keyboard.

Basically any change I make breaks 1, which already loses me a week of spare time every time a new version comes out. The bottom right controls are implemented using the interfaces config, which only has minimal support for dynamic controls. Every button I add just expands out to the left, which makes it more crowded and harder to find the control you want.

A couple of alternative solutions:

  1. Some sort of long press on the target icon, which would pop up options
  2. Change the AI to make it so that ships low on health (such as freshly captured ships) stick close to the flagship, or hang back from the battle.
  3. More complex gesture handling (draw a circle to gather around? an X to hold position? other possibilities? This could spiral out of control or get triggered inadvertently.)
zuckung commented 1 year ago

Ok, long press or gestures are good too. Just thought a button would be less work for you :) Dont really like the idea of changing ai, that would make the game easier. And there would be still missing control.

How about long press on any escort to make it stay in position? Not sure how the pc version handles this... hold position for single ships or all together. And maybe long press on flagship to make all escorts stay close? And for both commands another long press to release.

thewierdnut commented 1 year ago

I'll try a few things out. In the meantime, you can add those buttons yourself by creating a plugin if you want. The interface "main buttons" section in interfaces.txt just needs two new buttons that looks something like this:

    active
    visible
    sprite "ui/dialog cancel"
        from -420 -50 to -330 0
    button "Fleet: Gather around me" "Gather"
        from -410 -40 to -340 -10
    sprite "ui/dialog cancel"
        from -420 -40 to -330 -90
    button "Fleet: Hold position" "Hold"
        from -410 -40 to -340 -90
thewierdnut commented 1 year ago

Here, I just tested this plugin out, and it seems to work.

fleet_commands.zip

zuckung commented 1 year ago

Ok thanks

zuckung commented 1 year ago

And where is the endless sky folder? Cant find it under android/data.

thewierdnut commented 1 year ago

oh, use the plugin import button under preferences->plugins

Just give it the zip file.

zuckung commented 1 year ago

It works, tbh you dont need to implement these controls anymore^^

zuckung commented 1 year ago

Additional it would be nice to bring my ship to a full stop.

Found the entry in source/command.cpp ... guess its COMMAND::STOP? Or COMMAND::WAIT? Its missing an expression for adressing to a button in a plugin. Is there another way to adress it within a plugin? Cant find a guide to UI modding.

thewierdnut commented 1 year ago

Additional it would be nice to bring my ship to a full stop.

Command::STOP is the relevant one. unfortunately it doesn't have its own string. you typically trigger it using a combination of Command::BACK and Command::SHIFT, which we can't do.

This would have to be manually supported.

johndh commented 1 year ago
3. More complex gesture handling (draw a circle to gather around? an X to hold position? other possibilities? This could spiral out of control or get triggered inadvertently.)

I've played games that pull this off, and it could free up some screen space. The problem I could foresee is if upstream devs implement too many new commands.

IIRC, Eternium uses <>^vz, which are pretty hard to mess up or trigger accidentally. https://youtu.be/ptluPDDOKuU

zuckung commented 1 year ago

Well done with the hidden fast forward button, the landing button and the select next ship button. Modified your plugin to include a landing button, I can remove that now :)

On my command wishlist are a few more things Reverse thruster Boarding(to cycle through possible ships) Ofc the two fleet commands And the full stop(I don't get it, you can't just write a string into that brackets to call this function? Like all other functions there?)

Deselecting target is a problem with a big fleet too. Will put that on a plugin button as soon as you implement more commands.

Plugin with 4 buttons solves everything except the stop, but original game controls would be better. And btw many commands aren't obvious...maybe write a list at the beginning of the game or inside the menu(control, settings, plugins)?

thewierdnut commented 1 year ago

So... In my todo-list-in-my-head (which needs to become a real todo list), I've been meaning to do a few things:

  1. Make it so the reverse thruster fires automatically if you try to move directly backwards. (I keep avoiding this, because I hope somebody implements this upstream: https://github.com/endless-sky/endless-sky/pull/7703)
  2. I've been working on teasing apart the touchscreen controls from the mouse controls, so that I can do things like multi-button and gestures. I like the O><^vz idea, especially if the user can re-assign them as they see fit. Stay tuned.
  3. I want a full stop command too, but I can't think of a good way to pull it off that seems intuitive to the user. The best I can think of is if the user taps on their flagship, but I already have that behavior assigned to unselect all ships.
  4. Like any good programmer, I've been avoiding documenting any of the controls. I need to re-write the introductory tutorials with touchscreen-specific information in them, as opposed to the current ones that reference empty keyboard shortcuts.

As far as boarding, that is lower on my priority list, as you can always just fly up to the ship and tap on it. It doesn't seem worth it to clutter up screen real estate for such a control when it is possible to implement via a plugin instead. If you can think of a clean way to implement, I would love to hear it.

I would love to implement a more intuitive deselect behavior. Right now, you can do it by tapping on your flagship, but I would rather use that behavior to implement a STOP. The desktop program uses clicking on an empty spot to deselect everything, but the mobile port uses that for flight now.

The STOP command is hidden because it is meant to be triggered via shift-BACK. It should be easy enough to un-hide it though.

zuckung commented 1 year ago

The in-flight screen elements are nearly all used for commands. Just the ui on the right side is unused. Current system, flagship health and fuel/energy/heat display. And nothing of that feels natural to be combined with some sort of steering. Maybe the flagship health to deselect target... maybe that's better than some kind of gesture. Not sure.

I agree that tapping the flagship to stop would feel most intuitive.

Well, I stay tuned then :)

johndh commented 1 year ago

This issue might pair well with https://github.com/endless-sky/endless-sky/issues/7912

If more fleet commands and fleet management are done on a tactical pause screen (à la Homeworld) you can fit as many commands as you like.

thewierdnut commented 1 year ago

Plugin with 4 buttons solves everything except the stop...

Now you can add in a button using "Stop" to stop your ship

thewierdnut commented 1 year ago

I just committed some preliminary gesture support, and I would appreciate it if somebody would try it out and give me some feedback.

Currently, if you draw an X like this: image

It will issue a fleet: hold position command. If you draw a circle, it will issue a fleet gather command, and if you draw a V, it will issue a stop command.

The gesture engine also recognizes <>^ as well, though I haven't assigned those to anything. My eventual goal is to make all of those gestures user-assignable via the settings menu.

zuckung commented 1 year ago

Nice, works.

Just a small issue, when i command the fleet to hold position while targeting one of my ships, all stop. With button, just the selected ship stops. Same goes for gather.

zuckung commented 1 year ago

">" for afterburner? Then "<" for stop would be good/make sense.

thewierdnut commented 1 year ago

">" for afterburner? Then "<" for stop would be good/make sense.

You don't like the double-tap thing? I think afterburners need more fine-grained control than what gestures offer.

zuckung commented 1 year ago

I prefer buttons. In my opinion drawing gestures is too imprecise. But with the given ui you cant do much different than adding gestures. And you are right, afterburner need exact timing and steering.

Guess i stick with the buttons plugin. Added five more buttons, changed message text to not overlap, looks good. With main zoom factor 150 on a tablet, there is enough space for like 20 buttons.

But ist good that you implement all possibilities into the base game.

thewierdnut commented 1 year ago

No, I mean if you double tap when you start steering your ship, it should activate your afterburners.

As part of the new code, you should be able to do both though (steer with one thumb, activate afterburner with the other)

zuckung commented 1 year ago

Oh, didnt notice that. Fired it several times by accident and got confused how i hit the afterburner button. Thats a good solution.

zuckung commented 1 year ago

Just to clearify, there is no criticism. You have very limited options and your design for that is great, much better than i would do.

johndh commented 1 year ago
1. Stay true to the original source code, to make rebasing as painless as possible when new versions come out.

Noob question, would it make sense to merge these controls upstream with a bit of code that detects whether there's a keyboard and/or touchscreen installed? I don't know how much of a use case there would be, (I guess those laptops with the touch screens?), but it would keep the code bases more similar.

thewierdnut commented 1 year ago

Noob question, would it make sense to merge these controls upstream with a bit of code that detects whether there's a keyboard and/or touchscreen installed?

That is precisely how it is implemented it here. I've tried with some success to push useful changes from this fork upstream, but there is little appetite for changes that are not directly relevant to the desktop version, which is why I ended up creating the mobile fork in the first place. I can't see them accepting any changes not directly related to mouse/keyboard control.