Fixed minor oversight (updating input on client-side)
This commit is contained in:
parent
c106094540
commit
dcccf78b04
|
@ -44,6 +44,11 @@ side prediction described in the second article. I'd imagine there's still a lot
|
|||
more to deal with, but we'll see how much of a difference this makes to how it
|
||||
feels. I'll report back.
|
||||
|
||||
** Entry 04: Whoops, little oversight!
|
||||
I didn't make the client update it's own input in the state constantly, so there
|
||||
wasn't the required "single-player" feeling in the client. Not exactly what
|
||||
we're going for, here!
|
||||
|
||||
* Notes On Techniques:
|
||||
** Entry 00: Where I'm Learning All This From:
|
||||
I'm using a series of articles from gabrielgambetta.com, which seem to be well
|
||||
|
|
|
@ -91,11 +91,13 @@ void * networkHandler(void * parameters)
|
|||
}
|
||||
}
|
||||
|
||||
void * gameThreadHandler(void * arguments)
|
||||
void * gameThreadHandler(void * parameters)
|
||||
{
|
||||
struct threadParameters * arguments = parameters;
|
||||
while (true)
|
||||
{
|
||||
doGameTick(arguments);
|
||||
updateInput(arguments->state, arguments->message);
|
||||
doGameTick(arguments->state);
|
||||
usleep(15625);
|
||||
}
|
||||
}
|
||||
|
@ -258,7 +260,7 @@ int main(int argc, char ** argv)
|
|||
parameters.message = clientInput;
|
||||
parameters.state = currentState;
|
||||
pthread_create(&graphicsThread, NULL, graphicsThreadHandler, ¶meters);
|
||||
pthread_create(&gameThread, NULL, gameThreadHandler, currentState);
|
||||
pthread_create(&gameThread, NULL, gameThreadHandler, ¶meters);
|
||||
pthread_create(&networkThread, NULL, networkHandler, ¶meters);
|
||||
|
||||
while (continueRunning)
|
||||
|
|
Loading…
Reference in New Issue