Recommended Posts

Hi!
I am new to these forums, so, if there is something I did wrong or I seem stupid, bear with me. I am a web security expert and I have lately been very interested in game programming, so, I decided to make a game of my own. :)
Anyway, currently my game does not have any limitations in speed, which is obviously bad. I would like to hear answers from experts about this area. My game will be an online game (it will be aimed for that), so, I think time based modelling is the way to go? I mean, instances move x pixels per second, not per frame. In multiplayer, each player will move as fast, but on a higher performance computers the animation is smoother.
I am working with VB.NET and DirectX. VB.NET, because it's simple language and I have been using it a lot for making programs and after all, I am making a simple home made program, thus, I don't need the power of C or C++...
At the moment I am recording my FPS and showing it on the screen. I am actually making a real time strategy game. And when I have 100 moving units on the screen at once, the FPS is around 500.
Public Declare Function GetTickCount Lib "kernel32" () As Long
Public mlngTimer As Long
Public mlngElapsed As Long
Public mlngFrameTimer As Long
Public mintFPSCounter As Integer
Public mintFPS As Integer
Public Sub Timer()
mlngElapsed = GetTickCount() - mlngTimer
mlngTimer = GetTickCount()
If GetTickCount() - mlngFrameTimer >= 1000 Then
mlngFrameTimer = GetTickCount()
mintFPS = mintFPSCounter
mintFPSCounter = 0
Else
mintFPSCounter = mintFPSCounter + 1
End If
End Sub
I don't know how to put that in code tags... anyway, I use that to count my FPS and then I draw mintFPS to the screen and it says 500. My problem is, how do I limit the times the screen is drawn. I don't like to draw the screen 500 times, it unnecessarily puts strain on the GPU and heats it... I want to sync it with the monitor Hz which is usually 60 on LCDs... so the FPS should be 60, right? I will of course put my game logic outisde the limiter, so, CPU will continue to do work even though the screen has been already drawn 60 times within the second. :)