(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
05-03-24 12:16 PM
0 users currently in Programming.
Acmlm's Board - I3 Archive - Programming - Let's Rant about Visual Basic! New poll | |
Pages: 1 2 3 4Add to favorites | Next newer thread | Next older thread
User Post
Drag

80








Since: 01-18-07
From: USA

Last post: 6284 days
Last view: 6283 days
Posted on 01-18-07 08:50 PM Link | Quote
Back when I was using VB, I would use pset to draw my images. Yep, that was pretty slow, but this was maybe 4 or 5 years ago, before I knew C++. Then I found out about bitblt or whatever... isn't that GDI? When I used bitblt, it wasn't as bad, but when I had to do per-pixel things, it was still slow, even when using GDI's pixel setting method.
Also, why does the scaling default to twips? Why doesn't it default to pixels? What are twips good for?

VB is ok when I'd like a fast way of testing something out, but if I were making a game or a program, I'd use C++.

Edit: AAAH! Kawa's layout is attacking me!


(edited by Drag on 01-18-07 02:51 PM)
never-obsolete

Paragoomba








Since: 05-14-06
From: AZ

Last post: 6285 days
Last view: 6285 days
Posted on 01-18-07 09:00 PM Link | Quote
great for rad, but lack of function overloading, structured exception handling, and arrays of constants are some of my biggest complaints because i use them so often in Java and C++.
Sukasa

Birdo
Not quite as active as before.
Xkeeper supporter
Xk > ||bass
I IP Banned myself! Twice!








Since: 11-17-05
From: Somewhere over there

Last post: 6284 days
Last view: 6283 days
Posted on 01-23-07 06:38 PM Link | Quote
Originally posted by Kyoufu Kawa
Originally posted by asakuS
They're all cool, actually
I'm using the windows GDI for my graphics work (IIRC it's insanely slow), so I'm looking into directdraw, and the message pump is supposed to be crappy
OBJECTION!

My first attempt at a fighting game used GDI exclusively for it's graphics and was as fast as a greased hedgehog. In my last attempt, I found out that lowering the color depth helped for DirectX.


Then what the hell am I doing to make this program so slow?

And for arrays of constants, you can make a workaround for this somewhat like this:

Dim ConstArray(2) As Long

Private Sub form_Load()
ConstArray(0) = 23459287
ConstArray(1) = 22938478
ConstArray(2) = 7457483
End Sub


I've done that a few times. Twips have something to do with printers and the screen or something, Drag.

So, Kawa, what did you do to get your fighting game going so fast? I'm going to assume you used a loop, right? I mentioned the Message pump because as I understand C++, that's how *any* windows program gets it's messages, and that VB6 compiles the program with a poor setup for that pump |;
Kyoufu Kawa
Intends to keep Rom Hacking in one piece until the end








Since: 11-18-05
From: Catgirl Central Station

Last post: 6283 days
Last view: 6283 days
Posted on 01-23-07 08:36 PM Link | Quote
The regular: set up a backbuffer and BitBlt/StretchBlt other dibs onto it. Lightning fast, but few special effects aside from stretches.
Sukasa

Birdo
Not quite as active as before.
Xkeeper supporter
Xk > ||bass
I IP Banned myself! Twice!








Since: 11-17-05
From: Somewhere over there

Last post: 6284 days
Last view: 6283 days
Posted on 01-23-07 11:22 PM Link | Quote
... That's what I've been doing, too... but the routine is insanely slow How big are your blits? I'm running a 640 by 480 canvas, 24-bit colour depth, and I'm doing transparent blits like this:

BitBlt Canvas.hdc, 0, 0, 640, 480, UI1m.hdc, 0, 0, vbMergePaint
BitBlt Canvas.hdc, 0, 0, 640, 480, UI1.hdc, 0, 0, vbSrcAnd


Since I'm getting a fair bit of slowdown, I'm looking through some of my other routines, as I think that a couple other parts of this form are causing a good part of the problem... I know at least one thing that's likely a problem right now
Guy Perfect









Since: 11-18-05

