Framerates And Gameplay...

SephirothSephiroth Fayetteville, NC, USA
OK, I can get an OpenGL world up and running, even fully textured, dynamically lit, and shadowed, but the polycount not only affects frames but movement. How can I get the proper movement value for movers and players? I can see some kind of a function that you send a desired movement value, it computes something based on framerate, and returns the correct value to move the entity that many units. Any help?

-[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]
«1

Comments

  • Hi,

    I want to clear up on this question. Is it that you encounter problems only during movement of the player(like when you use up, down etc) or is it that many a times the movement is totally screwed. If you could show the code of how you are moving your players or something - might be able to help.

    I am not sure if I understood your question correctly though.

    : OK, I can get an OpenGL world up and running, even fully textured, dynamically lit, and shadowed, but the polycount not only affects frames but movement. How can I get the proper movement value for movers and players? I can see some kind of a function that you send a desired movement value, it computes something based on framerate, and returns the correct value to move the entity that many units. Any help?
    :
    : -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]
    :

  • SephirothSephiroth Fayetteville, NC, USA
    It's not a problem so to speak, as mouselook and movement works fine. However, when there are a lot of polygons on the screen the player moves slowly and when there are only a few, he jets like a rocket. What I need is some function that I can send the desired movement rate to, have it take this value and calculate what it should be based on the current framerate, and then spew the reply.
    [code]
    short int MoveRate(short int desired)
    {
    short int actual;

    //Calculate what the "actual" value should be
    //based on the framerate. IE: if there is a
    //high framerate, "actual" may need to be 1 if
    //the "desired" was 2. If the frames are low,
    //it may need to be say, 4.

    return actual;
    }
    [/code]
    See what I mean? If a player is supposed to move 2 units every second or whatever, but I am getting 400fps, hewill be moving about 200units each second. I need to send a function my desired value and get back what I should actually move the player by to only move that value.

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

  • SephirothSephiroth Fayetteville, NC, USA
    It took me about thirty minutes, but I have a simple function that can calculate proper movement values for virtually anything in the game! Here's how it works:
    [code]
    //The function
    float GetMoveRate(float desired, float spf)
    {
    float actual;

    actual = (desired * spf);
    return actual;
    }

    //Down in the main loop...
    float ticker, movement;
    ...
    ticker = GetTickCount();
    DrawScreen(player);
    SwapBuffers(win_data.hdc);
    movement = (GetTickCount - ticker);
    ...
    [/code]
    I can now call my function with my desired rate of movement and the "movement" variable to get the correct amount of movement for my players and objects!

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

  • Hey,

    Congratulations.

    By the way have you ever used glAddSwapHintRectWIN function(opengl 1.1 extension) ??
    If you have I would like know how was the improvement in performance.


    : It took me about thirty minutes, but I have a simple function that can calculate proper movement values for virtually anything in the game! Here's how it works:
    : [code]
    : //The function
    : float GetMoveRate(float desired, float spf)
    : {
    : float actual;
    :
    : actual = (desired * spf);
    : return actual;
    : }
    :
    : //Down in the main loop...
    : float ticker, movement;
    : ...
    : ticker = GetTickCount();
    : DrawScreen(player);
    : SwapBuffers(win_data.hdc);
    : movement = (GetTickCount - ticker);
    : ...
    : [/code]
    : I can now call my function with my desired rate of movement and the "movement" variable to get the correct amount of movement for my players and objects!

  • SephirothSephiroth Fayetteville, NC, USA
    : Hey,
    :
    : Congratulations.
    :
    : By the way have you ever used glAddSwapHintRectWIN function(opengl 1.1 extension) ??
    : If you have I would like know how was the improvement in performance.
    :
    :
    Hadn't heard of that one yet. What does it do, and if it works well, I'll use it and let you know.

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

  • by the way,why dont you use a frame-limit?
    i use some kind of this to adjust the framerate to a given value:

    int a = GetTickCount() + 20; // 1000ms = 1s, 50 * 20ms = 1000 -> 50 fps
    DoRenderStuff();
    repeat until GetTickCount() - a < 0;
    lpD3DDevice->Flip(0,0,D3DFLIP_WAIT);
  • SephirothSephiroth Fayetteville, NC, USA
    : by the way,why dont you use a frame-limit?
    : i use some kind of this to adjust the framerate to a given value:
    :
    : int a = GetTickCount() + 20; // 1000ms = 1s, 50 * 20ms = 1000 -> 50 fps
    : DoRenderStuff();
    : repeat until GetTickCount() - a < 0;
    : lpD3DDevice->Flip(0,0,D3DFLIP_WAIT);
    :
    WHY would you limit frames? Is D3D THAT sorry, that you must limit frames to make it perform? The ONLY engine out there that has a limiter right now is the Half-Life engine, and my clanners and I can testify that the limiting effect does NOTHING but slow your fps. Valve claims that it helps latency, but I tried it on 33.6k, 56k, and now on 2mbps DSL, and it has never changed my pings. Frame-limiters are useless in gaming, but I can see how it would help in say, a level-editor or something.

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

  • youre right,but i doesnt mean proffesionell games with years of development-time and lots of resources to use.its just a little help for hobby-programmers who write their first game and searching for a way to hold the speed of the game constant on every possible machine.
  • Lol, Thats how got my first game to run at the same speed on hardware as well as software acceleration. If I hadn't put that it would have gone way too fast on hardware acceleration and slow on software acceleration. Ofcourse that first game was very simple game but it did teach me why one would use this part. However when it comes to threads I don't think this would be necessary.

    : youre right,but i doesnt mean proffesionell games with years of development-time and lots of resources to use.its just a little help for hobby-programmers who write their first game and searching for a way to hold the speed of the game constant on every possible machine.
    :

  • Since human's can only see about 25 frame's a second:
    -having more frame's is useless and making more is a waste of speed
    since it needs more frames a second AND you need to compute the
    values you had problems with. Say you had this nice game without
    framerate limiter, and I had one with Fps-lmtr than I could use
    A LOT more clock-cycles for (expensive shading, mirroring, ...)

    You can view the frame-rate in half-life and this isn't always the same (at least in opengl not).

    !!!!!
    !!!
    !
    A framerate-limitter hardly affects conection speed!
    @
    Framerate-limitters are used for optimal processor speed.
    Ping (or internet delay during CS or HL) are different from
    framerate-limiters ;-)

    If you would want to compare for fps,
    you should use different 3D accelerators, processors, ...
    AND NOT connection spedd.


  • SephirothSephiroth Fayetteville, NC, USA
    Don't know why this was replied to so late, but you're wrong. When Half-Life drops below 30fps it lags more. This is due to poor coding that Valve admits to in this area. Also, lower frames affect many more games where latency is concerned. I've been gaming and coding since my Atari400 way back in the early 80's. I have been in clans and on leagues for eons. I now run my own clan and from first-hand experience, frames and latency ARE related, though not directly. When you're playing a game and let's say somebody spams you with some explosive device that generates enough explosions to drop your frames to 5-15fps. Everybody else watches your ping go through the roof. The reason you never see that spike is due to the fact that it's taking forever to refresh your screen and by the time your frames go back up your ping has risen as well, and if you're lucky you're still alive! If what you say is the case, then my clanner Scope is defying the laws of science by pinging as low as 150ms from across the country on a 56k modem. Heck, if you look in the UnrealTournament Linux Dedicated Server guide, it tells you how to adjust two variables that change the framerate. Setting higher frames means lower pings, and setting lower means more free CPU, but higher pings. I set mine about 10fps higher than normal so that virtually ANYBODY can play on my server.

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

  • 25FPS : FALSE

    For movies OK, but for digital frames it's false. Read about the Shanon theorem about sampling. Because 3D is like discrete sampling you need at least twice the 25FPS rate, I would rather say the max screen FPS. Think of.

    Next Sephirot is right because these games are badly coded. Physics, that is game play, net transmission and FPS should be all clearly separated by appropriate timing of the code. But this requires more efforts in the coding architechture and induces subtle problems. So slowings are all too often related in commercial games.

    The best possible and fluent movement (I have tested it many times) is obtained like this :

    - Enforce a constant time step in the physics logically but not physically (slowing game).

    float LastFrameDuration = CurrTick - LastTick; LastTick = CurrTick;
    ....

    int numPhysicsFrames = (int)(FutureFrameDuration/100.0f);
    // in fact I use LastFrameDuration has it's hard to anticipate drops.

    while( numPhysicsFrames-- )
    {
    UpdateWorld(); // Update positions of objects.
    }

    Imagine your physics world is updated every 100FPS whatever the graphic FPS. Sometimes you will update several Physics steps and sometimes do nothing. But it's true that if the main loop falls below a certain FPS (explosion for instance) all will be messed up because routines won't be called on time. Thus delays and lags. But good 3D coding should prevent FPS drops in any case.

  • Oops forgot, while searching the word, think of the importance of the race car streaks in movement fluency for instance. (Continuous versus Discrete sampling)
  • SephirothSephiroth Fayetteville, NC, USA
    Yeah Karl, I agree. I game in almost ANY gae around, and I run an Infiltration clan. Playing Inf at 25fps is quite playable, but I can tell an immense difference when playing on my P2/233 at 20-30fps in fights and on my P3/866 at 50-80fps during fights. If that makes my eyes super-human, call me Superman :D!

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

  • Ok since you guys don't want to understand i'll explain:

    A tv screen has about twenty five wich is just enough
    A game could work fine with twenty five if its good.
    Let me show an example

    When you see a white dot move on black background it goes like this for eye, tv, nowadays games(30fps,) nowadays games (sixty fps).
    If you see a dot move (eye) its constantly seeing it
    camera does too but game's don't(yet).
    numbers represent the moment (in time).* indicates a half:
    1*=1.5

    eye: 11111222223333344444555556666677777 (nice)continuously
    tv: 1111 2222 3333 4444 5555 6666 7777 (also nice)
    game(30): 1 2 3 4 5 6 7 (bad)1 moment every frame
    game(60): 1 1* 2 2* 3 3* 4 4* 5 5* 6 6* 7 7* (looks nicer cause its closer to eye or tv than 30fps while tv needss only 25 and game makes 60 for a not even better view the game makes 60 screenshots of a moment and makes it seem continuously)

    The games only make a screenshot of 1 moment while your eyes keep seeing

    doesn't this say anything in the back of you mind?

    This doesnt mean we have to keep making moore fps (wich would work)
    but that we should draw the world differently:
    instead of computing the image of one moment, compute the begin and end of the period (1/30 of a sec is enough for 30fps note that 30*1/30=1sec)
    and then drawing (almost smudging the view) to get the same thing as tv: good quality with only 30 fps, no?

    your brains get the image from the eye and then edit it knowing the past data it got:
    whent it saw the dot fly around on a black background, it would sub some color of the rgb of the pixels it passed cause it knows they actuallly are darker but it just passed there during those moments.
    after this all the mind will interprete it.

    when you play a game with 25 fps it looks bad cause
    -it only computes the view of one moment while you need the view of the period : 1/fps
    -because the brain subs the color values instinctivly knowing where it
    is/was moving so that while playing a game with 25 fps where in example a grenade is thrown, the eye autommatically adds lighter colour (grenade is black) to the places it knows it must have passed (as you watch a grenade you Do know where it's going). if you don't understand it please reply again i'll explain with different examples

    But this all means that you guys can keep programming them the way they are hoping that all computers are getting higher and higher framerates,
    but that I'll search some algorithms that use begin and end place of every vector during the period of 1s/fps and draw the smudgy view wich does look better.

    It'll be hard to do so but once achieved I 'll get much nicer graphics since once I have it it's as good as the eye kind even better than the tv kind, because the tv has a little less (as you could see in my scheme above) because the camera of a tv has a shutter and a lot of the quality of a camera depends on how short it interrupts a view (thus preventing the smudge yes) (how shorter how better).
    On games with 25 fps that means that the shutter time is EXACTLY 1/25 of a second every time. This gives an ugly view.
    With 60fps you'll get a shutter time of 1/60 of a second which is better but still kind of sucks in comparision of a tv-camera

    The way of defining the quality of a camera(the shutter time) made me think of this all.

    Besides: proof:

    when you look around in high fps games and you turn around its good but still there's SOMETHING wrong with it, and you think its strange because if you don't move the SOMETHING WRONG dissappeared.

    While if you watch a movie that has a lot of movement (like turning around,...) it seems very good it stays the same!!!

    now here comes the proof:
    That nice video, pause it please on a moment in wich something moves really fast or something moves. Than you'll see the secret and sacred smudgy view I have been talking about the whole time,...
    But of course you'll say that's cuzz the video-recorder sucks and the screen doesn't even stay still, you're right but then I thought to try it wit DVD. You can REALLY pause those FOR REAL. And gues what?
    the SAME smudgy view, on DVD?,yes on DVD!

    Now I advice you to reread this all so if you misunderstood me somewhere you won't have to ask me (I don't forbid though).

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories