The dominant language of an engine
When an engine (presumably written in C++ or a similar language) includes a scripting language (custom or 3rd party), what language is "dominant" Does the engine do most things in C++ and only call the scripts during certain events (like player dies, call the player dies script). Or does the engine just host the scripts and let the scripts call functions/method that are written in C++?
Basically, I can find all kinds of information about using and embedding scripting languages, but information about how to engineer them into a game engine seems to be a bit sparse. Any ideas or examples? Thanks for your help.
SpiffGQ
in 99% it will not be the scripting language for a simple reason: speed!
as scripting is really slow (usually) it will only be used at a very high level so it wont have that much overhead.
unreal on the other hand does quite much in its scriping engine, although i dont know how much, ive read an article about it a while ago, where it was quite detailed described....
dont know how it was titled though..
as scripting is really slow (usually) it will only be used at a very high level so it wont have that much overhead.
unreal on the other hand does quite much in its scriping engine, although i dont know how much, ive read an article about it a while ago, where it was quite detailed described....
dont know how it was titled though..
http://mitglied.lycos.de/lousyphreak/
Very roughly scripting is for game logic, while C++ is for rendering, input, events etc. At least that''s my take.
http://www.stodge.net - the powerhouse in personal commentary
http://www.stodge.net - the powerhouse in personal commentary
---------------------http://www.stodge.net
For the record, a good scripting language without too many features to cause bloat and such will run around 85% (in my little language) of hardcoded material. I'm not saying you want to script every single thing, but the 15% speed difference isn't as big as you're making it out to be.
Edit: OMG You're an Oregonian!! What the heck. No sane programmers live in Oregon. What city? I live in Salem.
[edited by - shadowman13131 on June 11, 2003 9:32:55 PM]
Edit: OMG You're an Oregonian!! What the heck. No sane programmers live in Oregon. What city? I live in Salem.
[edited by - shadowman13131 on June 11, 2003 9:32:55 PM]
quote: LousyPhreak
in 99% it will not be the scripting language for a simple reason: speed!
as scripting is really slow (usually) it will only be used at a very high level so it wont have that much overhead.
unreal on the other hand does quite much in its scriping engine, although i dont know how much, ive read an article about it a while ago, where it was quite detailed described....
dont know how it was titled though..
Many of the open source games and game engines I have looked at seem to use scripts to run the C++ parts. This is kind of cool because it allows for very easy tweaking of behavior. In fact, writing a console that can interact directly with the scripting language would make it possible to tweak the behavior while in-game.
quote: stodge
Very roughly scripting is for game logic, while C++ is for rendering, input, events etc. At least that's my take.
I wonder what is considered game logic. Is the main game loop considered game logic? What about the game's initialization routine?
quote: Original post by shadowman13131
For the record, a good scripting language without too many features to cause bloat and such will run around 85% (in my little language) of hardcoded material. I'm not saying you want to script every single thing, but the 15% speed difference isn't as big as you're making it out to be.
I guess the parts that need to be fast can be recoded in C++.
quote:
Edit: OMG You're an Oregonian!! What the heck. No sane programmers live in Oregon. What city? I live in Salem.
Corvallis. There are sane programmers in Oregon. But when they go insane, they tend to move to Salem and work for the state (or move to California)
EDIT: spelling
[edited by - SpiffGQ on June 11, 2003 10:54:59 PM]
SpiffGQ
No the main loop is not game logic. Neither is initialisation although I don''t see why it couldn''t be controlled from scripts.
Game logic is responding to collisions, or coding some AI routines etc...
Just my opinion.
Game logic is responding to collisions, or coding some AI routines etc...
Just my opinion.
---------------------http://www.stodge.net
Humongous Entertainment (of Putt-Putt and the Backyard sports series fame) wrote Backyard Hockey, IIRC, with Python as the central language, calling out to C++ functions as and when necessary. It''s really up to you, but I find their approach beneficial because the C++ code tends to be utility - heavy lifting stuff that doesn''t get altered much once it''s complete and correct - while the scripting language tends to control interaction and therefore should lend itself to tweaking and successive/iterative refinement. Again, it depends on the architecture and objectives of your software.
For our engine, we use a modified version of the C javascript implementation, and make most low levels facilities accessible from the scripts (including shaders compilation, threads, network).
While we explicitely recommend users to avoid using some of the low level stuff (like creating their vertices and rendering them directly ;p), other things are really meant to be done from the script side, like the RPC system we use for the network code.
I agree with other people that the main consideration is probably speed. Sometimes people won''t mind trading few FPS for a more simple way to achieve something in their game logic, while others will prefer doing most things in C++ to achieve maximum performance.
One last thing though : the less C++ code you have, the easiest it is to optimize it ;p
While we explicitely recommend users to avoid using some of the low level stuff (like creating their vertices and rendering them directly ;p), other things are really meant to be done from the script side, like the RPC system we use for the network code.
I agree with other people that the main consideration is probably speed. Sometimes people won''t mind trading few FPS for a more simple way to achieve something in their game logic, while others will prefer doing most things in C++ to achieve maximum performance.
One last thing though : the less C++ code you have, the easiest it is to optimize it ;p
quote: Original post by spiffgq
Many of the open source games and game engines I have looked at seem to use scripts to run the C++ parts. This is kind of cool because it allows for very easy tweaking of behavior. In fact, writing a console that can interact directly with the scripting language would make it possible to tweak the behavior while in-game.
In fact, if you had such a console, you could develop the whole game without ever leaving the game, unless you modified the underlying C++ library.
-Jussi
quote: Original post by Selkrank
In fact, if you had such a console, you could develop the whole game without ever leaving the game, unless you modified the underlying C++ library.
-Jussi
Now that would be something. You could even embed vim or emacs for some serious editing
SpiffGQ
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement