Register | Login | |||||
Main
| Memberlist
| Active users
| Calendar
| Chat
| Online users Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album |
| |
0 users currently in Programming. |
Acmlm's Board - I3 Archive - Programming - Let's Rant about Visual Basic! | New poll | | |
Pages: 1 2 3 4 | Add to favorites | Next newer thread | Next older thread |
User | Post | ||
Drag 80 Since: 01-18-07 From: USA Last post: 6432 days Last view: 6432 days |
| ||
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: 6434 days Last view: 6434 days |
| ||
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: 6433 days Last view: 6432 days |
| ||
Originally posted by Kyoufu KawaOriginally posted by asakuSOBJECTION! 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
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: 6432 days Last view: 6432 days |
| ||
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: 6433 days Last view: 6432 days |
| ||
... 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
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: 6434 days Last view: 6432 days |
| ||
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: 6433 days Last view: 6432 days |
| ||
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: 6434 days Last view: 6432 days |
| ||
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: 6433 days Last view: 6432 days |
| ||
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: 6434 days Last view: 6432 days |
| ||
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: 6433 days Last view: 6432 days |
| ||
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: 6434 days Last view: 6432 days |
| ||
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: 6433 days Last view: 6432 days |
| ||
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.
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
|
|||
MaxKnight Newcomer Since: 01-26-07 From: Springfield, Oh Last post: 6439 days Last view: 6432 days |
| ||
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: 6433 days Last view: 6432 days |
| ||
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: 6439 days Last view: 6432 days |
| ||
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: 6433 days Last view: 6432 days |
| ||
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: 6432 days Last view: 6432 days |
| ||
Originally posted by ||bassI 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: 6453 days Last view: 6437 days |
| ||
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: 6432 days Last view: 6432 days |
| ||
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"
Another approach is: s = "help"
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 4 | Add to favorites | Next newer thread | Next older thread |
Acmlm's Board - I3 Archive - Programming - Let's Rant about Visual Basic! | | |