|
-
Apr 23rd, 2003, 07:20 AM
#1
Thread Starter
Fanatic Member
BitBlt Game
Hi,
There is a little bit of flikering in my game.. need to improve it.. any suggestions...
Sorry once again, the file size is 134kb exe and 128kb source..
I will put it at my web site...
http://www.freewebs.com/pradeepkrao/games.htm
sorry for the inconvience
Thanks,
Pradeep
-
Apr 23rd, 2003, 06:08 PM
#2
-
Apr 23rd, 2003, 11:20 PM
#3
Thread Starter
Fanatic Member
Hae Cyborg
Hi,
Btw., you're getting really good at making games
Ha ha ha.. I am jobless in the office.. as a result....
The game doesnt have timers...
what i have done is...
VB Code:
Private Sub Form_Load()
Dim tmp As Long, t As Long, coun As Integer
Me.Show
mainPic.SetFocus
While Not gmloop
t = GetTickCount - tmp
If t > 1000 Then Me.Caption = "Attack - FPS : " & coun: coun = 0: tmp = GetTickCount
MoveAll
DrawAll
Chk4IndianArround
ChkCollision
DoEvents
DoEvents
coun = coun + 1
Wend
End Sub
Public Sub MoveAll()
Dim i As Integer
Static tmp As Long
If GetTickCount - tmp > 120 Then
tmp = GetTickCount
For i = 0 To UBound(USol)
USol(i).MoveMe
Next
Ind.MoveMe
End If
End Sub
Public Sub DrawAll()
Dim i As Integer
Static tmp As Long
Dim won As Long
Ind.DrawMe frmMain.mainPic
For i = 0 To UBound(USol)
USol(i).DrawMe frmMain.mainPic
Next
If GetTickCount - tmp > 120 Then
frmMain.mainPic.Cls
tmp = GetTickCount
frmMain.writelog
Ind.NextStep
For i = 0 To UBound(USol)
USol(i).NextStep
won = won + USol(i).Life
Next
End If
If won = -2 - 2 * UBound(USol) Then _
frmMain.mainPic.Print "You Have destroyed all the enemies": _
frmMain.mainPic.Print "You are victorious"
End Sub
The above is a part of the code... you may have a look at the whole code in my website..
Suggest me some good ideas..
By the way i thought the same idea could be adopted in 3d instead of animating a 3d object i will load say 6 such objects and during runtime i will draw one after another .. Would be very easy and faster as there is no need of any calculations..
Will consume a little bit more memory.. But I am running my OS on P4 512 MB Ram so should not matter..
Thanks,
Pradeep
-
Apr 23rd, 2003, 11:49 PM
#4
Thread Starter
Fanatic Member
Hurray Done...
First of all Thank you..
I have taken up your suggestion and made a small change in my code.. as a result I am getting an FPS of 5000... It was a great increase.. preveiously i was getting 400 FPS, that means about 12 times more speed...
VB Code:
Public Sub DrawAll()
Dim i As Integer
Static tmp As Long
Dim won As Long
Ind.DrawBullets frmMain.mainPic
For i = 0 To UBound(USol)
USol(i).DrawBullets frmMain.mainPic
Next
If GetTickCount - tmp > 120 Then
frmMain.mainPic.Cls
Ind.DrawMe frmMain.mainPic
For i = 0 To UBound(USol)
USol(i).DrawMe frmMain.mainPic
Next
tmp = GetTickCount
frmMain.writelog
Ind.NextStep
For i = 0 To UBound(USol)
USol(i).NextStep
won = won + USol(i).Life
Next
End If
If won = -2 - 2 * UBound(USol) Then _
frmMain.mainPic.Print "You Have destroyed all the enemies": _
frmMain.mainPic.Print "You are victorious"
End Sub
I have modified the draw function... I have made a new public function in the Universal Soldier class which draws the bullets fired by the soldier..
Since i used to draw the soldier every time ,it was creating flickering... Now i am only drawing bullets and soldiers are drawn once in 120 ms hence no flickering...
Thanks,
Pradeep
-
Apr 24th, 2003, 02:48 PM
#5
Frenzied Member
With timers i was refering to the loop with a temp variable that keeps track of the time...like this one:
VB Code:
If GetTickCount - tmp > 120 Then
tmp = GetTickCount
'etc....
there was many of those running at the same time in the game code......so by putting them all together into one timer would fix some problems...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|