ExOK / Celeste64

A game made by the Celeste developers in a week(ish, closer to 2)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feature request: mouse camera and nicer keyboard controls

EmeraldSnorlax opened this issue · comments

commented

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?

commented

potentially related to #7 ?

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.

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.

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

  • Implement json remaps in general, as per #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.

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...