Recent

Author Topic: [SOLVED] Game speed and fps  (Read 24901 times)

DiCri

  • Full Member
  • ***
  • Posts: 151
  • My goal : Build a game
    • http://manueldicriscito.altervista.org/DinoLand.zip
Re: Game speed and fps
« Reply #15 on: September 12, 2016, 03:25:56 pm »
I found this

http://www.gamedev.net/topic/651698-advice-to-lock-frame-rate/

Maybe that's what i was searching for! I am too bad at explain things on english so see if this can be good for me
What is VSync??
I'm a game developer.. Now studying..
Go download my game:
http://manueldicriscito.altervista.org/DinoLand.zip

Handoko

  • Hero Member
  • *****
  • Posts: 5545
  • My goal: build my own game engine using Lazarus
Re: Game speed and fps
« Reply #16 on: September 12, 2016, 03:39:36 pm »
If you play computer games a lot, then you should know there is an option called vertical synchronization.

I'm not very sure about it. If I'm not wrong if the graphics card run too fast, I mean the refresh rate is too high, it may cause some display problem on older monitors. So they need to be synchronized. Usually it needed when running 3D games.

Modern monitors, I think no need to perform this synchronization. But I hear some people still do this thing. I never saw any problem when my graphics engine (via OpenGL) runs very fast on my LCD monitor.

https://en.wikipedia.org/wiki/Analog_television#Vertical_synchronization

lainz

  • Hero Member
  • *****
  • Posts: 4743
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Game speed and fps
« Reply #17 on: September 12, 2016, 04:27:24 pm »
The VSync is for preventing screen tearing, search for images at google to see it clearly.

DiCri

  • Full Member
  • ***
  • Posts: 151
  • My goal : Build a game
    • http://manueldicriscito.altervista.org/DinoLand.zip
Re: Game speed and fps
« Reply #18 on: September 12, 2016, 05:34:53 pm »
@Haռɖօҡօ i updated the exe file with a fixed fps meeter.. Can u download it and tell me how much fps there are playing game? ( now death is disabled )
I'm a game developer.. Now studying..
Go download my game:
http://manueldicriscito.altervista.org/DinoLand.zip

lainz

  • Hero Member
  • *****
  • Posts: 4743
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Game speed and fps
« Reply #19 on: September 12, 2016, 05:56:31 pm »
@Haռɖօҡօ i updated the exe file with a fixed fps meeter.. Can u download it and tell me how much fps there are playing game? ( now death is disabled )

I'm not handoko but I've donwloaded the new exe and doesn't run. In the console says SDL Loaded and nothing more.

DiCri

  • Full Member
  • ***
  • Posts: 151
  • My goal : Build a game
    • http://manueldicriscito.altervista.org/DinoLand.zip
Re: Game speed and fps
« Reply #20 on: September 12, 2016, 05:57:56 pm »
@Haռɖօҡօ i updated the exe file with a fixed fps meeter.. Can u download it and tell me how much fps there are playing game? ( now death is disabled )

I'm not handoko but I've donwloaded the new exe and doesn't run. In the console says SDL Loaded and nothing more.
Ooh sorry lainz i forgot!! After SDl loaded you should write '0' and press enter and gane will starst
I'm a game developer.. Now studying..
Go download my game:
http://manueldicriscito.altervista.org/DinoLand.zip

Handoko

  • Hero Member
  • *****
  • Posts: 5545
  • My goal: build my own game engine using Lazarus
Re: Game speed and fps
« Reply #21 on: September 12, 2016, 05:59:01 pm »
The FPS is not constant. I saw it ranges from 1?? to 3???, but most of the time is about 5 hundreds something.

Perhaps I'm having a very good NVidia Geforce 430 VGA card.  :D

lainz

  • Hero Member
  • *****
  • Posts: 4743
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Game speed and fps
« Reply #22 on: September 12, 2016, 06:01:24 pm »
@Haռɖօҡօ i updated the exe file with a fixed fps meeter.. Can u download it and tell me how much fps there are playing game? ( now death is disabled )

I'm not handoko but I've donwloaded the new exe and doesn't run. In the console says SDL Loaded and nothing more.
Ooh sorry lainz i forgot!! After SDl loaded you should write '0' and press enter and gane will starst

With an i7 and the integrated graphics card intel hd graphics goes to 850 fps.

