• Advertisement

Archived

This topic is now archived and is closed to further replies.

This topic is 6052 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey all,i was just wondering,is vb as fast as c++,graphics routines wise,because of the new version of directx for vb.This seems to be what vb programmers are now rubbing in c++ coders faces.Any input is appreciated. "Good,evil,I got the gun" Ash- Evil Dead

Share this post


Link to post
Share on other sites
Advertisement
Amen brother

Humanity''s first sin was faith; the first virtue was doubt

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
VB doesn''t support full features of DX8

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
VB doesn''t support multi-threads, which is crucial to the game development

Share this post


Link to post
Share on other sites
What are multi-threads? (i''m learning vc++)

yeah VB easier to learn...i guess...

Share this post


Link to post
Share on other sites
multi threads are individual threads running in your program.
a thread is a single execution pipeline of instructions...

multitasking uses a combination of threads, processes and fibers..

a thread allows you to do a single task, 2 threads can do 2 tasks concurrently (well almost).

read up the
CreateThread() for windows and
fork() for unix / linux (create process)



{ Stating the obvious never helped any situation !! }

Share this post


Link to post
Share on other sites
quote:
Original post by jwalker
read up the
CreateThread() for windows and
fork() for unix / linux (create process)



Forking isn''t the same thing as creating a new thread; threads can remain within the current process - child threads - while child processes (processes started by forking off a parent) are autonomous. Also, fork()''s (default?) behavior is to create a replica of the forking process with different data. The C/C++ equivalent to Win32''s CreateThread() is _beginthread() (there''s also _endthread()).

This raises an interesting point - Windows doesn''t support forking processes, even though many thread-based workarounds exist. And threads and forks are not analogous; forks are far more powerful.

Share this post


Link to post
Share on other sites
Regardless that graphics in VB may be almost as fast as C++ due to DX8 (which is kinda like using C++ anyway o.0), if you really tried to make a game in VB, all of that logic code, AI, etc, etc, is going to do some pretty nasty things to your speed.

In defense of VB though, you can use multiple threads in VB5, but not 6.

But then, VB doesnt have real pointers... and what kind of language doesnt have pointers? =).

Z.

Share this post


Link to post
Share on other sites
Ok, pointers *are* possible in VB, with a few limitations, you can''t reference/dereference them, but you can pass them, manipulate them and look at what they are pointing to. Some of the functions to do so are undocumented by MS (VarPtr, ObjPtr, StrPrt and AddressOf (although that might be in there, I''m not sure))

Straight VB will never be as fast as C++, but it is constantly getting closer and closer. Currently VB6 and VC++6 both share the same compiler, but because VB is "higher level" than C++, there is a speed difference, in C++, you can make assumptions about things to speed up algorithms, in VB, a lot of the time, the compiler will put in extra code to check stuff for you.. not too clear... an example:

Dim MyArray(0 To 9) As Long

Debug.Print MyArray(10)

In VB, that will cause an error, if you are running from inside the IDE and if you compile it without turning off the array bounds checks.

In C++, the equivalent code would probably just look in the memory after MyArray(9) and return what is there (I believe).

Now, if you were to then go through the array like this

Dim i as long

For i = 0 To 9
DoSomething MyArray(i)
Next

Even though there is no way that part of the array which is out of bounds would be accessed, the compiler isn''t smart enough to know this, so it still checks each time.

This is only a small thing which can be turned off for the final build, and there are a few other things you can do to speed up programs without changing the code.

Graphics wise, VB and C++ for straight out 2d graphics are very very close together. For 3d stuff where there is more complex math to do, VB is a bit slower, but again, it can be sped up by changing some compiler switches. (In a test application I did, a process which took 1.5 min was brought down to < 1s by changing the switches... so yes, they do make a difference)

With VB.NET coming, it will be possible to mix VB and C++ together, which will mean that it will be even easier to speed up slow VB code.

VB6 does support multithreads quite easily actually, just they hide it from you . If anyone is interested, then mail me and I''ll elaborate.

I see VB as being to C++ as C++ is to ASM. Not to the same magnitude, but pretty much the idea of a higher level. You don''t see any people around here saying "ASM is much faster than C++, you should use it"... draw your own conclusions (and yes, inline ASM is possible in VB too)



Trying is the first step towards failure.

Share this post


Link to post
Share on other sites
Right on rags =)

What parts of DirectX 8 doesn''t VB support? I know effect files aren''t supported but what else?

Hmm, even with 3D, many of the math intensive functions can be passed off to an ASM or C++ dll or just the D3DX library...

Peter

Talos Studios
http://talos.togglespin.com

Share this post


Link to post
Share on other sites
I thought that only VS7 uses the same compiler. To the best of my knowledge, VC++ 6 uses a different compiler to VB 6, it all changes in 7 though. I could be wrong, it''s happened a couple of times before.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I don''t think you''ll get much support for VB here because most people C++ or Bust! tatooed on there butts here. What I''m saying is that here they''ll probably say C++, and over at www.vbexplorer.com , they''ll probably say VB

Share this post


