Network input handling

Started by
123 comments, last by hplus0603 11 years, 2 months ago

How can the client predict this locally?

You can simulate the arrow entirely locally, if it's the kind that goes away after it's done firing (a k a "bullet arrow.")
The trick is to show the results (hitpoints, particle systems, points, whatever) only after the server tells you what's happening.

how do you match up that entity with the one the server will create when it processes the player's "fire" command?

Send your temporary ID to the server. The server then includes a "creator id and creator-specific temporary id" field with the entity create command. Other players don't need this data, but if you are the creator, you match it up.
enum Bool { True, False, FileNotFound };
Advertisement
I think we're actually going to keep the arrows around for a while, perhaps even allowing players to pick up the arrows after they're shot as well, so it's not really a bullet arrow.

I suppose I see now how the client can send its temporary ID to the server, but it would require a bit of a rework of the current system. Right now, the high level commands (primary action, secondary action, walk forward, etc) are sent automatically to the server by the input system. There isn't a command for "fire arrow" because it depends on what your currently equipped weapon is. The system doesn't know it'll be firing an arrow until it gets further along with the input processing. I'd have to change it so that each individual system is responsible for sending out the commands after having processed the input. Which would also mean the server would have an entirely different code path for input handling. Is there a way around having to do this?

Why is it unacceptable? You either have an authoritative server on arrow-firing, or you don't.

Well I figured waiting the full round trip time + the 100ms from the dejitter buffer would be a very obvious delay on a combat-related action, which should appear to happen quickly.

which should appear to happen quickly.

If you play the animation instantly it will appear to happen quickly. If you wait for the server to confirm new entities the arrow will appear mid-air which might not even be noticeable.

If you play the animation instantly it will appear to happen quickly. If you wait for the server to confirm new entities the arrow will appear mid-air which might not even be noticeable.

Hmm, I suppose that is true. I'll give it a try and see how it works out.

Is there a way around having to do this?

Yes. You can add the new capability for subsystems to create objects, without removing the old input capability. "Created an object" is a new kind of "input" generated by the subsystems.
Then, you only use the "fired my weapon" trigger from the user input to run animations, and you use the "created an object" message from the subsystem as the thing that actually creates the object.

Another option is to go 100% deterministic, RTS-style, but if I remember correctly, the third-party engine you're using does not fully support that.
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement