|
-
Game Player - Developer
silly question about games and dependent .as files
Hi again
I see that some of the developers use to create a game using independent .as files, I use to use this files just to store my scripts, now i want to use them to protect a little bit my games and my scripting
How I do that?
I only know how to generate them but just to store them, how I do make my game work calling the external scripting from an .as file?
"I love to make them as I love to play them"
-
Yes we can
erm,i think you´re mixing some some stuff up there.
*.as files are compiled into your game.swf as code like usual code you wrote in the code editor inside your flash document.
There´s no runtime difference between code compiled into your swf from .as files and other which you wrote in the code panel (so there´s no type of security gain or anything).
People just code in .as files to have code which is logically seperated be in own files and also to be able to code using a propper coding tool.
-
Senior Member
Tom sanson is right, however maybe what you are talking is about separate SWF files that are load in runtime? that does help a bit on dissasemblers and such since when a hacker steals your swf by simply saving it, the swfs you load in runtime are missing. and therefore it cant run.
A pretty common practice though is to simply use a fake loader.swf that will only load your actual game. So when stolen, only the loader is downloaded (I think this is the system newgrounds uses right now.)
However this is extremely simple to beat by a pro by simply checking the loader code and the parameters and then solving where the actual files are being loaded from. So is not infallible. but it adds a layer of protection to your code.
Properly Encrypting your code and using necesary external files (like dbases) is the only way to truly protect an swf around these days, at least AFAIK
-
Game Player - Developer
thanks for the commnets
Well I saw once a game with dependent .as files and when I took it out the folder the game just didnt work thats why I though that they where using this to prevent decompiling because you just steal the swf file
I just use .as files to store my scripts i though I could program my flash game and make it work using external files to prevent stealing but ill keep making complete games and the .as files just to store scripts
A pretty common practice though is to simply use a fake loader.swf that will only load your actual game. So when stolen, only the loader is downloaded (I think this is the system newgrounds uses right now.)
That doesn work a bit, in my explorer in MAC OSX showme every file running and download it, so if somebody use the loader and the games I see both files running and is easy to understand that they are attached, but thanks for giving ideas to protect
"I love to make them as I love to play them"
-
Senior Member
You can load external text files with "as" extension. So lets say you have text file with content:
PHP Code:
myvariable=some+stringvalue+to+be+assigned+to+variable
You can then save the file as "data.txt" and load the content of this file using
PHP Code:
loadVariables("data.txt");
Or you can rename the file to "data.as" and still use loadVariables to get the content, it may have "as" extension but its still same text file.
-
Pumpkin Carving 2008
The reason it didn't work when you took it out of the folder is because of the validating path used to access the *.as file. Like in the platformer I'm writing, besides stuff in the library, this is all the code my main .swf file contains:
Code:
#include "display.as"
#include "character.as"
#include "tileSet.as"
#include "enemies.as"
#include "menues.as"
#include "items.as"
#include "maps.as"
onEnterFrame = function () {
Primary();
detectKeys();
update();
};
As you can see there's no relative path to the *.as files imported here. That is because these files rest in the same folder as the .swf file. The code looks for those files there and only there, so if one is missing, it simply isn't imported and Flash continues about it's merry way. However, and I'm simply guessing, based on trend by the time I finish those 7 files I'm going to have between 3 and 4 thousand lines of code. Personally, I use *.as files a simply an organization tool. I used to code on frames and layers in the main .swf, but that always led to problems with functions being called before they were defined ( can't remember if flash reads the stuff in different layers bottom to top or vice versa, but in my experience apparently it matters).
Last edited by ImprisonedPride; 07-27-2007 at 04:40 AM.
The 'Boose':
ASUS Sabertooth P67 TUF
Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
8GB G.Skill Ripjaws 1600 DDR3
ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
New addition: OCZ Vertex 240GB SATA III SSD
WEI Score: 7.6
-
Game Player - Developer
Thanks TONYPA and ImprisonedPride
Ill check it out
"I love to make them as I love to play them"
-
Senior Member
That's the first time I've ever seen #include in actionscript. Does it have the same semantics as it does the C/C++ preprocessor (textual copy/paste at this point)? Can it appear anywhere in your source file?
-
yes it can be placed anywhere,- its just a simply insert (copy paste) of code
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|