Scripting Engines...

Started by
19 comments, last by flyguy 22 years, 9 months ago
Hi... I am writing a script editor for my scripting engine in my rpg. I was wondering..how can I make the scripting files so that I can write them in plain english, (the language I wrote), but if someone loads it, they can't make heads or tails of it and can't change it? Should I have the script editor convert the scripts to binary and then have a converter back to the scripting language in my RPG? It seems kind of slow. Please help! Tom "And I invented the internet!" - Al Gore Edited by - flyguy on June 26, 2001 3:23:06 PM
"And I invented the internet!" - Al Gore
Advertisement
I would reccomend changing them to binary, it''ll probably knock the file size down about 75%, plus make it allot easier for your engine to work. The language thing would be pretty cool too. I would probably have an instruction list and a mneonic list, you could switch the mneonics(I know I am spelling it wrong) based on the language.
So you''d suggest having the script editor encode the file into binary, and then decode the binary file and store it in memory, then execute the commands in my RPG? You don''t think it would be too slow?

"And I invented the internet!" - Al Gore
"And I invented the internet!" - Al Gore
I don''t see how it could be slow... it would be faster in my opinion. Rather than doing a lot of language parsing and stuff, the editor would take care of all that. Basically, the editor would ''interpret'' your script and put it into binary form. Then, the game wouldn''t have to do no interpretation, it would be able to just right away execute the commands it reads from the binary file. It would be a whole lot easier.
Ok none of these people know what they are talking, just do this. use a small simple xor cipher algo, with a basic randomizer built in. you select the key and bam, unless there is a leet cracker that really wants to break your script you will have nothing to worry about. plus if your key is the same text size ass the script, and you use the randomizer, you would need a f*in super computer to crack it.

Reality Makes Me XIC
I hack code: passion is my feul. Use my programs, experience genius.
http://www.x-i-c.com/
I am XiCI don't do talk, I code: passion is my feul. Use my programs, experience XiC. http://www.x-i-c.com/
Ok what is with the last post? what does he think this is RSA? His method would require the editor to have the same key no matter what, so that you send the script to me, I could not open the file becuase I have no key. There is no need for that..............

I would write it in C++, but no need for language details. I would use the binary file but also just shift the data left or right every other line.
--What are you nutz?I have nothing to say to your unevolved little brain. The more I say gives you more weapons to ask stupid questions.
Maybe, my suggestion was... misunderstood.

Expand your mind outside of the box: the box being "if its encrypted the user must use a password" bull, it could be set to be crypted to a randomly generated file placed in some intricate location on the user HD. Then the program would just reference the file, and that would be the key. Look its low secrity but for his appearant assumed target audience, imho its pretty good.

Reality Makes Me XIC
I hack code: passion is my feul. Use my programs, experience genius.
http://www.x-i-c.com/
I am XiCI don't do talk, I code: passion is my feul. Use my programs, experience XiC. http://www.x-i-c.com/
You could just "compile" the scripts. It would mean you''d have to have the "source code" scripts, and the compiled ones...and you just don''t distribute the "source code." You''d also get some of the benefits of "compiled" code (speed, size, etc).

This could be as simple as writing out the parsed memory as binary. Then loading the binary file directly into a structure, so you don''t have to parse again.


Epolevne
Go the route of assembly, and use simple opcodes with one or two parmeters. Each opcode has a number assigned to it, and the editor "compiles" the source into the resulting code. Your engine just has to read in a number, use a switch() statement on it, and decide if it should grab 0,1, or 2 more numbers, and do stuff. The go a bit further, and write your own scripting language on top of the "assembly".

Z.
______________"Evil is Loud"
use opcodes...
store the data in raw format...
have each function retrieve its parameters...
this will allow you to pass strings, multiple arguments (first arg=how many to read), whatever...
store everything in raw format (i.e. write out data types in binary, strings direct to file with null terminator, and when you read a string just start reading bytes until you hit the null...

it can do control statements like ASM, use a JMP (JE, JL, JNE, etc) that executes fseek()...
start it with a binary zero (perhaps after a few header bytes) and most text-editors will choke trying to read it...
you''ll be able to see the strings, but you need a hex-editor to read numbers, and you have to simultaneously figure out what the opcodes are and how they read their paramteres, because there''s nothing in the file that says, "okay this is an opcode", you rely on each function pulling its arguments correctly to get the file position cursor set to something that''s the next opcode...
not very error-friendly, but it should work if the script is clean...

if you REALLY want security, use some form of encryption (XOR could work) on the entire file, then load it into a memory file and decrypt it... that way you could support both encrypted and non-encrypted scripts and theoretically only care which it is when you load and unload it

--Tr][aD--
--Tr][aD--

This topic is closed to new replies.

Advertisement