Last post: 6285 days
Last view: 6284 days
Posted on 01-24-07 03:38 AM Link | Quote
If you're using a Form or PictureBox as the source of the DC, it'll be slow. Use the GDI to create an in-memory DC and work with that.
Sukasa

Birdo
Not quite as active as before.
Xkeeper supporter
Xk > ||bass
I IP Banned myself! Twice!








Since: 11-17-05
From: Somewhere over there

Last post: 6284 days
Last view: 6283 days
Posted on 01-24-07 05:09 PM Link | Quote
Using a DIB section, then after everything is done, blitting from the DIB canvas to a picturebox.

EDIT: Went through, and still can't figure out any possible cause of the slowdown other than that paint routine :/ I'm just going to look at using DirectX 8 for this and see about perhaps using Direct3D or DirectDraw, and switching to DirectInput and DirectMusic for the other parts of the program


(edited by asakuS on 01-24-07 11:40 AM)
Guy Perfect









Since: 11-18-05

Last post: 6285 days
Last view: 6284 days
Posted on 01-25-07 12:08 AM Link | Quote
OpenGL is much easier to use from VB than DirectX.
Sukasa

Birdo
Not quite as active as before.
Xkeeper supporter
Xk > ||bass
I IP Banned myself! Twice!








Since: 11-17-05
From: Somewhere over there

Last post: 6284 days
Last view: 6283 days
Posted on 01-25-07 07:52 PM Link | Quote
Is it faster than DirectX?

I'm using DirectInput now to get input from the keyboard ,instead of Form_KeyDown and Form_KeyUp. Direct3D made it look like crap, so I'm still using Bitblt, as DirectX8 doesn't seem to have DirectDraw from what I could see :/

And speeding up the program a bit by changing little things, but I really need to figure out a better way to do graphics, those are definitely the slow spot in Battletankz.
Guy Perfect









Since: 11-18-05

Last post: 6285 days
Last view: 6284 days
Posted on 01-25-07 10:14 PM Link | Quote
OpenGL is indeed faster for the fact that it's not object-oriented and runs for the most part on the video hardware; just simple commands being passed from your program. And while it doesn't apply to VB so much, the fact that DirectX requires use of classes means it can't be used from C, which is arguably the best language to use for compatibility and speed.
Sukasa

Birdo
Not quite as active as before.
Xkeeper supporter
Xk > ||bass
I IP Banned myself! Twice!








Since: 11-17-05
From: Somewhere over there

Last post: 6284 days
Last view: 6283 days
Posted on 01-26-07 03:59 AM Link | Quote
Hm, I'll have to look into that. The single biggest slowdown issue in this game is redrawing the non changing UI elements and the battlefield, with I could do with minimal CPU usage is there was a way to create the picture on hardware in somewhat the way the Super Nintendo uses Layers. I'm not going to assume that's possible, though

And thanks... So, does OpenGL support VB6 and Taking input from the keyboard?
Guy Perfect









Since: 11-18-05

Last post: 6285 days
Last view: 6284 days
Posted on 01-26-07 05:01 AM Link | Quote
OpenGL is just a graphics pipeline. Input has to come from somewhere else. One good option is to use the GetKeyboardState() function from your main animation loop to get the pressed-ness of each key without relying on VB's Form events.

