Ambrosia Garden Archive
    • fwstructs


      a python module

      Over the last few months, I've been working on a python module for Ferazel's Wand. It's called fwstructs, and it allows people to manipulate Ferazel's Wand data without having to use C or C++. It should be bug-free, but just post if there's some problem that you come across.

      You can download the module here: http://habnabit.org/fwstructs.zip

      It comes with two example scripts of how to use fwstructs, bgrandomizer and counter. If you run bgrandomizer in Terminal and pass it a Ferazel's Wand world data file, it will load all of the levels and randomize the background tiles. counter will load all of the levels and then prompt for sprite IDs to search for, then returning where exactly each is in each level, including objects in sprites and crates.

      The only problem is that fwstructs does not actually load the resources. However, there is a module included by default on the Mac OS called Carbon.Res which will load and save resources. The example scripts should show how to use Carbon.Res. I find that since Carbon.Res has little to no documentation, the easiest way to experiment with how it works is to use the python interactive prompt.

      edit: http://www.habnabit.org/?m=fwstructs for latest versions of everything.

      This post has been edited by ferazel_09 : 05 January 2008 - 04:11 PM

    • Even though nobody seems to care, a new version of fwstructs has been released just in time for its one-year anniversary. Enjoy a much nicer version of it.

      http://habnabit.org/fwstructs2.zip

      Included are updated versions of counter and bgrandomizer, as well as a new script, savedgame, which goes through a saved game file and makes every chest in the game unlocked and contain 20 platinum coins. I couldn't really think of anything too useful for this script to do, but if anyone has any suggestions, I could probably hack something else up.

      This post has been edited by ferazel_09 : 09 October 2007 - 11:38 PM

    • Wow, sorry I didn't even know this topic existed. So what does this program do? Is it like another version of MASCOT or does it run files in OSX?

      Sounds interesting.

    • @two-jacks, on Oct 9 2007, 10:52 PM, said in fwstructs:

      Wow, sorry I didn't even know this topic existed. So what does this program do? Is it like another version of MASCOT or does it run files in OSX?

      Sounds interesting.

      Not quite either, but it does work in OS X easier than OS 9.

      In C, one can define a struct, which is a way to make a new data type. For example, in Ferazel's Wand, there is a struct defining level data. All of the properties a level has are included in this data type, and a string representation of this struct is saved in the resource fork of a world data file.

      Now, this is great for people who use C regularly. I, however, prefer using python. This module allows me to do most of what one could do in C with python. With enough time, one could develop a whole new MASCOT in python using this. I don't do any GUI work, so it wouldn't be a job for me, but someone might. However, I am sketching out in my head a script that can make an image that shows an idea of what a level's foreground/background look like, possibly even showing sprites.

      I guess I should repost a copy of FerazelFormatStuff.h, since my module uses all of its property names.

    • Okay, here's FerazelFormatStuff.h, for anyone who wants it still:
      http://www.habnabit....elFormatStuff.h

      I was experimenting with a framework called Pashua just now, and I have a small application which executes the BGRandomizer script. Unfortunately, it doesn't give any sort of feedback, but it will randomize your background tiles for every level.
      http://www.habnabit....GRandomizer.zip

      Also, fwstructs2.zip has been updated. There was a small bugfix and there's now a new script in there: accountant. This script is like Drop Statistics, except more powerful and extensible. It runs from a command line interface, but I'll work on giving it a GUI like BGRandomizer's later.

      This post has been edited by ferazel_09 : 10 October 2007 - 07:44 AM

    • Ok I want to try it out, but don't know where to start. Help?

    • @two-jacks, on Oct 10 2007, 08:19 AM, said in fwstructs:

      Ok I want to try it out, but don't know where to start. Help?

      I'm not sure whether you understand what this actually does. fwstructs is a python module, that is, it can be imported into a python script so that the script can work with Ferazel's Wand data. Examples of how this can be done are included in fwstructs2.zip, such as the accountant, bgrandomizer2, count2, and savedgame scripts.

      If you don't know python, or don't plan on learning it, this is basically worthless for you.

    • Hm, well I don't even know what Python is. Is fwstructs an experiment to see if Python could be used to edit Ferazel world data?

      Sorry I'm new to this, didn't mean to upset.

    • @two-jacks, on Oct 10 2007, 07:31 PM, said in fwstructs:

      Hm, well I don't even know what Python is. Is fwstructs an experiment to see if Python could be used to edit Ferazel world data?

      Sorry I'm new to this, didn't mean to upset.

      Sort-of, I guess. It's fully functional, so I think it's a bit more than an experiment at this point. It also can edit any kind of Ferazel data, so, anything in the world data files as well as saved games.

      Python is a cross-platform scripting language. I do basically all of my programming in it.

    • More updates! I don't know why I'm even writing updates to this still, but I am. There's two new modules in the package, reswalker and resize. Resize will actually resize your tilemaps to whatever size you want without having to start designing a level over again. It will resize any tilemap, including pxBack tilemaps and pxMid tilemaps.

      Reswalker is a neat little module that's designed to increase the speed of a new feature in fwstructs: data is now stored in file objects, so read/write times are a little faster than they were before. Reswalker will read the raw resource fork of a file and determine where the actual resource data is, which lets you create (still using this module) file objects to access any resource. Just using file objects speeds fwstructs up considerably, and using reswalker as well will speed up reading and writing if you're doing a lot of it.

      Bgrandomizer and accountant also come in the package with versions of them written using reswalker, so you can see how reswalker works.

      quick edit: If you've downloaded the package in the last three hours, you should download it again, because I just made another fix to it. Nothing major; it's not a bugfix, just a slight performance improvement.

      Also, here's a little preview of another project I've been working on intermittently:
      Posted Image

      This post has been edited by ferazel_09 : 04 December 2007 - 08:48 PM

    • @ferazel_09, on Dec 4 2007, 02:33 PM, said in fwstructs:

      Also, here's a little preview of another project I've been working on intermittently:
      Posted Image

      Wow, that's awsome! Looks alot better than MASCOT that's for sure! I think it's cool your still updating, keep at it. What to think think your final goal will be?

    • Okay! Everything is being moved to a page on my server. I also packaged everything up nicely.

      http://www.habnabit.org/?m=fwstructs