Skip to main content
gamedev.net
🔒 Locked

My Programming Language

Started by Dark Shadow 23 replies 1.4k views
Original Post
Dark Shadow
Dark Shadow
I''m building a 3D game programming language in Visual Basic. The commands are like: Syntax: (command)(parameter1),(parameter2)... My problem is that I can''t read the second and the third... parameters fast enough, so my programming language is very slow. I use the caalbyname command and the commandos are in a User Control. Have you had the same problem or do you now how to solve it please help me! tnx www.dark-office.com
Nekosion
Nekosion
What do you mean when you say "a 3d game programming language in visual basic"... do you mean a interpreted scripted language? or a visual basic 3d math library? I''m guessing that you are writing a interpreter... so I''ll discuss your problems here:

The function "CallByName()" is quite slow, because it has to traverse the function list until it finds a function that matches, then it has to run that function''s code. CallByName() has an index of EVERY (Depending on current scope) function in your Visual Basic Application, this makes traversal quite slow.

Personally I have found Visual Basic''s string functions to be very slow, however when I did a decompiler for total annihilation''s animation scripts I used a few workarounds. The biggest saving I achieved was when I buffered the output.

Visual Basic is SLOW, I don''t care what anyone else says... if you want to develop for any decent type of speed you need to use C/C++ or even assembly. I''ve written and seen quite a few visual basic applications, so I can''t recommend writing a 3d programming library in vb.

You have a couple of options though:
1. Move your 3d game programming library to a c/c++ dll.
2. Use Direct3d/OpenGL instead.
3. Write a custom "CallByName" function, basically you go through all your commands calling a string match function.

I guess there are other methods you could use to speed it up, but I would suggest that you move to Direct3d/OpenGL... it will make life easier in the long run.

BTW: My ranting could be totally useless to you, I don''t really understand what you are trying to get at? namely is it a script interpreter or is it a language that you want to use in vb... it is the use of the CallByName() that suggests a script interpreter to me but maybe not...?

If you want to give more info I will revisit this topic later...


Regards,
Nekosion
Regards,Nekosion
Dark Shadow
Dark Shadow
tnx

I''m using D3d.
It''s a scripting language to make your own games.
I can''t program c++ (a little bit, but a lot more vb).
I need a fast engine that could read my scripting language!
I know, my engish is very bad

again tnx!
InsanE
InsanE
quote:
Original post by Anonymous Poster

Notice that about 90%-95% of 3D-engines powers if used by a 3D-card (REALLY?)!
When theres 50 000 polygons to handle it doesn''t really
matter wheater it takes 0.03 seconds to handle in VB or
0.025 seconds in C++. I don''t say VB is very fast, but it''s not slow either.


Well, I disagree. Time is the most important thing in every existing 3d engine. You can have the newest 3d card and it''s waiting for the render call because of slow written code. If your scene is becoming complex you need more calculating time than one frame is rendered. Of course 3d cards will do 3d math for you but just the drawing part. E.g. collision detection will take no advantage of the 3d card. AI mostly needs much performance to give another aspect. It''s very important how fast code is going to be executed. Every ms is counting!
I don''t want to say that''s nonsense to program a 3d engine in VB. It''s a good practise. But more than practise it won''t ever be!

24hCoder
24hCoder
I''ll guess you are using linux as your operating system, after all it has customizable kernel for optimum speed, are you?
Jrz
Jrz
Why do people think VB and java are slow? because it''s interpreted?
VB: generates NATIVE CODE and p-code depending what you want

java generates bytecode that will be optimized for you machine (heard of JIT / hotspot?)

execution time is bigger that''s the only thing

oh yeah, emm did I say unreal uses a scripting language for the game code?

a language means nothing, it just defines a syntax, though java / vb lack some possibilities, but have a lot of premade objects for you.
I''m currently writing a game using C++, but when it''s finished, I want to create the same game in java, just to see how much it REALLY matters
24hCoder
24hCoder
Actually, I too created one 3D-application (with heavy polygon processing and texturing) with both VB and VC using exact structure copy including all VC optimizations. The result was:
Visual C++ 6.0 sp4: 15 FPS
Visual Basic 6.0 sp4: 14 FPS
So does this really matter so much that you can't live anymore?

ps. I haven't tried java very much, but it's pretty fast too. Delphi is certanly very fast.
Qbasic is a slow language. That I can say.

And usually people that say C++ is the only fast language that there is, haven't got much experince in other languages!

Edited by - 24hCoder on January 4, 2001 10:20:28 AM
ZomeonE
ZomeonE
quote:
Original post by 24hCoder

Actually, I too created one 3D-application (with heavy polygon processing and texturing) with both VB and VC using exact structure copy including all VC optimizations. The result was:
Visual C++ 6.0 sp4: 15 FPS
Visual Basic 6.0 sp4: 14 FPS
So does this really matter so much that you can''t live anymore?





Have you tried creating some collission detection, AI and stuff that your 3d card cant handle?

24hCoder
24hCoder
Yes, not anything major but a simple floor and wall surface checking based on collision detection.
Agent1
Agent1
quote:
Original post by Jrz

Why do people think VB and java are slow? because it''s interpreted?
VB: generates NATIVE CODE and p-code depending what you want

java generates bytecode that will be optimized for you machine (heard of JIT / hotspot?)