You can use DIB Sections with OpenGL if you configure your rendering context to do so. Using that, you can do whatever fancy hardware-accellerated stuff you need, do any manual processing, then BitBlt() it to the destination DC (like the Form's) when your'e done.

OpenGL sports a handy viewport mode called glOrtho() that can map polygons to exact pixels on the screen. That's typically the best choice for foreground UI's.
Sukasa

Birdo
Not quite as active as before.
Xkeeper supporter
Xk > ||bass
I IP Banned myself! Twice!








Since: 11-17-05
From: Somewhere over there

Last post: 6284 days
Last view: 6283 days
Posted on 01-26-07 05:11 AM Link | Quote
Interestingly enough, I ran this program on my win98SE 350 MHz computer and it ran like a charm

A 650 MHz WinXP library computer at school ran it like crap, so I'm thinking that it's just something on that computer that's slowing down my program. I'll look into OpenGL though, for graphics processing. right now I'm using
Private DirectX As DirectX8 'The master DirectX object.
Private DirectInput As DirectInput8 'Controls all things input
Private DirectInput_Device As DirectInputDevice8 'Represents hardware input equipment (keyboard)
Private Key_State As DIKEYBOARDSTATE 'Represents the keyboard itself
and
DirectInput_Device.GetDeviceStateKeyboard Key_State


To get my input, and just doing a lot of blits for the UI and such:

DIBDc = Canvas.hdc 'assign Canvas.hdc to a variable, seems to speed this up
'paint the battlefield - preassembled bitmap
BitBlt DIBDc, 0, 0, 640, 480, Battlefield.hdc, scrollX, scrollY, vbSrcCopy

'paint sprites - tanks and shots - Transparent parts not shown, of course.
For a = 0 To UBound(Sprites) - 1
If Sprites(a).Show = True Then
BitBlt DIBDc, Sprites(a).PosX - scrollX, Sprites(a).PosY - scrollY, 32, 32, Sprites(a).Graphics(Sprites(a).GFXFrame + Sprites(a).Frames).hdc, 0, 0, vbMergePaint
BitBlt DIBDc, Sprites(a).PosX - scrollX, Sprites(a).PosY - scrollY, 32, 32, Sprites(a).Graphics(Sprites(a).GFXFrame).hdc, 0, 0, vbSrcAnd
End If
Next a

'paint UI1 - main window GFX - Transparent parts not shown, of course.
BitBlt DIBDc, 0, 0, 640, 480, UI1m.hdc, 0, 0, vbMergePaint
BitBlt DIBDc, 0, 0, 640, 480, UI1.hdc, 0, 0, vbSrcAnd

'paint UI2 - Transparent parts not shown, of course.

If MenuShow = True Then 'Game Menu
BitBlt DIBDc, 153, 28, 304, 30, UI2m.hdc, 0, 0, vbMergePaint
BitBlt DIBDc, 153, 28, 304, 30, UI2.hdc, 0, 0, vbSrcAnd
End If

If ChatDialog = True Then 'Dialog for chatting with a guy
BitBlt DIBDc, 153, 28, 304, 40, UI3m.hdc, 0, 0, vbMergePaint
BitBlt DIBDc, 153, 28, 304, 40, UI3.hdc, 0, 0, vbSrcAnd
End If
BitBlt GScreen.hdc, 0, 0, 640, 480, DIBDc, 0, 0, vbSrcCopy
MaxKnight
Newcomer








Since: 01-26-07
From: Springfield, Oh

Last post: 6291 days
Last view: 6283 days
Posted on 01-27-07 06:21 AM Link | Quote
I know this thread is for ranting on Visual Basic, but I figure if you're ranting on it, you must know something about programming with it.

If this should be posted in a separate thread, please tell me, and I'll do so.

I have a few questions. I'm making a program in VB that is to simulate the NES game Dragon Warrior. I have several forms created for the actual game, but need some help with some of the controls.

http://img180.imageshack.us/my.php?image=mainformnr2.png

This link is to a picture of the main form. All actual gameplay is done here. My questions are as follows:

1) Does anybody know how to force a newline/carriage return in a multiline textbox? Almost everything that is text related will go in there, but for now it all runs together. I have several different subroutines that append text to this textbox, but have no clue how to make it newline so that it doesn't run all together.

2) Believe it or not, there is a picturebox in the center of the image. I want to design it close to how the game worked, with a top-down screen where you can move the hero around, scrolling the screen in whatever direction he's going. I'm planning a point-and-click interface, where you click on the tile you want him to move to, and he moves automatically to that spot. If a battle commences before then, the battle subroutine (yet to be written) takes over, and the move is canceled at the spot of the battle. I may be able to get all of the graphics I need to fill the space, I just don't know how to make it all work.

I realize this is a really big undertaking, but it's something I really wanted to do, since about 2003.
Sukasa

Birdo
Not quite as active as before.
Xkeeper supporter
Xk > ||bass
I IP Banned myself! Twice!