Handoko

  • Hero Member
  • *****
  • Posts: 5545
  • My goal: build my own game engine using Lazarus
Re: Game speed and fps
« Reply #23 on: September 12, 2016, 06:01:46 pm »
Hello lainz. Do you use SDL? Do you know how to make it runs on fixed FPS speed?

lainz

  • Hero Member
  • *****
  • Posts: 4743
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Game speed and fps
« Reply #24 on: September 12, 2016, 06:02:41 pm »
Hello lainz. Do you use SDL? Do you know how to make it runs on fixed FPS speed?

I've used it with C some months ago. Not really, i've created a small level editor but nothing more.

Handoko

  • Hero Member
  • *****
  • Posts: 5545
  • My goal: build my own game engine using Lazarus
Re: Game speed and fps
« Reply #25 on: September 12, 2016, 06:04:20 pm »
@lainz:

Does the performance stable on different computers?

@Manu12x:

I like the game runs at the lightening fast. Very challenging and exciting. But it should not be that fast at the beginning.
« Last Edit: September 12, 2016, 06:07:43 pm by Handoko »

DiCri

  • Full Member
  • ***
  • Posts: 151
  • My goal : Build a game
    • http://manueldicriscito.altervista.org/DinoLand.zip
Re: Game speed and fps
« Reply #26 on: September 12, 2016, 06:08:13 pm »
@lainz:

Does the performance stable on different computers?

@Manu12x:

I like the game run at the lightening fast. But it should not be that fast at the beginning.
Handoko, from the image i see there's not the fps meter.. But now i know how to fix that! Adding vsync, fps are always 60 for all
I'm a game developer.. Now studying..
Go download my game:
http://manueldicriscito.altervista.org/DinoLand.zip

lainz

  • Hero Member
  • *****
  • Posts: 4743
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Game speed and fps
« Reply #27 on: September 12, 2016, 06:10:29 pm »
It was basically a thing for learning, I've tested my software only in a single PC.

I was using this tutorials
http://lazyfoo.net/tutorials/SDL/index.php

And this one is related with frame rate with no VSync:
http://lazyfoo.net/tutorials/SDL/25_capping_frame_rate/index.php

If you need help reading the C source tell me.

Handoko

  • Hero Member
  • *****
  • Posts: 5545
  • My goal: build my own game engine using Lazarus
Re: Game speed and fps
« Reply #28 on: September 12, 2016, 06:18:58 pm »
The 2nd tutorial uses delay to achieve stable frame rate. It's okay, but I think the best one is using delta time. Because using delay has one noticeable disadvantage. That is, if the computer is too slow to draw the frame, user will experience the lag.

Using delta time isn't perfect too. But the slowdown usually is less noticeable. Because if the frame rate drop, the movement is multiplied with the delta time. It is said, this is very important on multiplayer games (over network or internet), because you have to synchronize the position of the sprites with other players without worry about the computers performance.
« Last Edit: September 12, 2016, 06:26:25 pm by Handoko »

lainz

  • Hero Member
  • *****
  • Posts: 4743
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Game speed and fps
« Reply #29 on: September 12, 2016, 06:23:15 pm »
The 2nd tutorial uses delay to achieve stable frame rate. It's okay, but I think the best one is using delta time. Because using delay has one noticeable disadvantage. That is, if the computer is tool slow to draw the frame, user will experience the lag.

Using delta time isn't perfect too. But the slowdown usually is less noticeable. Because if the frame rate drop, the movement is multiplied with the delta time. It is said, this is very important on multiplayer games (over network or internet), because you have to synchronize the position of the sprites without worry about the computers performance.

Ok that's a good point. I will try to start again with SDL from now with Lazarus.

@Manu

Your code is not easy to read, maybe you can put it at least in procedures and functions to structure it a bit.

the code shoulr look like this

Code: Pascal  [Select][+][-]
  1. begin
  2.  
  3. init
  4. mainloop
  5. finish
  6.  
  7. end

in the procedure mainloop you add the actual code with another 2 procedures at least

Code: Pascal  [Select][+][-]
  1. mainloop
  2. - input
  3. - render

and that will be more easy to read.

if you want you can split your code into units, more easy to read, for example in one unit put the types, in other the input, in other the rendering.

Another suggestion:
Use GitHub to store your code, so you can keep and track your changes easily.
« Last Edit: September 12, 2016, 06:25:10 pm by lainz »

 

TinyPortal © 2005-2018