The Khronos Group - a non-profit industry consortium to develop, publish and promote open standard, royalty-free media authoring and acceleration standards for desktop and handheld devices, combined with conformance qualification programs for platform and device interoperability.

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Mouse pointer 'set position' or bust!

There has been a lot of talk about WebGL as a new platform for games. However, JavaScript lacks one feature that may prevent it from ever competing with the big boys. Unless there is some method unknown to me, a free-look camera that follows the movement of the mouse pointer, such as what you'd find in nearly every first-person AAA game, cannot be duplicated in JavaScript because you have to be able to set the position of the mouse pointer. This capability has been left out because of the clear security risk, but still...

Re: Mouse pointer 'set position' or bust!

It's certainly a serious pain...but I don't think you can overcome it - and I'm fairly certain that the browser writers will never provide you with that feature.

The problem is that the bad guys could either trap your mouse inside a series of advert slide-shows - creating the spam from hell - or they might be able to insert a mouse movement command into some content like a google advert and thereby trick you into "clicking" on something you didn't want to click on.

Imagine this:

1) Hide the mouse cursor.
2) Reposition the mouse cursor 100 pixels further down the screen.
3) Draw a fake mouse cursor where the user thinks it should be.

Now you can control what he clicks on, where he types his passwords...you name it.

There are a whole host of sneaky exploits you could do.

But it is a SERIOUS pain for people wanting to write "conventional" games like 1st person shooters...since you have no way to prevent the mouse from moving out of your window - you can't stop the player inadvertantly clicking on something just outside of your window in a fit of high-speed action and killing the game or doing something else rather nasty.

...and forget 1st person "mouse look" - there is no hope of being able to do exactly that.

I think we're going to have to look into the prospect of going back to game-pads and keyboards as the main input devices...with the mouse relegated to menu clicking and such.

Re: Mouse pointer 'set position' or bust!

What is the big deal then?!

I just came aware of that problem since I try to push my own app. What is the plan to solve this issue? When will this issue be solved? This is actually ridiculous that WebGL is told to be the new hot stuff for 3D and games around the net - and then it cant even maintain the most basic game-features?!

Please tell me, anyone, how this will be solved or I can see no reason why WebGL should be suitable for game-developers presenting their apps.. I can see more future for the "Adobeīs molehill API" instead..

Also: why would adobe not include/attach their flash-player to all browsers?! Should be the same like WebGL - but faster since JavaScribt does not seem to be a suiteable programming language..

Re: Mouse pointer 'set position' or bust!

Originally Posted by SteveBaker

It's certainly a serious pain...but I don't think you can overcome it - and I'm fairly certain that the browser writers will never provide you with that feature.

The problem is that the bad guys could either trap your mouse inside a series of advert slide-shows - creating the spam from hell - or they might be able to insert a mouse movement command into some content like a google advert and thereby trick you into "clicking" on something you didn't want to click on.

Imagine this:

1) Hide the mouse cursor.
2) Reposition the mouse cursor 100 pixels further down the screen.
3) Draw a fake mouse cursor where the user thinks it should be.

Now you can control what he clicks on, where he types his passwords...you name it.

There are a whole host of sneaky exploits you could do.

But it is a SERIOUS pain for people wanting to write "conventional" games like 1st person shooters...since you have no way to prevent the mouse from moving out of your window - you can't stop the player inadvertantly clicking on something just outside of your window in a fit of high-speed action and killing the game or doing something else rather nasty.

...and forget 1st person "mouse look" - there is no hope of being able to do exactly that.

I think we're going to have to look into the prospect of going back to game-pads and keyboards as the main input devices...with the mouse relegated to menu clicking and such.

It's definitely not going to be an easy transition.

I don't think it's a transition people will accept, at least not for FPS-type games. I am certainly aware of the potential exploits, but the fact is there are things that can be (and are) exploited now. The only solution I can think of is some kind of security enabling, where features are made available only if the site is somehow marked as a trusted one.

Re: Mouse pointer 'set position' or bust!

Thanks lthornblad, everyone..

1) what exactly is the problem why this wont be possible that easy?
2) Why would it be a security problem?