Link to post
Share on other sites
I really dont know why people are so chosey if its not directx vs OGL its vb vs c/c++ or c vs c++ or c vs asm. All I want to do is make games using whatever . So far I can make games using , director , flash , dhtml , VB, Java , C/C++ , Asm (Right now Im experimenting with python using pygame ). But thats because Im insane ( I have nightmares of me getting kidnapped by aliens and transported to their alien realm where they only program in . Thats why Im always learning new languages.

Share this post


Link to post
Share on other sites
quote:
Original post by Oluseyi

Forking isn''t the same thing as creating a new thread; threads can remain within the current process - child threads - while child processes (processes started by forking off a parent) are autonomous. Also, fork()''s (default?) behavior is to create a replica of the forking process with different data. The C/C++ equivalent to Win32''s CreateThread() is _beginthread() (there''s also _endthread()).




  1. The Win32 API is written in C, so CreateThread() is C/C++
  2. _beginthread() is a different version of the same function
  3. There is no way of creating threads using the C standard library
  4. The POSIX way of creating a thread is something like pthread_begin() (I''m not in Linux right now so I can''t check)


Share this post


Link to post
Share on other sites
ragonastick

MyArray[10] is equivelent to

*(MyArray+10)

If you are familiar with pointer arithmetic. Some compilers even let you do this...

10[MyArray],

which mean nothing as far as the C language is concerned, but will become

*(10+MyArray)

during compilation. Same thing.

And *(10+MyArray) will either crash your program, or load or store unwanted data. (Assuming MyArray was declared MyArray[10])

Edited by - Thrump on July 21, 2001 12:53:55 PM

Share this post


Link to post
Share on other sites
quote:

MyArray[10] is equivelent to

*(MyArray+10)


Ok, first up, no I am not very familiar with pointer notation, I understand the concepts fine, but the notation can take me a while to digest . I take it that *(MyArray + 10) is a pointer to 10 bytes after MyArray yes?

quote:

And *(10+MyArray) will either crash your program, or load or store unwanted data. (Assuming MyArray was declared MyArray[10])


Cool... unless I am completely stupid (I hope not ) then that supports what I said.

I think I might go and read some C tutes, just so I don''t make a total arse of myself any more.

Oh yeah, another downside to VB is the way it works with OpenGL. Although I haven''t used it, I''ve seen code which uses it, and it looks really messy. Some people use it and love it though, so it isn''t a total write off.

Share this post


Link to post
Share on other sites
quote:

Ok, first up, no I am not very familiar with pointer notation, I understand the concepts fine, but the notation can take me a while to digest . I take it that *(MyArray + 10) is a pointer to 10 bytes after MyArray yes?



Don''t mind me... I''ve just finished reading some stuff, and I see it isn''t necessarily 10 bytes

Share this post


Link to post
Share on other sites
Correct. MyArray + 10 will be the address of MyArray plus 10* the size of the type of MyArray. Don't worry, this stuff is not a necessity starting off, but, when you understand it all it really helps.

Also,

*(MyArray + 10) is the dereferenced address.

Usually, you would use MyArray as an array and go on your happy way. Like

int MyArray[5];
int MyInt;

MyInt = MyArray[0];


But, it's nice to know that MyArray just holds an address. If your array(assuming 2 bytes per int) is stored at bytes 1010, 1012, 1014, 1016 and 1018, then MyArray holds the value 1010. You cannot change this value. But you can change the value 'stored' at 1010. You must dereference the 'pointer' (or address) by going *MyArray. In declarations, * means you're declaring a pointer, while in other statements, it means 'dereference'. (or multiply :p)
Or instead of dereferencing, you could use the C shorthand MyArray[0]. MyArray[0] is the exact same as *MyArray in this situation. So,

MyInt = MyArray[0];
or
MyInt = *MyArray;

If MyArray is declared as an array, use the first one, for readabities sake. However, understand that MyArray is and address/pointer, that is the exact same as any other pointer, except that it is constant.

ie, this will not work,

MyArray = 1050;

Anyway, hope that's not too much to swallow, and I hope I didn't make any mistakes to confuse you. Have fun.





Edited by - Thrump on July 22, 2001 9:37:08 AM

Edited by - Thrump on July 22, 2001 9:38:21 AM

Edited by - Thrump on July 22, 2001 9:45:08 AM

Share this post


Link to post
Share on other sites
Oh, btw, I''ve used openGL from VB, and I don''t think it''s messy at all. Just as messy as using it from C++ windowed apps.

Share this post


Link to post
Share on other sites
Cool, thanks for helping me there... I''m willing to learn

In my research yesterday, I came across something saying that the negative version of the "++" is just a single "-"... and I don''t think that is right... hopefully that place got pointers right too, otherwise I''m in a bit of trouble

I suppose my biggest trouble is understanding the referencing/dereferencing type thing, because there is none of that in VB. But I''m not asking for any more crash courses , I''m sure I''m not the only one who has been put off by them.

Thanks a lot for helping me though, it really does help

Share this post


Link to post
Share on other sites

  • Advertisement