Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: add a undo button #19

Open
oktomus opened this issue Apr 13, 2017 · 27 comments
Open

Feature request: add a undo button #19

oktomus opened this issue Apr 13, 2017 · 27 comments

Comments

@oktomus
Copy link

oktomus commented Apr 13, 2017

My phone is fairly small and I often misplace the blocks, that would be nice to add a button that undo only the last one action.

@Lonami
Copy link
Member

Lonami commented Apr 13, 2017

Someone else also suggested this. And I will use the same argument: this feels slightly cheaty. You can turn on the "snap to grid" feature (looks like a hashtag on the customization menu). Not sure what to do about this.

@oktomus
Copy link
Author

oktomus commented Apr 13, 2017

Ok or maybe add a tap to confirm the position of the block

@Lonami
Copy link
Member

Lonami commented Apr 13, 2017

Well… A confirm dialog every time you put a block would be really annoying, plus this is the same as an undo button (cancel is basically undo).

@oktomus
Copy link
Author

oktomus commented Apr 13, 2017

Yeah you're right. Where can I found the snap to grid feature ? Don't you think it would be great to enable it by default ?

@Lonami
Copy link
Member

Lonami commented Apr 13, 2017

Don't you think it would be great to enable it by default ?

Not sure, that's not how the original gameplay is meant to be and I find it a bit weird at first, so I made it optional. Also, this feature is only available on v0.5, which is available on F-Droid already!

@oktomus
Copy link
Author

oktomus commented Apr 13, 2017

Oh I see. Didn't see the option, I will have a look :) Thanks !

@ghost
Copy link

ghost commented May 7, 2017

Hi there,

I had the same idea today after moving a tile to the wrong place for the third time. Of course I read this completely and I can understand your feeling about the undo button being "slightly cheaty".
Maybe there's just something wrong with my fingers, I don't know.
So maybe instead of applying an undo button, you could implement a new mode for handicapped people?!
I thought of something like this: As long as you didn't touch a new tile, you can move the last placed tile to a new position.

After all, this game is the best what I have ever been looking for: Doesn't need any rights that could harm my mobile phone or my personal data, doesn't stress me when I don't want it, very good UI, still developed (there are many unfinished and abandoned apps!) and it really makes fun 😃

So thanks for the app!

@Lonami
Copy link
Member

Lonami commented May 7, 2017

As long as you didn't touch a new tile, you can move the last placed tile to a new position.

Could you please explain this a bit better? How would it exactly work?

So thanks for the app!

Thanks for the feedback))

@oktomus
Copy link
Author

oktomus commented May 7, 2017

What he means I think is that when you place a tile, you can still move it until you plance another tile.

@ghost
Copy link

ghost commented May 7, 2017

Could you please explain this a bit better? How would it exactly work?

I meant it almost like Oktomus said, just that you can't move the old tile anymore when you already touched a new one, regardless if it was placed or moved back to the bottom of the play field.

@Lonami
Copy link
Member

Lonami commented May 7, 2017

you can still move it until you plance another tile

I just don't like the fact that people could abuse this to think twice after they've placed the piece (something they should do before placing it). But then there's this issue, it might actually have been misplaced. Maybe I could limit this by only allowing the piece to be moved one tile (cell) to the sides, so either moving it one cell above, below, left or right. However this solution could feel "weird" in a sense: "Why can't I place the piece here if I'm moving it?".

Is there any way to detect the user intention (did they really misplace it or do they want to cheat)? ;)

What if I made it cost 1 coin to undo?

Or… I could detect how "accurate" placing the piece was, and if it's not very accurate, don't place it. But it would, again, be weird at times in my opinion. Uhm.

@ghost
Copy link

ghost commented May 7, 2017

That's why I thought about a new mode for disabled people instead of letting anyone "cheat" in one way or the other. It would get its own highscore, of course. That could even help people playing this game when they are in fact disabled and not trying to cheat.

disabled
My idea of a symbol for the German saying "he's got two left hands"

@Lonami
Copy link
Member

Lonami commented May 7, 2017

Either a button showing "accessibility" (typical single hand) with a tick for enabled/disabled, which would show both a custom score and share image, along with a new stunning undo button, or that button without the tick, which takes you to another window and explains what it does.

Though some other options are also strange (snap to grid is not clear at first), so maybe I could do the first option, and describe them somewhere else (i.e., a FAQ here, a wiki, or something).

@ghost
Copy link

ghost commented May 7, 2017

Whatever you like 😁
Thanks for the fast responses.
I think this can be closed again or maybe you should leave it open in the case anybody else wants an undo button :)

@bugabinga
Copy link
Contributor

Hey there!

I am absolutely against any undo or move-afterwards mechanic as I think it would make the game less fun. I get that people get frustrated and thinking about accessibility is important. But a little bit of frustration (challenge) is part of the game :).

Let me suggest a way to fix this in a cleaner way.
This is a classic UI problem.

"How does a human know the consequence of his (inter)action?"

The answer is to hint at what the outcome would be, before a person commits to an action.

Concretely for Klooni this could mean, that the tiles, where the piece would land if the player lifted his/her finger right now would be highlighted.
Another option is to show a "ghost" piece on the tiles where the piece would drop.
Yet another option is a subtle (slow) move animation of the piece the player is holding to the place it would drop.

