Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualKamikaze15

Posted 10 February 2013 - 07:30 PM

How does the program understand the code? Does it read per each line of string (Wouldn't this be SLOW?), or does it semi compile (like setting all the commands into an array from the beginning), or how?

Like Jason said, you probably won't be handling the parsing or execution of the scripted instructions. You'll be using a library that does that for you.
Usually, when you ask the library to load a script, it will get compiled into bytecode, but some more advanced techniques exist that will actually compile the script code into native instructions that your CPU can directly execute, which improves performance a lot.
This should all be specified somewhere in your chosen library's feature list.
 

Should i just leave it, and use direct c++ (The problem is that i would like to have a way that the user didn't need to compile anything).

There are various reasons one would choose to use scripting in a project. You should research about why should you use it, and then decide whether you'll get advantages out if it or not. Don't just go and force yourself to use scripts if you don't need to, unless you're just learning and have some spare time.
I personally am using scripting (Mono) in my current game project for various reasons, including:

  • game code separation from engine code
  • easier to maintain and add features
  • very fast compilation times

Some libraries (don't know if all) allow you to distribute precompiled files which contain bytecode. This should reduce your scripts filesizes, and protect them against easy editing.

 

How (if you imagine you had to compile it, but not in c++) should i handle the script code, or in other words, how should my program try to understand it (e.g. Now there's a bracket, so go to...).

That is called Parsing, and the library does it for you.

If interested on how to comunicate with the script methods, you should see what others are doing to get some ideas of the implementations. I have an implementation similar to Unity3D where nodes with attached scripts call the script's "update" function every frame and so on...


#3Kamikaze15

Posted 10 February 2013 - 07:28 PM

How does the program understand the code? Does it read per each line of string (Wouldn't this be SLOW?), or does it semi compile (like setting all the commands into an array from the beginning), or how?

Like Jason said, you probably won't be handling the parsing or execution of the scripted instructions. You'll be using a library that does that for you.
Usually, when you ask the library to load a script, it will get compiled into bytecode, but some more advanced techniques exist that will actually compile the script code into native instructions that your CPU can directly execute, which improves performance a lot.
This should all be specified somewhere in your chosen library's feature list.
 

Should i just leave it, and use direct c++ (The problem is that i would like to have a way that the user didn't need to compile anything).

There are various reasons one would choose to use scripting in a project. You should research about why should you use it, and then decide whether you'll get advantages out if it or not. Don't just go and force yourself to use scripts if you don't need to, unless you're just learning and have some spare time.
I personally am using scripting (Mono) in my current game project for various reasons, including:

  • game code separation from engine code
  • easier to maintain and add features
  • very fast compilation times

Some libraries (don't know if all) allow you to distribute precompiled files which contain bytecode. This should reduce your scripts filesizes, and protect them against easy editing.

 

How (if you imagine you had to compile it, but not in c++) should i handle the script code, or in other words, how should my program try to understand it (e.g. Now there's a bracket, so go to...).

Library does it for you. See above.

If interested on how to comunicate with the script methods, you should see what others are doing to get some ideas of the implementations. I have an implementation similar to Unity3D where nodes with attached scripts call the script's "update" function every frame and so on...


#2Kamikaze15

Posted 10 February 2013 - 07:23 PM

How does the program understand the code? Does it read per each line of string (Wouldn't this be SLOW?), or does it semi compile (like setting all the commands into an array from the beginning), or how?

Like Jason said, you probably won't be handling the parsing or execution of the scripted instructions. You'll be using a library that does that for you.
Usually, when you ask the library to load a script, it will get compiled into bytecode, but some more advanced techniques exist that will actually compile the script code into native instructions that your CPU can directly execute, which improves performance a lot.
This should all be specified somewhere in your chosen library's feature list.
 

Should i just leave it, and use direct c++ (The problem is that i would like to have a way that the user didn't need to compile anything).

There are various reasons one would choose to use scripting in a project. You should research about why should you use it, and then decide whether you'll get advantages out if it or not. Don't just go and force yourself to use scripts if you don't need to, unless you're just learning and have some spare time.
I personally am using scripting (Mono) in my current game project for various reasons, including:

  • game code separation from engine code
  • easier to maintain and add features
  • very fast compilation times

How (if you imagine you had to compile it, but not in c++) should i handle the script code, or in other words, how should my program try to understand it (e.g. Now there's a bracket, so go to...).

Library does it for you. See above.

If interested on how to comunicate with the script methods, you should see what others are doing to get some ideas of the implementations. I have an implementation similar to Unity3D where nodes with attached scripts call the script's "update" function every frame and so on...


#1Kamikaze15

Posted 10 February 2013 - 07:22 PM

How does the program understand the code? Does it read per each line of string (Wouldn't this be SLOW?), or does it semi compile (like setting all the commands into an array from the beginning), or how?

Like Jason said, you probably won't be handling the parsing or execution of the scripted instructions. You'll be using a librarry that does that for you.
Usually, when you ask the library to load a script, it will get compiled into bytecode, but some more advanced techniques exist that will actually compile the script code into native instructions that your CPU can directly execute, which improves performance a lot.
This should all be specified somewhere in your chosen library's feature list.
 

Should i just leave it, and use direct c++ (The problem is that i would like to have a way that the user didn't need to compile anything).

There are various reasons one would choose to use scripting in a project. You should research about why should you use it, and then decide whether you'll get advantages out if it or not. Don't just go and force yourself to use scripts if you don't need to, unless you're just learning and have some spare time.
I personally am using scripting (Mono) in my current game project for various reasons, including:

  • game code separation from engine code
  • easier to maintain and add features
  • very fast compilation times

How (if you imagine you had to compile it, but not in c++) should i handle the script code, or in other words, how should my program try to understand it (e.g. Now there's a bracket, so go to...).

Library does it for you. See above.

If interested on how to comunicate with the script methods, you should see what others are doing to get some ideas of the implementations. I have an implementation similar to Unity3D where nodes with attached scripts call the script's "update" function every frame and so on...


PARTNERS