When this will be possible as you mentioned (to mark secure sites) I can at least see the point. The Khronos-Guys have to improve on that. I wonder what else wouldn't be possible. And I wonder what disadvantages the "molehill API" has.. Otherwise I can see everybody fall back to flash (which will have improved to be suitable for 3D - obviously better than WebGL)

3) May it be that ActionScript is the better (faster) programming language compared to JavaScript?
4) I assume you wouldn't have that "mouse pointer-issue" under ActionScript?!

Re: Mouse pointer 'set position' or bust!

5) Would you have the same issue under ActionScript?! I tried it quickly and it appears to be the same.. May it be that the stronger molehill API is limited to the same restrictions?!

I mean we are talking about the webs future in gaming - so far I cant see this happening. There will be a lot of good games even without the FPS-style.. But still: there are heaps of apps depending on this. At least tell us it wont ever happen so we can work around it

Re: Mouse pointer 'set position' or bust!

I explained why it's a security issue.

There are evil bad guys out there.

Suppose an advertiser makes a popup advert with embedded JavaScript...if they can reposition the mouse pointer - they can completely prevent you from clicking anywhere other than on their advert - they can prevent you from typing into another window - they can stop you from backing out of the web page...or even shutting down the browser! Most users will simply resort to rebooting the computer.

That's completely unacceptable - so we don't give JavaScript applications the right to do that. If you know of a way to avoid bad guys getting onto the Internet - that would be good - but all the while they're here - we have to put up with these kinds of restriction in the name of not having these bozo's screwing up our lives.

Actually - I believe that there are even NASTIER security implications - they could (for example) turn off the mouse cursor - clamp the mouse to the middle of the screen - but track how the user tries to move it and draw a FAKE mouse cursor at that location. You might think you were clicking on some button - when in fact you weren't. I bet a smart person could figure out a way to turn that into a hack that would let them steal your credit card number or something. It's just too dangerous.

Sure, it's a pain for games - we're going to have to find another paradigm. But that IS how it is - and it's NOT likely to change. Even if you did find a sneaky loophole way around it (which is unlikely, IMHO) - the browser writers would regard it as a bug and pretty soon, they'd "fix it".

So there is no point getting upset about it - you just have to start thinking of more creative ways to control your game. We had games before the mouse was invented - most console games don't use a mouse - there are ways. Adapt, improve.

Re: Mouse pointer 'set position' or bust!

Thanks for making this more clear to me, Steve..

Now I understand much better. So is this a pure JavaScript-issue? Would it be the same under ActionScript?

The thing is that this feature is indispensable for some games. How else would you play shooters like Counter Strike.. There isnīt a more convenient solution as the way we used to play games like this for years.. Its also the most intuitive control. A game controller would do the job. But it is not very user-friendly to expect everyone has one.

So yeah you might work around it in most cases - but when it comes down to shooters (and you dont have a pad): it is going to be such a pain!!

Thats why my question is: will it be the same under AS?

Please note that some devs rely on those statements before pushing every effort into development turning out to be not suitable for this specific job.

Re: Mouse pointer 'set position' or bust!

@Steve - Sure, we can live with it and find other ways, but they would hardly be ideal. I won't play FPS-style games on a console.

Although I have not tried, it seems quite possible to move the entire browser around to match the mouse position, thus preventing someone from clicking wherever they want. Even if that is not possible, there are always exploits. Hopefully, as the demand for quality web-based 3d apps grows, browser makers will find a solution.

@King - AS is Flash-only, I believe. Its use is more limited for those of us looking to make cross-platform apps. I don't know if it has the feature or not, but it could be exploited just the same. Perhaps that is why Apple refuses to support it.

Re: Mouse pointer 'set position' or bust!

Well I investigated this a bit: Yes, it will be the same under ActionScript. Which pretty much means there wont be any reasonable shooter coming up into the browsers for the next few years. Its crap but valuable to know - someone should have mentioned that earlier^^

To implement this in 3D would still not be ideal for FPShooters.. But we are getting there. The idea is to more conveniently pan the view instead of click&drag the camera. Let me know when you can think of a better way to control the camera in space.

*thoughts welcome*

When somebody runs into this, would you mind to share the source code? Iīll be trying to implement this. But using other engines + I dont have too much time to get it done