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: mouse camera and nicer keyboard controls #9

Open
EmeraldSnorlax opened this issue Jan 30, 2024 · 5 comments
Open

feature request: mouse camera and nicer keyboard controls #9

EmeraldSnorlax opened this issue Jan 30, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@EmeraldSnorlax
Copy link

having fun so far, but it's a little miserable to play with a keyboard. is there any chance we could get controls that bring it more in line with other pc 3d platformer controls? (e.g. a hat in time)

for example you can move with wasd, move the camera with the mouse, jump with space, and do dash/grab with left and right click?

@EmeraldSnorlax
Copy link
Author

potentially related to #7 ?

@x8c8r
Copy link

x8c8r commented Jan 30, 2024

I second this so badly. Turning around during anything more than just walking on keyboard is impossible because camera controls are located right above the action keys.

My keyboard+mouse control scheme suggestion is following:
Moving: WASD
Camera: Mouse
Climbing: Shift
Jumping: Space or RMB
Dashing: E or LMB

This could definitely make it much easier to play for non-controller users, and add back a lot of missing precision.

@Viv-0
Copy link

Viv-0 commented Jan 30, 2024

I currently have an additional codebase that adds MouseDelta as a control scheme for the Camera, but I'm not really sure the best course of action given that there is the Camera Controls PR - dependent on whether or not that gets pushed to main would need two separate codebases for Keyboard control.

Right now, my code enables movement based on a frame-by-frame Mouse Delta (where it places the Mouse in the center of the window, then increments the Inputs and checks the resulting deltaPosition and uses that as a VirtualStick. One small problem with that: It normalizes for all stick inputs which is bad for specifically the Camera control (for every other joystick, it makes intuitive sense), in other words there's no "Sensitivity Controls"

In theory, if I add the Mouse Control feature to #7, then i would need to do it before EXOK team pushes the PR, which also means more work for Noel.

@NoelFB
Copy link
Contributor

NoelFB commented Jan 30, 2024

Yeah I am in favor of implementing this once #7 is resolved. I think the steps are:

  • Implement json remaps in general, as per Adds Controls Config file as a JSON #7
  • Implement some way to bind mouse input to VirtualStick/Axis, and make it actually work in-game
  • Implement the mouse bindings into the remap json/loader.

SnipUndercover pushed a commit to SnipUndercover/Celeste64 that referenced this issue Feb 4, 2024
Don't hot reload for autosaves and c# source code changes
@NoelFB
Copy link
Contributor

NoelFB commented Feb 4, 2024

Rebinding should work now (though you need to do it through a json file, not in-game right now). To get Mouse input to work, I think a custom binding should do something like this:

namespace Celeste64;

public class MouseAxisBinding : VirtualButton.IBinding
{
	public Vec2 Axis;

	public bool IsPressed => Value > 0;
	public bool IsDown => Value > 0;
	public bool IsReleased => Value == 0;
	public float Value => ValueNoDeadzone;

	public float ValueNoDeadzone
	{
		get
		{
			var normal = (Input.Mouse.Position - Input.LastState.Mouse.Position).Normalized();
			var dot = Calc.Clamp(Vec2.Dot(normal, Axis), 0, 1);
			return dot;
		}
	}

	public VirtualButton.ConditionFn? Enabled { get; set; }
}

However, to make this properly work Foster needs a mode to capture the Mouse cursor, which is doesn't right now, using SDL_SetRelativeMouseMode. That mode will also need to turn off as soon as you pause or alt-tab away from the game...

@NoelFB NoelFB added the enhancement New feature or request label Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants