Jump to content
  • Advertisement
Sign in to follow this  
Nairou

Script language search: Speed and portability

This topic is 5404 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

I know, when looking at script languages, speed normally isn't a big factor. But I've got a slightly different use for a script language in my engine, and speed is one of the top priorities. I'm hoping someone can help me thing of some good candidates. I'm designing the material/shader system for my engine, and I'd like each shader program to be a portable self-contained module, which can be loaded by the engine when needed. Since the shader program will be called many times per frame, speed is omportant. I know I could use DLLs for this task, and if all else fails I may have to, but I'd prefer to not have to recompile the shaders for each platform. End-users may be creating additional shaders in the future, and I want gamers on all platforms to be able to use them. As far as I can tell, this limits me to languages which have a JIT available. I'm really wanting the language to keep a C-like feel to it, so I (and others) don't have to learn something obscure in the process. I really had my eyes on Squirrel for my main engine scripting, as it is C-like and compiles to byte-code (therefore portable), but there doesn't appear to be a JIT available for it (I wonder how tough or effective it is to write JITs for these VM languages?). Anyone have ideas on some good language candidates for this task? EDIT: I seem to have overlooked the obvious: Writing the shaders in C, and just building a C compiler into my engine. Has anyone attempted something like this before? Any pros/cons?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Nairou

I seem to have overlooked the obvious: Writing the shaders in C, and just building a C compiler into my engine.
...or even more obvious, compiling them into your engine or as external DLLs and just executing them.

Share this post


Link to post
Share on other sites
DLLs are probably what you need. I remember hearing somewhere you can use C# as a scripting language though, which would be a good solution.

Share this post


Link to post
Share on other sites
I know I could use DLLs, but as I said I'm trying to avoid that, since DLLs are platform-dependent. I would have to include a separate copy of each shader for each platform I target, as well as hope that anyone else making shaders does the same.

I'm trying to treat the shader programs as resources, part of my material system. Each one may or may not be used in a particular scene, and updated shaders may be created in the future to improve quality or performance on existing game installations, so they can't be built into the engine.

Share this post


Link to post
Share on other sites
why don't you take a look at Cg by nvidia or HLSL fx files? if need be, i'm sure oyu could write your interpreter for the desired platform. they are straight forward c-like languages. But at least this way you can just start off coding shaders like everyone else and then expand later. additionally, this allows your artists to use render monkey, 3dsmax, etc to generate shaders.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!