Pointer Lock API?

Discussion and feedback on Construct 2

Post » Thu Dec 20, 2012 8:08 am

It's new API is designed for HTML5 games to lock mouse pointer while is playing.

Is designed for 3D games, but 2D games too like RTS and something which use for infinite scroll.

https://developer.mozilla.org/es/docs/API/Pointer_Lock_API

Is possible to implement this API for C2?
B
96
S
25
G
20
Posts: 3,053
Reputation: 22,640

Post » Thu Dec 20, 2012 11:50 am

It's not necessary for RTS games, you can do infinite scroll just by detecting the mouse at the edge of the window. I'm not sure it's useful outside of 3D games, so I hadn't planned to support it.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Thu Dec 20, 2012 8:57 pm

There's also a problem with Pointer Lock API that isn't addressed for the moment : the pointer acceleration. Since the workgroup decided that they don't take it into account, I can imagine a lot of games were it's going to do some strange behaviors, since the mouse pointer is going to have a non-linear acceleration.
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Thu Dec 20, 2012 11:42 pm

I'm kind of disappointed in what the API turned to be.

I'm still waiting for a mouse pointer lock that would allow you to limit your mouse cursor to the canvas and even allow you to set the position of the cursor where/when you want.

I don't really see the need for the API discussed with what it's proposing.

Has anyone any practical example of use to make me change my mind ?Kyatric2012-12-20 23:43:06
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Fri Dec 21, 2012 1:02 am

[QUOTE=Ashley] It's not necessary for RTS games, you can do infinite scroll just by detecting the mouse at the edge of the window. I'm not sure it's useful outside of 3D games, so I hadn't planned to support it.[/QUOTE]

@Ashley Ah ok, then it's optional for future version, it would be nice to make new kind of game mechanics like rotating, zoom canvas without leaving the pointer outside of window.

There a 2D example:
http://www.smartjava.org/examples/pointerlock/

click window on right and say Ok to pointer lock permission, you can move your mouse to anywhere to make it infinite scroll, otherwise the left window is limited due to pointer position.

@Kyatric there a example above, some nice information about Pointer Lock API

http://www.html5rocks.com/en/tutorials/pointerlock/intro/Joannesalfa2012-12-21 01:05:50
B
96
S
25
G
20
Posts: 3,053
Reputation: 22,640

Post » Fri Dec 21, 2012 2:18 am

The 2D example does not work in Firefox at the moment, that's sad.

The quake viewer in the html5rocks article does work in FF though.
And it indeed locks the mouse's cursor out of the boundaries in full screen which is what I'd want
Not in "not-fullscreen" though. (EDIT: after test, it's only in FF for now that the cursor is not locked in "not-fullscreen")

It could be indeed an interesting behavior or addition to the mouse plugin once the API is a bit more stabilized and @Ashley has more time on his hands.

EDIT: With parallax I can see some 2D FPS and TPS that would still be nice looking and interesting to play.
You'd mostly move in a lateral way, hardly in depth even though it would be theoretically possible (cf CubeMaze by @FrenchYann).

Thanks @JoannesalfaKyatric2012-12-21 02:25:57
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Sat Feb 09, 2013 12:51 am

Now that C2 has 3D support from Mode7, can we get this in so it's possible to use the mouse in a 3D game.

B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Sat Feb 09, 2013 1:53 am

I guess @Ashley ignored this feature, i guess some Javascript SDK developer would create this plugin if he wants
B
96
S
25
G
20
Posts: 3,053
Reputation: 22,640


Return to Construct 2 General

Who is online

Users browsing this forum: BackendFreak, ijust8 and 15 guests