Howdy, Stranger!

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

Categories

Framerates And Gameplay...

SephirothSephiroth Fayetteville, NC, USAMember Posts: 1,035
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

  • gautamgautam Member Posts: 642
    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, USAMember Posts: 1,035
    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, USAMember Posts: 1,035
    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]

  • gautamgautam Member Posts: 642
    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, USAMember Posts: 1,035
    : 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]

  • CroWCroW Member Posts: 348
    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, USAMember Posts: 1,035
    : 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]

  • CroWCroW Member Posts: 348
    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.
  • gautamgautam Member Posts: 642
    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.
    :

  • asm_rulesasm_rules Member Posts: 4
    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.


«1
Sign In or Register to comment.