Jump to content
  • Advertisement
Sign in to follow this  
MrPotatoes

Compile to file?

This topic is 4192 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 thought i read it within your feature list but i'm confused because i didn't see a tutorial/example of it on the site. i'm looking to see if i can get the angelscript files and then compile them into a single file. what i wanted to do is then take that compiled file and read it into memory and use it by my game engine. i need to do this because all the game information (styles, types, rules) would be in the scripts and i don't want to have those freely available to edit because that cheats the idea of the game. is it possible to do this with angel script? if i'm not being clear enough i can clear it up. ------------- ok, i thought of something to make it more clear. i want to compile it to a game package. it will contain all the information for a game type. i'll compiile it to say a shared object or a Dynamic Link Library. from there i can save it to memory and read from it there like an exe. or just read the information. either way i wanted to write script files (not within the code) and then you compile it to a package and i get the information from there. i hope that is better. [Edited by - MrPotatoes on April 5, 2007 12:25:44 PM]

Share this post


Link to post
Share on other sites
Advertisement
After you create your engine and build a script file, you can save it to file by calling the SaveByteCode method. Use LoadByteCode to load it back in.

Check out the docs related to int asIScriptEngine::SaveByteCode(const char *module, asIBinaryStream *out)

Share this post


Link to post
Share on other sites
midnite already told you what you need to know. You can also take a peek at test_saveload.cpp in test_feature, though it was by no means written as a tutorial.

I normally do not recommend using the save/load feature unless you need the extra load performance. AngelScript is not able to validate the pre-compiled bytecodes to make sure they are safe (in regards to out-of-bounds access, null pointers, etc). You'll have to do that validation yourself by making sure nobody has tampered with the bytecode you compiled, e.g. through checksums, etc.

If you're only interesting in hiding the script code, then a simple obfuscation or even encryption might be better, as then the code will not be freely available and it will still go through all the validation done by the script compiler.

Regards,
Andreas

Share this post


Link to post
Share on other sites
Or you could leave it open, but checksum it. This would allow your players to make modifications ('mods'), but not cheat - you just only allow players to play together if they all have the same checksum, or you make everything run on the server and ignore the scripts on the client side.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!