Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 08 Jul 2012
Offline Last Active Yesterday, 09:49 PM

Posts I've Made

In Topic: Anyone tried Screeps, the MMO for programmers?

28 June 2015 - 06:25 AM

I'd love to try this.  Though I don't know how much time I can actually sink into it :(

In Topic: Game Loop Design

25 June 2015 - 05:19 PM

#1: It tends to be easier interpolating past positions (as I do) rather than into future positions (which is what the article above says to do).

Interpolating between 2 past time slices is easier but creates a visual delay (amount depending on the time between your logical updates). However, it works with all objects equally.

Interpolating into the future provides a real-time visual representation of the game world but can show things interpenetrating each other or other artifacts caused by linearly predicting ahead where an object will be. It also requires physics information such as velocity.


Yeah, you're right.  I think I'll interpolate between two previous states instead of estimating where they'll be.



// Sleep(0) -> What is the standard appropriate duration for this?

Remove this line. The “standard” is to not sleep at all.


Good to know.  Thank you.



// bDidUpdate = false;

The 2nd instance of this is useless.


Woops...That'll definitely be removed in my actual loop.


Extrapolation methods can be used, but testing shows there are far too many prediction errors because the world state itself is not deterministic (depending on the rules of your game).
You can only approximate the state ahead of time in a multiplayer game, because we can't know if or when another user will stop pressing a movement button.
This introduces prediction errors in the form of players jerking around and shots being missed. Players hate this.

The best method to use (in my experience) is interpolation instead of extrapolation, and a look-behind method of lag compensation. I limited the lag compensation to ~150ms to avoid absurd behavior - I know my game will be unplayable beyond this latency anyway.
This way, you can ensure consistent and enjoyable visuals without adding too much complexity to your state transitions.


Yeah, I see what you mean.



Thanks for the input everyone.  I have an even clearer idea in regards to how I'll be implementing this.

In Topic: Game Loop Design

23 June 2015 - 06:12 PM

In my case of a 3D networked game, the rendering interpolation is handled by the client logic, i.e. interpolating between two last known server states based on the current time / desired framerate.
The renderer simply draws what the client logic produces, it does not have to explicitly worry about interpolation of any sort.

This is not a definitive guide, it's just what I'm working with at the moment and somebody else could provide a much better alternative.


Yeah, I could see a networked game being interpolated in this fashion.  Though I feel that it might become problematic if there aren't additional prediction methods.



. . . snip . . .


t is for time, and I chose the values 1 and 2 for a simple example.


Interpolating physics based objects is quite simple as you will always have that data in memory and in use.  The question here is when you aren't using physics based movement for some objects and you need to interpolate for those objects as well, which again is simple until you consider that some objects will not even be rendered, and therefore you shouldn't be wasting time saving their previous frame data.  I'm looking for a clean solution for that.

In Topic: Anyone got any ideas where 4k a sec is coming from?

25 May 2015 - 05:45 PM

I recall there being one event that allocates memory and requires you to release it (though that's highly unlikely to be the cause) - double check the documentation.


Edit: You can always look into the SDL2 source (just search google).  The two repositories I found are https://github.com/spurious/SDL-mirror and https://github.com/zielmicha/SDL2

In Topic: Self-evaluating my programming skills?

21 April 2015 - 07:45 PM

There are quite a few things you can do to ensure you're progressing and/or to help you progress:


1.  Take a look at some of your older code bases from a year or so ago.  You should easily recognize things you could have improved upon.  In this case, you've been improving - regardless of whether or not you think so.

2.  Work on project euler problems https://projecteuler.net/archives and keep doing them until they become too difficult to solve.  Come back to those same problems 6 months to a year later and see how well you do.  I'll tell you right now that the questions that were previously difficult will be much easier, and again, you've been improving.

3.  Come up with a plan to improve your skills.  Make a list of topics you want to explore or problems you want to solve and knock them off your list one at a time (for example, I feel like I don't know nearly enough about multithreading and concurrency, so that's on my list).  I like to use trello for organization as it's nice and simple.  https://trello.com/


Yes, it'd be a great feeling for you to be able to answer some interview questions, but I don't think that'd solve your problem in the long run.