🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Choosing a Scripting Language

Started by
37 comments, last by irbrian 20 years, 2 months ago
quote: Original post by Kylotan
You may find this useful:
http://users.skynet.be/saw/SpiderMonkey.htm

You''re right in that Python and Lua aren''t particularly C-like, but they''re popular for a reason. They may be easier to embed and work with and are problably better documented.
Certainly, ease of embedding and availability of documentation is big a factor to consider. I like Python alright, it just doesn''t feel as natural to me (possibly because I''ve been programming in C-like languages for so long now).
quote: How to create entire game logic modules is probably well beyond the scope of any tutorial, which is possibly why the more popular languages are the ones that are easier to embed in the first place.
I''m not sure I''d agree that anything is completely beyond the scope of ANY tutorial. Nuclear physics could, theoretically, be explained through a series of tutorials. But I certainly don''t expect anyone to write a 100-page discourse on scripting Game Logic Modules, nor do I expect the full message to come across in a two paragraph overview.

Anyway I''m not really looking for tutorials in this area so much as general guidelines, tidbits of wisdom from those who have gone before, etc -- I don''t mind figuring the bulk of it out on my own.
---------------------------Brian Lacy"I create. Therefore I am."
Advertisement
quote: Original post by Kylotan
You may find this useful:
http://users.skynet.be/saw/SpiderMonkey.htm
After checking this one out I discovered that I''ve already seen it. It appears to be geared more toward embedding the scripting language in C++, i.e. weaving the two together, than using it to separate the core application and the component logic.
---------------------------Brian Lacy"I create. Therefore I am."
quote: Original post by Sneftel
I''ll never understand why people esteem "C-like syntax" so highly.
Familiarity, and it''s cousin laziness.

Yes, I was talking to you, "C-like syntax" (what does that mean, exactly) lover! Whatcha gonna do ''bout it?
I think it means lots of braces and semicolons and no "then" or "end". Hell, maybe I''ll rewrite the lua parser to look more like C. It really wouldn''t be much of a task.

"Sneftel is correct, if rather vulgar." --Flarelocke
quote: Original post by downgraded
Not really - but I can imagine that writing a script in a similar language to the engine will save headaches (eg: syntax errors) and allow people to more easily conceptualise how the two work together.


I strongly disagree with that statement. Unless you do reproduce faithfully the syntax and semantics of C (or C++), the subtle differences between C and your scripting language will cause unending headaches. People used to C will expect their C idioms to work correctly in script. If you can''t guarantee that, in particular if your feature set is markedly different, you should offer an obviously different syntax.

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” — Brian W. Kernighan
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Come on, folks -- its all a matter of preference. What''s the big deal?
---------------------------Brian Lacy"I create. Therefore I am."
well, screw C syntax. it isnt particularly fast to parse and compared to e.g. Python syntax, it has lots of ''{'' and '';'' overhead sometimes. and no, i dont like pascal-like syntax :> so dont eat me alive yet, hehe.
imo, looking for a scripting lang with a C-like syntax comes out of laziness for learning another lang ;P
yet, i like D syntax :]

"open your eyes, open your mind (...)"
quote: Original post by h3r3tic
well, screw C syntax. it isnt particularly fast to parse and compared to e.g. Python syntax, it has lots of ''{'' and '';'' overhead sometimes. and no, i dont like pascal-like syntax :> so dont eat me alive yet, hehe.
imo, looking for a scripting lang with a C-like syntax comes out of laziness for learning another lang ;P
yet, i like D syntax :]
If there was no interest in catering to laziness, it seems to me more programmers would just write the code in C/C++ and not worry about scripting languages at all, just make the user learn C++. Half the reason for separate scripting languages is so the user feels more comfortable with it.

Well, my scripters will likely have some coding experience in C/++, Java, JavaScript, ActionScript, and/or PHP. So I want something that''s natural and easy for them (and me) to use, which means C-like syntax, but quicker and more streamlined for ongoing development than actually using C or C++.

On the topic parsing speed: Since I''m having so little luck finding what I want, I''ve been slowly designing my own scripting language; and my hope is to design it such that it actually compiles the script to bytecode the first time it''s run and caches it, so that it runs faster but you don''t lose the ability to script-and-go. Granted the first execution after modification of the script would be pretty slow, but that''s no big deal for what I''m doing.

Of course, if I can find a scripting interpreter that has most of what I want, I''ll happily go with that. After all, I''m not interested in reinventing the wheel. I''m just talking about getting the right type of wheel to fit the axle.
---------------------------Brian Lacy"I create. Therefore I am."
sure, its ! 2 bad 2 B lazy

again, my best shot here is Python, cuz it has actually very C-like syntax, aside from dropping the ''{'' and '';''. moreover, its extended to make it more coder-friendly, by introducing things like lambda expressions or built-in array slicing operators.

if you are concerned about efficiency of the code, you may take a look at this: http://psyco.sourceforge.net/introduction.html
Psyco lets you combine already-quite-fast-Python-bytecode with machine code.
quote: Original post by Oluseyi
"C-like syntax" (what does that mean, exactly)


syntax like-C

MindEngine Development
http://medev.sourceforge.net

[edited by - neurokaotix on April 7, 2004 5:31:51 AM]

This topic is closed to new replies.

Advertisement