View Full Version : i need tutorial/example/guidance on level editor
bluemagica
03-12-2008, 02:52 PM
:confused:well i was on tony pa's pages and reading about tile based games and how to make a editor for them, but then i will be restricted to a fixed grid size and that is not always the case....i mean, the boss can be larger than hero, and platform can be thinner...so is there any other way of making a level editor? and if the same thing can be achieved via tile based design....where can i find some details on it?
:pOH, and i got one more question, is it possible to execute code from a external file? i mean say i have a block of code written in a xml file...how do a i read and execute it as a block of code in the game?
:rolleyes:And lastly, is there a way to write data from flash to a file/database/anything without using php? I mean i can easily read data in flash...but how do i write from it?
Bombdogs
03-12-2008, 05:38 PM
The tile size generally doesn't limit the size of things, bigger bosses would use more than 1 tile, smaller walls still use 1 tile space but only a bit of it. Choose the tile size to suit the elements in your game but don't make them so small/big that they lose all their power in terms of efficiency. Take a look at 8bitrocket.com for loads of good resources/tutorials & also do a google for a program called Mappy (i think).
You can't execute code from an external XML file - my question is why would you need to? XML is designed to store data - in your case the levels themselves would be good to store in XML.
You can read/write directly to a database using a class that I can't quite remember the name of now. Do a search of the AS3 forum, there's a few threads on it in there. It's very new though & as far as I'm aware hasn't been robustly tested, with no real security model. PHP is still very much the standard way.
PMF
bluemagica
03-13-2008, 06:07 AM
Thanks for the info, i will see into it further..
well i wanted to parse string as code, so not only XML file, but assume any string....external codes can make the program really flexible...
And i forgot to mention, i need this info for AS2, as i currently dont have AS3....and for my last question, i simply wish to write data from flash to a external file..for the level editor...and that why i was thinking of any direct method to do it or not...
Bombdogs
03-13-2008, 10:47 AM
The easy way to write data to an external file is to use trace() to output it, then copy & paste it into a notepad file or similar. Obviously this is a solution that only works for the developer, but it is simple if that's all you need.
PMF
bluemagica
03-13-2008, 01:05 PM
sorry to say, but bombdogs, that is totally useless!! please answer seriously.....
I've traced XML before for level editors. It's only useless if you want non-developers to build levels, and you didn't say that's what you wanted.
There's a lot of restrictions on Flash writing to files, for the sake of security, and just using trace functions means you don't have to deal with that.
Durnus
03-13-2008, 06:51 PM
sorry to say, but bombdogs, that is totally useless!! please answer seriously.....
:mad:
That was a serious answer! You could even have it so that the text goes into a text box that the user pastes from, if you want clients to be able to edit the maps. Flash files can't do anything with files by themselves in .swf form, so I think this is the easiest/best way.
Here's a "real" answer:
Install a web server at your machine. Put a php file that writes to a .txt file in the web root directory, called "writer.php" or something. Make it take POST variables to write to files. Then have your flash file call 127.0.0.1/writer.php with the variables that you want to right, and you have your text file.
Not worth the effort, in my opinion.
:p
Bombdogs
03-13-2008, 10:34 PM
*bashful* Thanks for sticking up for me guys. :D You know, I know & bluemagica will find out... if he starts being kinder to people trying to help him!
PMF
bluemagica
03-14-2008, 04:11 AM
sorry bombdogs and everyone if i seemed rude....i might have been a little frustrated in this regard, as i cannot find much help anywhere... but i will try to restate my question....
Now, i know how to write using php, but i just wanted to know if there were any direct way to write to a file....but i guess NO.
Anyway, the only problem that remains now is how to make the code editor.....yes, thats what i want to do, a code editor for flash made in flash.....thats why i was asking if it was possible to parse text as code in flash....
for a mapeditor, i can just save the map data as a list of values(array), and use that....so there are ways to change the value of a variable quite easily....but in my case I want it such that the user can modify a block of code in the game....and this can only be possible if the code, like values, is read from a external source...but as you know, when i read it i read it as text, how do i turn it into code?
Durnus
03-14-2008, 06:44 PM
You can't do that. You would have to program your own code interpreter, there is no way to run external code at runtime. You'd pretty much be on your own, because making scripting language can be a lot of work, and as far as I know there isn't anything out there that already executes code from a text file. Pretty much you'd be loading the text file, but then you'd just use all the values that you get to evaluate what to do to an object. The code would just be instructing your runtime what to do.
I'm sure if Adobe implemented runtime coding there would be huge security issues as well, so I'm pretty sure they aren't going to. ;)
Good luck!
bluemagica
03-15-2008, 04:11 PM
i am not trying to make my own programming language... i am just trying to...well...i guess as you all say it wont be possible....so i think this topic can be closed now.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.