Results 1 to 5 of 5

Thread: BitBlt Game

  1. #1

    Thread Starter
    Fanatic Member pradeepkrao's Avatar
    Join Date
    Sep 2001
    Location
    New Jersey
    Posts
    534

    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
    Learn by others experience as you cannot live long to experience them all.
    www.freewebs.com/pradeepkrao

    LOOK AT MY GAMES AT MY WEB SITE.

  2. #2
    Frenzied Member cyborg's Avatar
    Join Date
    May 2000
    Location
    Sweden
    Posts
    1,755
    I think you should combine all timers into one...

    If some of the stuff is drawn slower than something else, eventually it will not be drawn for one frame which will make it flicker...

    When putting all into one timer the timer wont tick until everything in it is done...That will make it draw everything smooth!

    Hope this helps!

    Btw., you're getting really good at making games
    Check out the FAQ and do a search before you post.
    My tutorials: Anti-Alias Pixels, Accurate Game Loop, Resource File

  3. #3

    Thread Starter
    Fanatic Member pradeepkrao's Avatar
    Join Date
    Sep 2001
    Location
    New Jersey
    Posts
    534

    Question 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:
    1. Private Sub Form_Load()
    2. Dim tmp As Long, t As Long, coun As Integer
    3.     Me.Show
    4.     mainPic.SetFocus
    5.     While Not gmloop
    6.         t = GetTickCount - tmp
    7.         If t > 1000 Then Me.Caption = "Attack - FPS : " & coun: coun = 0: tmp = GetTickCount
    8.         MoveAll
    9.         DrawAll
    10.         Chk4IndianArround
    11.         ChkCollision
    12.         DoEvents
    13.         DoEvents
    14.         coun = coun + 1
    15.     Wend
    16.    
    17. End Sub
    18.  
    19.  
    20. Public Sub MoveAll()
    21.     Dim i As Integer
    22.     Static tmp As Long
    23.     If GetTickCount - tmp > 120 Then
    24.     tmp = GetTickCount
    25.    
    26.     For i = 0 To UBound(USol)
    27.         USol(i).MoveMe
    28.     Next
    29.         Ind.MoveMe
    30.     End If
    31. End Sub
    32. Public Sub DrawAll()
    33.     Dim i As Integer
    34.     Static tmp As Long
    35.     Dim won As Long
    36.     Ind.DrawMe frmMain.mainPic
    37.     For i = 0 To UBound(USol)
    38.         USol(i).DrawMe frmMain.mainPic
    39.     Next
    40.      
    41.    
    42.     If GetTickCount - tmp > 120 Then
    43.         frmMain.mainPic.Cls
    44.         tmp = GetTickCount
    45.         frmMain.writelog
    46.         Ind.NextStep
    47.         For i = 0 To UBound(USol)
    48.             USol(i).NextStep
    49.             won = won + USol(i).Life
    50.         Next
    51.        
    52.     End If
    53.     If won = -2 - 2 * UBound(USol) Then _
    54.         frmMain.mainPic.Print "You Have destroyed all the enemies": _
    55.         frmMain.mainPic.Print "You are victorious"
    56.        
    57. 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
    Learn by others experience as you cannot live long to experience them all.
    www.freewebs.com/pradeepkrao

    LOOK AT MY GAMES AT MY WEB SITE.

  4. #4

    Thread Starter
    Fanatic Member pradeepkrao's Avatar
    Join Date
    Sep 2001
    Location
    New Jersey
    Posts
    534

    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:
    1. Public Sub DrawAll()
    2.     Dim i As Integer
    3.     Static tmp As Long
    4.     Dim won As Long
    5.    
    6.     Ind.DrawBullets frmMain.mainPic
    7.     For i = 0 To UBound(USol)
    8.         USol(i).DrawBullets frmMain.mainPic
    9.     Next
    10.    
    11.     If GetTickCount - tmp > 120 Then
    12.         frmMain.mainPic.Cls
    13.        
    14.         Ind.DrawMe frmMain.mainPic
    15.         For i = 0 To UBound(USol)
    16.             USol(i).DrawMe frmMain.mainPic
    17.         Next
    18.            
    19.         tmp = GetTickCount
    20.         frmMain.writelog
    21.         Ind.NextStep
    22.         For i = 0 To UBound(USol)
    23.             USol(i).NextStep
    24.             won = won + USol(i).Life
    25.         Next
    26.        
    27.     End If
    28.     If won = -2 - 2 * UBound(USol) Then _
    29.         frmMain.mainPic.Print "You Have destroyed all the enemies": _
    30.         frmMain.mainPic.Print "You are victorious"
    31.        
    32. 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
    Learn by others experience as you cannot live long to experience them all.
    www.freewebs.com/pradeepkrao

    LOOK AT MY GAMES AT MY WEB SITE.

  5. #5
    Frenzied Member cyborg's Avatar
    Join Date
    May 2000
    Location
    Sweden
    Posts
    1,755
    With timers i was refering to the loop with a temp variable that keeps track of the time...like this one:

    VB Code:
    1. If GetTickCount - tmp > 120 Then
    2.     tmp = GetTickCount
    3.     '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...
    Check out the FAQ and do a search before you post.
    My tutorials: Anti-Alias Pixels, Accurate Game Loop, Resource File

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width