123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|733|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Concept/Design -> Script Execution

Sat, 28 Apr 2007, 14:52
Phoenix
As some of you might know, I'm attempting to create a scripting language. At the moment, everything is executed directly when the parser reads the code. This won't work in the long run, and I have to come up with a way to efficiently execute scripts.

My idea is to translate the script to a very compact ASM-like language, for example:

...becomes...

So everything is compressed and you use ID numbers instead of full names.

Then, maybe it would be small enough to realtime parse. I have no idea, so that's why I'm asking if I should stick to another method, or stay with this one?

I don't want to rush through this, because my goal is to make it capable of scripting a game, and that won't happen unless I'm careful.
Sat, 28 Apr 2007, 14:54
Paul
Don't know to be honest, what other options arethere?

Sat, 28 Apr 2007, 15:06
Jayenkai
When I tried doing the scripting engine for my minigames, I found it best to let the scripting language be normal, but to convert everything as it comes in.

So, rather than saying to the user "Write 'int playerlives=3' as 'v01=3'" you'd let the engine do that instead. Keep track of variable names, and replace them with numbers as they come in. It's even quicker (or at least it was in Blitz) if you change all commands to integers. (much like assembly!) so that If becomes 1, For=2, Print =12, etc.. Then you can run through a bunch of Select's/Switch/whatever your language is, instead of If'ing a load of possible words.

Think of it as a micro-compilation as the script is loaded.

-=-=-
''Load, Next List!''
Sat, 28 Apr 2007, 15:24
Phoenix
Maybe I was unclear, I meant that the program translates the code into those small, unreadable lines, like you said. But I didn't know about the integers. Maybe that would be faster.
Sun, 29 Apr 2007, 04:15
Phoenix
Thanks, Agent Smith. I'll have a look at it.
Sun, 29 Apr 2007, 14:12
bram32
For the programming language for my program, I made a system that converts the original (text-based) commands into integers before executing them. That works quite fast. Also it helped to try and limit the amount of data that needs to be processed at runtime. I did that by making a separate set of commands that need only one parameter (add/mul/div etc), and another set that has multiple parameters (move/turn etc)
Sun, 29 Apr 2007, 14:16
power mousey

thank you Agent Smith.

give credit when and where its due.

bram,

are those integers bytes or words?

and also the ones with multiple parameters are they given bytes/integers for look up definitions or constructs??
For the particular parameters....