#How do I avoid a 1-frame delay between cursor and something moving with cursor?

47 messages · Page 1 of 1 (latest)

sullen flint
#

When the player drags an item with the cursor, the item is one frame behind. I used to just kind of put up with this, but I am pretty sure on a recent build/launch, this didn't happen. So now that I am pretty sure it's possible for it to not happen, how do I make it consistently not happen?

cunning tapir
#

I think this should mostly be a matter of figuring out when input polling happens and queueing your movement system right after

#

But you also need the constraint that this should still happen before rendering

sullen flint
#

I had assumed input polling would happen before the main stage

#

or the update stage or whatever

#

but maybe rendering happens in postupdate, I am moving my mesh there currently 🤔

#

Maybe I should just make my own stage

#

OK that changed nothing

cobalt gust
sullen flint
#

I don't know how I would check

cobalt gust
sullen flint
#

hmm

cobalt gust
#

So it looks like all the input is handled in PreUpdate

sullen flint
#

Can you like... click through to things like in IDE

cobalt gust
#

Are you not using Rust Analyser?

sullen flint
#

I mean can you do that in github?

cobalt gust
#

Oh no... I just searched for it.

sullen flint
#

damn, would've been nice

#

Trying to do the same with the render plug-in is maybe not as enlightening

cobalt gust
#

So how are you adding your movement code? Just adding a single system without specifying a stage?

sullen flint
#

Not specifying a stage explicitly means CoreStage::Update doesn't it?

cobalt gust
#

Yeah exactly.

sullen flint
#

Everything is in CoreStage::Update, except my mesh change, which is in CoreStage::PostUpdate

#

but when I tried to add a stage in between the two, for the mesh change, it didn't change outcome noticeably

#

I am not sure rendering happens in any particular core stage

cunning tapir
sullen flint
#

Could've sworn it was smooth just once, I remember taking note of it

cunning tapir
#

In other words exactly one frame delay is inevitable, but if it's noticeable it probably means either low fps, something is wrong or you are unfortunately very sensitive to input delay

sullen flint
#

I remember being surprised

sullen flint
#

I'm in the process of making a game cursor there

#

which will hide the problem somewhat

cunning tapir
sullen flint
#

Same, supposedly Dota 2 did it worse than HoN

#

but HoN is dead now, soo

cunning tapir
#

Damn, HoN, haven't seen that name in a long time lol

sullen flint
#
pub fn cursor_mesh() -> Mesh {
    let mut mesh = Mesh::new(PrimitiveTopology::TriangleList);
    mesh.insert_vertices([Vec3::ZERO, Vec3::NEG_Y, Vec3::X]);
    mesh.compute_flat_normals();
    mesh
}
#

I was thinking how I would make a placeholder cursor mesh

#

trying to like... reason out the triangles it would consist of

#

then after one triangle I was like wait I can stop here

cunning tapir
#

I'd just use a quad with an image personally

#

that way you can have fancy cursors without any unnecessary triangles

sullen flint
#

well it's just a placeholder, I am mostly trying to get the networking down

#

You know, unrelatedly, I am getting really sick of that garish orange background