Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 08-02-2002, 02:05 PM   #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
AlexDX is offline   Reply With Quote
Old 08-02-2002, 08:29 PM   #2
Member (9 bit)
 
Join Date: Jan 2001
Location: East Coast, USA
Posts: 320
Send a message via AIM to TMAN
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 :-).
TMAN is offline   Reply With Quote
Old 08-03-2002, 09:59 AM   #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...
AlexDX is offline   Reply With Quote
Old 08-03-2002, 02:22 PM   #4
Member (9 bit)
 
Join Date: Jan 2001
Location: East Coast, USA
Posts: 320
Send a message via AIM to TMAN
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).
TMAN is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 12:21 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2