Camera/Cursor Lock

Title explains

i am currently working on a snap mod that includes cursor lock

but it would be cool if this was in vanilla snap

Title isn't explaining it to me :frowning:

Could you expand on what your after?

its essentially turbowarps cursor lock


What does "cursor lock" mean?

have ou ever played an fps game

the mouse pointer stays in the center of the screen hidden, but things are still affected by the mouse

Got it finally :slight_smile:


Ah, that's cool but that's a fundamental misunderstanding about how mouse is used in games.
In some way that's actually impressive what they've done, because unless I'm misunderstanding, the entire level is loaded and you can move around freely.

Most games don't do that. Which is why that's impressive. What they do instead is use the mouse as your head and as a video camera, and a draw distance variable is created and everything beyond that number is ignored, everything in that distance is in memory, waiting to be used, everything in front of the camera is also rendered, and if the camera moves away from that object the renderer stops drawing it and passes it back to loaded memory waiting to redraw, unless you move out of the draw distance bounding box, in which case it's unloaded.

Quake did it in 1997. Horizon Zero Dawn does it now, so does Fortnite. One of the names the technique has is culling. The more advanced computers get the larger the variables can be and the more can be put in memory.

Fortnite is a great example of it actually, if you've ever watched a replay of your game, the engine doesn' t load the entire map again it only loads the area you're in and any players nearby. It tracks all the players, but you can't jump to someone on the other side of the map because the replay file doesn't have that information. It only has their information if they reach the same play area as you.

As a quick follow-up, I've looked around a couple of the other projects and I might be mistaken, a couple of them do seem to understand culling and it is in place in a couple, the portal project definitely does, and so did the world generator.

The mouse lock seems not to be working for me, and once I click the mouse, I can't use it to change any settings regardless of if I escape turbo lock or not and dragging the mouse to look around isn't working either.

I'm inclined to think I'm still right, and that the idea behind mouselock is to implement a solution to a problem they think they have but don't actually have.

uhh, what

In turbowarp, pointer lock hides you cursor, and locks it, but the mouse x and y reporters are changed to report the distance you moved the mouse.

yeah, i wonder if griffpatch made a tutorial on it

probably not tho

Yes, in fact he did, and I think it was the last tutorial he made.

I can't tell if you're being sarcastic or not

im not, and okay ill go check it out

oh yeah it is

i love that snap and scratch arent truely cross-compatible, but 98% of what you can do in scratch you can do in snap

Yeah, that's my bad, I think I misunderstood what was going on because I'm having issues with my mouse in pointer lock mode, It keeps bouncing back to 0.0 on most projects I tried. The only one that I got working was Mario Kart after I went to the mirror link.

In standard turbo warp the levels worked. I beat the portal level because I've played a LOT of portal lol. but as pointer lock wasn't available I had to keep re-centering the mouse.

those wacky scratchers tho.

That's normal. Pointer lock just reports the distance you moved the mouse, the bounces back to 0.

Oh that makes alot more sense now.