My favorite is option 1, implemented a a glow on the tile. The color of the glow could either be part of a theme, or be automatically the inverse of the cell background.

Btw, I love the snap-to-grid feature. It helps me with playing the time based mode !

@ghost
Copy link

ghost commented May 19, 2017

I told you my body functions somehow strange. I DEactivated snap to grid. And now I almost never make mistakes. 😃

I like the ghost more, but I think it should be the taste of the programmer here, you can't please everyone.

@Lonami
Copy link
Member

Lonami commented May 19, 2017

I like the ghost more

I really doubt I add a ghost when we already have the snap to grid. The snap to grid shows the same as what the ghost would, but with the piece itself. And about the undo, it's not only I feel it cheaty, it's I would have to change a few things (pieces become shapeless pieces once put, so not easy to recover them). But… still open for discussion! Or alternatives.

@bangzek
Copy link

bangzek commented Aug 16, 2017

Well I vote for undo button because I have small phone and a fat finger.
This is really needed for one or two block piece.

If you worry about cheating just limit it only to move by one or two block radius.

@Lonami
Copy link
Member

Lonami commented Aug 16, 2017

Why do you (those who want the undo button) misplace the pieces? Is it because the finger covers the piece itself and it's hard to see or is it another reason? If it's the former, I can just pump up the offset value introduced on d31991a:

// Center the new piece position horizontally
// and push it up by it's a cell (arbitrary) vertically, thus
// avoiding to cover it with the finger (issue on Android devices)
mouse.sub(piece.getRectangle().width * 0.5f, -pickedCellSize);

@bangzek
Copy link

bangzek commented Aug 18, 2017

From my experience, when I drag, I see that it will be placed correctly but when I remove my finger they just shifted.

@bugabinga
Copy link
Contributor

bugabinga commented Aug 18, 2017 via email

@Lonami
Copy link
Member

Lonami commented Aug 18, 2017

average out the TOUCH_START and TOUCH_END

TOUCH_START? That sounds like when the piece itself is picked up! But I get your point, averaging maybe the last few positions of the touch. Could this affect time mode though, where you need to do it really quickly?

Can you link the code that handles that?

When the piece is dropped:

public boolean touchUp(int screenX, int screenY, int pointer, int button) {
PieceHolder.DropResult result = holder.dropPiece();

takes you to

public boolean putScreenPiece(final Piece piece) {
// Convert the on screen coordinates of the piece to the local-board-space coordinates
// This is done by subtracting the piece coordinates from the board coordinates
Vector2 local = piece.pos.cpy().sub(pos);
int x = MathUtils.round(local.x / piece.cellSize);
int y = MathUtils.round(local.y / piece.cellSize);
return putPiece(piece, x, y);
}

When the piece actually moves however, is when rendering the scene. The PieceHolder.update() method is called:

public void update() {
Piece piece;
if (heldPiece > -1) {
piece = pieces[heldPiece];
Vector2 mouse = new Vector2(
Gdx.input.getX(),
Gdx.graphics.getHeight() - Gdx.input.getY()); // Y axis is inverted
if (Klooni.onDesktop) { //FIXME(oliver): This is a bad assumption to make. There are desktops with touch input and non-desktops with mouse input.
// Center the piece to the mouse
mouse.sub(piece.getRectangle().width * 0.5f, piece.getRectangle().height * 0.5f);
} else {
// Center the new piece position horizontally
// and push it up by it's a cell (arbitrary) vertically, thus
// avoiding to cover it with the finger (issue on Android devices)
mouse.sub(piece.getRectangle().width * 0.5f, -pickedCellSize);
}
if (Klooni.shouldSnapToGrid())
mouse.set(board.snapToGrid(piece, mouse));
piece.pos.lerp(mouse, DRAG_SPEED);
piece.cellSize = Interpolation.linear.apply(piece.cellSize, pickedCellSize, DRAG_SPEED);
}
// Return the pieces to their original position
// TODO This seems somewhat expensive, can't it be done any better?
Rectangle original;
for (int i = 0; i < count; ++i) {
if (i == heldPiece)
continue;
piece = pieces[i];
if (piece == null)
continue;
original = originalPositions[i];
piece.pos.lerp(new Vector2(original.x, original.y), 0.3f);
piece.cellSize = Interpolation.linear.apply(piece.cellSize, original.width, 0.3f);
}
}

@scribbles
Copy link

Also experiencing issues with misplaced pieces from the long drag and drop model. Having the option to enable an undo button would seriously cut down on player frustration when those situations occur. Many similar games default to displaying an undo button on the main UI, including 2048.

@Lonami
Copy link
Member

Lonami commented Jul 24, 2020

Are you using the mentioned align to grid feature?

@scribbles
Copy link

I am. Tablets seem especially prone to this issue.

@Lonami
Copy link
Member

Lonami commented Jul 24, 2020

Tablets? I would expect those to be bigger than the average phone to not make this an issue. I can imagine this being an issue mostly on phones with small displays where a finger can easily cover where the piece would go but not a tablet.

@scribbles
Copy link

It only takes one slight spot on your stylus or screen. Repeated drag and drops that could be 5"+ in physical distance will eventually misplace. If the touch deregisters, you're stuck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@bugabinga @scribbles @oktomus @bangzek @Lonami and others