Since: 11-17-05
From: Somewhere over there

Last post: 6284 days
Last view: 6283 days
Posted on 01-27-07 06:27 AM Link | Quote
1) test1.text = "First line" + vbCrLf + "second Line"

2) to handle the mouseclicks, set the pictureboexe's scalemode property to 3 - pixels, and then in it's click() event, handle all the clicks there.
MaxKnight
Newcomer








Since: 01-26-07
From: Springfield, Oh

Last post: 6291 days
Last view: 6283 days
Posted on 01-27-07 06:39 AM Link | Quote
Thank you asakuS! As for the picturebox, assuming I ever get the right graphics for building the world there, I should be able to put code in to scroll the screen by removing rows and columns of squares from the edges and adding them back again on the opposing side when clicking, right? I'm not nearly that far yet, as I've no clue how to actually go about creating this without using far too many really small pictureboxes in a square pattern.

Well anyways, should I ever need anything more, I'll be sure to ask, as I know I'll not be able to completely finish this without asking more questions!
||bass
Administrator








Since: 11-17-05
From: Salem, Connecticut

Last post: 6285 days
Last view: 6283 days
Posted on 01-27-07 06:46 AM Link | Quote
Two comments:

One, to address the idea that VB is somehow totally incompatible with any kind of cross platform programming:

That is MonoDevelop, with the option to create/open a VB.NET (not classic VB) project on my home PC running Ubuntu Linux 6.10.

Second, a simpler comment. No pointers = utter fail. VB does suck, just not because of the supposed lack of cross platform-ness.


(edited by ||bass on 01-27-07 12:48 AM)
(edited by ||bass on 01-27-07 12:49 AM)
Kyoufu Kawa
Intends to keep Rom Hacking in one piece until the end








Since: 11-18-05
From: Catgirl Central Station

Last post: 6283 days
Last view: 6283 days
Posted on 01-27-07 11:42 AM Link | Quote
Originally posted by ||bass
Second, a simpler comment. No pointers = utter fail. VB does suck, just not because of the supposed lack of cross platform-ness.
I think I saw some pointer dabbling in one of the books I have. Was something about string formats and lengths and it involved pointers to a large degree. I might just quote it.
BriGuy92

Red Goomba








Since: 09-10-06
From: That dot on the globe

Last post: 6305 days
Last view: 6288 days
Posted on 01-28-07 03:21 AM Link | Quote
Wow. The end of the class has come and we finally do something worth mention. Our final project (That of me and Ogama Dobe, that is) was to create a "High Card" game in VB. The game pretty much needed to randomly select one of 52 cards from an array, display it in an image box, and then select another and display it in an image box. The program then had to test to see which one was higher, and determine the winner of the "Hand." It was a pretty complex program, really challenging. (spelling?) I might edit this post with the .exe file as an attachment, if anyone wants to download it.
Kyoufu Kawa
Intends to keep Rom Hacking in one piece until the end








Since: 11-18-05
From: Catgirl Central Station

Last post: 6283 days
Last view: 6283 days
Posted on 01-28-07 12:44 PM Link | Quote
To finally lay the "no pointers in VB" crap to rest, here's an excerpt from Win32 API Programming with Visual Basic I found in my copy of MSDN. I've marked the important part, StrPtr. There's also VarPtr and possibly a third.
Translating Between Byte Arrays and BSTRs
To copy a BSTR:

Dim s As String

to a byte array, we can proceed in a couple of different ways. For a strictly VB solution, we have:

s = "help"
Dim b(1 To 8) As Byte
For i = 1 To 8
b(i) = AscB(MidB(s, i))
Next


Another approach is:

s = "help"
Dim b(1 To 8) As Byte
CopyMemory b(1), ByVal StrPtr(s), LenB(s)


Note that (in both cases) we get:

104 0 101 0 108 0 112 0

showing that the bytes are reversed in each Unicode integer.
Pages: 1 2 3 4Add to favorites | Next newer thread | Next older thread
Acmlm's Board - I3 Archive - Programming - Let's Rant about Visual Basic! |


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.072 seconds; used 451.26 kB (max 584.57 kB)