execution time is bigger that''s the only thing



Now, excuse me if I''m wrong, but if something''s execution time is "bigger", doesn''t that mean it''s slower? I''m not going to get into the whole language thing, but I''m confused by your post. Seems you are trying to tell us the two languages aren''t "slow", but then you say something about execution time being bigger (longer). Huh?

*Hopes he''s making sense*





-Agent1




Ima Genius: *watches Agent compile the program, run it, and Agen''t cd rom tray opens and computer catches on fire*
Ima Genius: You''re an operator in a phone company and you have to connect all the calls right and if you do, Asheron calls you and tells you "Good job!" :D
Redleaf
Redleaf
Alright, here''s a related question for you scripting gurus reading this forum.

Other than using a scripting language which is compiled in a hardcoded manner, are there alternative ways to call a scripted function other than using a string with its name? I''m just wondering if anybody has come up with a better way to do this, because like it has been said, strings can be slow to work with. Any kind of pointer-like ideas?

Just curious.
24hCoder
24hCoder
I have an idea! Let''s move from software programming to hardware ''programming''. At least I have 10 years of experience in CMOS/TTL logic, analog/digital logic systems, all gates from dual-input NAND to quad-input XOR gates, phase-locked loops, flip-flops, full adders, complementers, successive approximation registers and shift registers. (at least). So why do we still need to optimize software code, when we can gain thousands of procents faster code with hardware
Uthman
Uthman
I have programmed _MANY_ working 3d engines in VB: http://dacademy.8m.com
"a low level aho master like you couldn't kill me even if I let you"
24hCoder
24hCoder
hmm.. some of your samples might need some optimizations..

bad method:

For a=0 to 100000
[something small...]
DoEvents
Next

better method:

For a=0 to 100000
[something small...]
If (a mod 100)=0 then DoEvents
Next

and so on..
Nekosion
Nekosion
Perhaps I should have been more clear when I said "VB is slow" I meant to say that certain parts of the vb language is slow:

1. String Handling
2. Floating Point calcs (slightly slower than c)

VB compiles to native code, however all the functions it calls are based in the vb run time modules.

Since when you come across any function it will ultimately lead to calls to the run time modules. I guess the extra JMP op wouldn''t really drop performance that bad, but I guess that having to dump the cache would...

Then again, I could be wrong about it having to drop the cache after the JMP.


Regards,
Nekosion
Regards,Nekosion
24hCoder
24hCoder
quote:

Perhaps I should have been more clear when I said "VB is slow" I meant to say that certain parts of the vb language is slow:

1. String Handling
2. Floating Point calcs (slightly slower than c)



Well I''ll have to agree to that. String handlings are quite expensive in VB, but in 3D-engine, where do you need strings?
ImmaGNUman
ImmaGNUman
Why dont you just:

1) Take the line of code
2) Take the command and send it through a if then else chain

if (cmd = "Foobarbaz") then
'' foo
else if (cmd = n)
''bar
...
end if

Why call a slow function, when making a if, else chain is so much faster?

-----------------------------

A wise man once said "A person with half a clue is more dangerous than a person with or without one."

The Micro$haft BSOD T-Shirt
-----------------------------A wise man once said "A person with half a clue is more dangerous than a person with or without one."The Micro$haft BSOD T-Shirt
Nekosion
Nekosion
Hmmm, does anyone know if the JMP''s that VB does when it moves into the VB runtimes dumps the CPU cache? I would suspect it does but I am not sure.

ImmaGNUman: {
Why dont you just:

1) Take the line of code
2) Take the command and send it through a if then else chain

if (cmd = "Foobarbaz") then
'' foo
else if (cmd = n)
''bar
...
end if

Why call a slow function, when making a if, else chain is so much faster?
}

That would still mean Dark Shadow would have to parse the line for the actual code and parameters, (argh... slow VB string functions...).

Personally I don''t see why you would want to write a 3d scripting language in VB. I mean it''s a pretty simple language to learn, so why not just encapsulate your 3d code into a class and distribute that?

I would think that any language that dark shadow would write would be less neat than visual basic, just because vb has been around for like 10 years or so, and basic has been around for like 40 (I think).


Regards,
Nekosion
Regards,Nekosion
Dark Shadow
Dark Shadow
tnx everyone

I only want to build a scripting language and I don''t know how to read the parameters of my scripting language fast enough.

And I don''t program c. And Java is not slow!

The other problems by making my scripting language are easy to solve.

If you have a faster engine than the callbyname command, you could mail me.

again tnx

darkoffice@dolfijn.nl
RedZen
RedZen
quote:
Original post by Nekosion
Visual Basic is SLOW, I don''t care what anyone else says... if you want to develop for any decent type of speed you need to use C/C++ or even assembly.


OK first things first, I''ve done game development in VB and C++.
VB is a very kewl language to do development in, and I luv it lots. It can do anything c++ can do at exactly the same speed,
don''t argue with me, I''ve tried and tested it. BUUUUUUUT, when
we start hitting complex math operations to produce 3D objects, then I''m very sorry to say that c++ outruns VB by quite a convincingly...AI and shit like that, VB handels well, but 3D and
VB aren''t good friends. So Dark Shadow, C++ is defnitely your answer here. You''ll just have to start learning it. And that, as they say, is that.
Green and blue was the dimension Zen, until I went through it...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.