|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (5 bit)
Join Date: May 2002
Location: Mtl,CAN
Posts: 16
|
A VB guru gimme SPEED
VB is slower than I ever taught...
Ive never seen a good game in VB that wasnt DirectX, or that didnt use crap 8 bit sprites & graphics or that didnt completely destroy your monitor & display settings. So I want to make one .The thing is that we already have done some very good 2D graphics and have good ideas but even the most basic build runs slow. Hey now I need help. When I run the basic demo of just an alien spaceship flying on the screen (without complex background, without explosions or anything like that) at lets say a small game screen about 200x200 pixels, everything is nice, I get 93+ fps Xelent.But when I make the screen larger, like 600x600 (something like the final game screen will be) I get an unacceptable, horrible 32- fps. Here is the code, I dont know what is wrong Private Sub Timergameon_Timer() If lasttime = 0 Then backbuffer = CreateCompatibleDC(picgamescreen.hdc) bufferbmp = CreateCompatibleBitmap(picgamescreen.hdc, picgamescreen.ScaleWidth, picgamescreen.ScaleHeight) SelectObject backbuffer, bufferbmp timenow = GetTickCount lasttime = timenow Else timenow = GetTickCount End If 'Code for position,speed,collision detection bla bla etc 'not important for the display If GetAsyncKeyState(vbKeyDown) <> 0 Then BitBlt backbuffer, shipx, shipy, picshipjetmask.ScaleWidth, picshipjetmask.ScaleHeight, picshipjetmask.hdc, 0, 0, vbSrcAnd BitBlt backbuffer, shipx, shipy, picshipjet.ScaleWidth, picshipjet.ScaleHeight, picshipjet.hdc, 0, 0, vbSrcPaint Else BitBlt backbuffer, shipx, shipy, picshipmask.ScaleWidth, picshipmask.ScaleHeight, picshipmask.hdc, 0, 0, vbSrcAnd BitBlt backbuffer, shipx, shipy, picship.ScaleWidth, picship.ScaleHeight, picship.hdc, 0, 0, vbSrcPaint End If BitBlt picgamescreen.hdc, 0, 0, picgamescreen.ScaleWidth, picgamescreen.ScaleHeight, backbuffer, 0, 0, vbSrcCopy End Sub What can be done (if something can be done) to improve performance?????? I know that if I run this on a P4 2.53 there isnt any slowdown but this simple thing should run well even on a P1. If u dont see whats wrong, tell me if uve seen at least one quality game in VB (no DirectX) so I can hope this can work
|
|
|
|
|
|
#2 |
|
Member (9 bit)
|
why are you making a game in VB!? If you want speed, switch to C++. VB simply wasn't made for games! A library like wxWindows or MFC will make the transition easier. If you won't (for some strange and horrible reason) switch to C then check if you can compile to native code- VB 5.0 and up if I'm not mistaken. Check for excessive loops, and see if you can't use recursion. If this doesn't work and you still wont make the switch... you're screwed :-).
|
|
|
|
|
|
#3 |
|
Member (5 bit)
Join Date: May 2002
Location: Mtl,CAN
Posts: 16
|
Yea I know C++ is way faster.
But the thing is, if i wanted to do just the killer interface that took me a couple of hours in VB, it would take me a year+ in C! I know C++ but only console programming (dos not win), yo when I look at everything I must do for just creating a window with a button on it (takes approx 6 sec in VB), Im kind of afraid... |
|
|
|
|
|
#4 |
|
Member (9 bit)
|
like I said, their are libraries that make doing things feared in C++ (like creating a window) extremely easy to do. However, straight win32 becomes exponentially less intimidating once you've coded it once or twice (not just copy and paste).
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|