Announcement

Collapse
No announcement yet.

UTILITY: FLIC Editor: Change unit graphics

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • UTILITY: FLIC Editor: Change unit graphics

    Well, Apolyton Civfanatics beat ya this time
    See: http://forums.civfanatics.com/showth...threadid=10208

  • #2
    see below for latest version
    Last edited by MarkG; November 27, 2001, 03:36.
    Co-Founder, Apolyton Civilization Site
    Co-Owner/Webmaster, Top40-Charts.com | CTO, Apogee Information Systems
    giannopoulos.info: my non-mobile non-photo news & articles blog

    Comment


    • #3
      "full" version (for those who dont have vb5 runtime dll's
      Last edited by MarkG; January 5, 2002, 13:47.
      Co-Founder, Apolyton Civilization Site
      Co-Owner/Webmaster, Top40-Charts.com | CTO, Apogee Information Systems
      giannopoulos.info: my non-mobile non-photo news & articles blog

      Comment


      • #4
        and readme....





        README.TXT
        for FLICster 0.1.1beta
        by Moeniir - moeniir@home.com

        WHAT IT IS
        ----------

        FLICster is a FLC file utility for working with unit .FLCs for Civization III from Firaxis/Infogrames. This version is *extremely* beta quality. For the love of all that is holy, BACK UP YOUR civilization III\art\units folder and all subfolders before running this thing. You've been warned.

        WHAT IT DOES
        ------------

        FLICSter, or at least, this version of FLICster, does two things. Well, three things. The first feature - it can read a Civ III unit animation (.flc) file and split it into 8 standard .FLC files ( one for each direction, N,NE,E, etc ) which can be edited with a standard FLC editor like Animation Shop. The second feature - it can read in 8 standard FLC files and turn them into a CIV III compatible unit FLC (with a truckload of limitations and caveats - keep reading). The other feature is that it can spit out a bunch of information about FLC files to help in diagnosing problems.

        WHY IT EXISTS
        -------------

        The FLC format is a file format for animation - a series of still frames, displayed in sequence. CIV III uses FLC files for many purposes, most complex among them for unit animations. Each unit in CIV III has several different animations - run (movement), attack, death, fidget, etc. Each animation is stored in a FLC file. Unfortunately for potential unit creators, CIV III uses a non standard FLC format. For this reason, existing FLC editing programs, such as Jasc's Animation Shop, cannot edit these files. Some programs just crash opening the CIV III files, others appear to work, but any files saved from them will crash CIV III. FLICster was created to address this problem. Keep reading for all of the gory details (at the end of this file).

        INSTALLATION
        ------------
        Run the installer. If you already have the VB6 runtime on your system, you may be able to get the SMALL distribution, which is just the exe and the readme. If so, you can figure out the rest In any event, check the civ III forums on http://www.civfanatics.com for the latest version.

        HOW TO USE IT
        -------------
        Run FLICster.exe. Click the little ... button next to the filename box, to browse for files. It will start you in C:\Program files\infogrames interactive\art\units. If you installed to another location, sorry. I'll fix that next release (I think). Navigate into a unit folder, pick a FLC file, and click okay. Now, in the main interface, you can click 'View File Info' to see a bunch of info about whats in the file. I suggest you do this before splitting a file... it'll hoot if it can't make sense of the file. Now, click 'Split File' to create the direction files. FLICster will create a subdirectory, called FLICster (didn't see that coming, did you?), in the folder where the civIII file was opened. This subfolder will contain an INI file used for remerging, and 8 animation files.

        Edit the individual animation files. Please don't change the size (height & width) of a file, unless you've read THE GORY DETAILS and are sure you know what you are doing. Also, DON't change the number of frames. Just resist the urge man.

        Once you are ready to see your handi work in CIV III, run FLICster, and browse to the FLICster folder containing the files you've been editing. Point it at the INI file (be sure to thet the INI file in the FLICster subdirectory, NOT the INI file in the unit directory - that belongs to civ III). Click 'View file info' to test the files. If there is a potential problem merging, you'll be warned. Once this is done, if all is well, click MERGE. The new FLC will be put in the FLICster subdir where the INI file came from. Its up to you to move it up a level into the unit folder. AND YOU REMEMBERED THE BACK UP, RIGHT?

        BTW, take a look in the INI file if you like. When testing the program, I split open the CavalryRun.flc. I then hand edited the INI file to change which animations went with each direction (it has simple lines like "NE=CavalryRun_NE.FLC". Then I merged and tested it. I got a cavalry unit that gallopes backward everywhere it goes. WARNING: Don't get crazy and try using paths (like, "NE=C:\MYWORK\UnitRun_NE.FLC"). All your files have to stay in one directory. Sorry.

        LICENCING
        ---------

        There isn't really any. Use it, abuse it, share it with you friends. Just dont:
        - distribute part of it. If you share it share the whole thing (including this README!)
        - Blame me if it breaks. I told you it was extra-beta with a side of "oops!"
        - forget to backup your art\units folder. Really.
        - Decompile. I'll probably release source code once I clean it up (but no promises). If you just can wait, e-mail me.

        THE FUTURE
        ---------

        The fututre of FLICster depends on a few things. First of all is Firaxis. If they release a whiz-bang FLC editor for CIV III, that will probably make reduntant all of this. Another dependancy is you - and everyone else. If people like it, I'll probably keep working on it. If people hate it, well, screw 'em, I may still keep working one. Lastly, is my time. I have a wonderful job as a programmer which feeds and clothes me and mine. But it takes up my time. As do my home, my wife, and my kids. In between times, I like to play CIV III (duh). FLICster is somewhere further down the list.


        APPOLOGIES & CREDITS
        --------------------
        I've never done anything with graphics programing or graphics file formats before. So If I screwed up, sorry. Also, I'm no artist or mod maker, so I haven't really put this thing thru its paces. Sorry there too.

        Big thanks to SWB of Civfanatics' "CIV3 Creation and Customization" forum (http://forums.civfanatics.com) for getting the ball rolling on this. Thanks also to Dan Megha of firaxis for reading the threads and getting Mike Breitkreutz, a Firaxis developer, involved. Big Thanks to Mike Breitkreutz for sending SWB a rundown of the custom parts of the format. ANother round of thanks to SWB for posting that info, and a link to an excellent FLC format reference at http://www.compuphase.com/flic.htm. These are the resources I used to build this thing.


        THE GORY DETAILS
        ----------------

        1. Frames
        Each unit in CIV III can face, and move in, 8 directions - the 4 cardinal directions (N, E, W, S) and the 4 'betweens' (NE, NW, SE, SW). In order to animate, say a horseman moving, you need 8 animations - one for each direction. Instead of having 8 FLC files for each animation, Firaxis decided to combine the 8 animations into a single file. They also added a custom header inside a 'reserved' 40-byte range in the standard FLC header.

        A FLC file doesn't normally just store a bunch of still images. To save space, the first frame is stored, and then DELTAs are stored. A delta is a description of the difference between two frames. Taking the RUN animation of the CIV III Horseman unit as an example, it turns out that the Horseman RUN animation is 10 frames long (for a single direction). So, instead of something like this:

        IMG1, IMG2, IMG3, IMG4, IMG5, IMG6, IMG7, IMG8, IMG9, IMG10

        The FLC Format would store this:

        IMG1, DELTA1->2, DLT2->3, DLT3->4, DLT4->5, DLT5->6, DLT6->7, DLT7->8, DLT8->9, DLT9->10

        Only, there's another surprise. After displaying only the changes, or deltas, up to frame 10, the program looping an animation would have to display all of frame one, which is slower. SO, FLC files include an extra DELTA frame, called the RING FRAME, which is the delta from the last frame back to the first. In our case, this means we add DLT10->1 to the frame list above.

        SO, we seem to have 11 frames for a 10 frame animation. The header of the FLC file has a field indicating the number of frames, it should say 10, and programs reading the file should know about ring frames.

        Now, in the case of a civIII file, say, the horseman FLC we were discussing, the file contains 88 frames (8 directions x 11 frames per direction). The Frames field of the header, however, says 80. So if a standard program reads a CIV III file, the best you can hope for is 11 frames of SW, 11 frames of south, etc, ending with 3 frames of West - 80 of 88 frames, including 7 ring frames. When splitting a CIV III FLC, say, HorsemanRun.FLC, FLICster will emit 8 standard flics, with names like HorsemanRun_SW.FLC, HorsemanRun_S.FLC, etc. It also spits out an INI file, which specifies all the the standard files created, as well as a few other pieces of info from the reserved field of the original header - information need to remerge the files.

        2. Colors
        In addition to the framecount issues, there is another issue that arises when splitting. In a FLC file, each frame is stored in a 'Chunk'. Each frame can (and indeed, must) contain sub-chunks. The first kind of subchunk you are likely to find is a BYTE_RUN chunk. This is just a RLE-encoded image. The first frame of an animation will always contain a BYTE_RUN (well, always for purposes of this discussion). The next type of chunk you'll see in a frame is DELTA_FLI. This is delta info. So, our Horseman's 10 frame run might be 1 frame containing a single subchunk of type BYTE_RUN, followed by 10 frames, each containing a single DELTA_FLI.

        BUT (and there's always a but, isn't there), the images in the BYTE_RUNs are 64 color or 256 color palleted bitmaps. So, we need to stick a pallete in there, at least for the first byte_run. And you know, if we could change palletes as we load deltas, we could get some cool effects, and extend our color range for the whole animation. So, it turns out, any FRAME chunk can contain a COLOR_256 chunk (or color_64, but CIV doesn't go play that way) in addition to a BYTE_RUN or DELTA_FLI.
        In practice, I found that for many CIV III files, only the first BYTERUN has pallete, but for others, several frames have palettes. IN EVERY CASE I LOOKED AT, however, only the frames in the first 'direction' ever had palettes. In our horseman example, that means the the first 11 frames (10 + ring), you may see COLOR_256 data, but never in the other 77 frames.

        FINALLY getting to the point, that means I can't just split the FLCs willy-nilly. If I did, only the SW facing files (SW is direction 0, for the trivia-minded) would have palettes. So my solution is to steal the palette(s) from direction 1 for each other direction. SO, if in direction 1, frames 1, 3, and 7 have a COLOR_256 chunk, all the split files will get the same chunks for frames 1, 3, and 7, so you editing program shows the right colors. On merging, the the palettes from the first direction are used, the others are tossed. I should add some code to resolve the palettes, but not this time. The moral of the story is, don't go mucking about in the palettes unless you're willing to do it in all the component FLCs you will merge into a unit.

        3. Clipping
        We're not done yet. Seems that firaxis decided to make all animations 240x240, but most don't need all that room. So, to save space in the files, they clip the frames. Imagine printing all 80 frames (not including ring frames) for our horseman onto cellophane, and then stacking them up. The smallest rectangle you could draw around the pictures in the stack is the clipping region. In the case of our running horseman, the clipping region is 71x80 pixels, offset (83,57) from the top left corner of at 240x240 square. So, the civ III FLC stores 71x80 size frames, and makes a note in the custom header (insider the reserved space in the standard header) that the original size was 240x240, and the offset is 83x57.

        What this all means is that for now, YOU ARE STRONGLY URGED to create new units by starting with a standard unit. Split it, open each directional animation with something like Animation Shop, edit the animations, and remerge. But DON'T change the size of the frames! If you do, you'll need to tamper with the INI file that FLICster creates, so don't. I'll probably look for a way to address this later.
        Co-Founder, Apolyton Civilization Site
        Co-Owner/Webmaster, Top40-Charts.com | CTO, Apogee Information Systems
        giannopoulos.info: my non-mobile non-photo news & articles blog

        Comment


        • #5
          New version on the horizon

          Thanks to MarkG and the gang for posting this for me. Hope everyone enjoys it.

          I've had reports of problems merging files that have been edited using Animation Shop. It seems to be a palette issue... animation shop likes to compress the palettes. I'm working on a fix/workaround... and I successfully modified the ModernWorkerRun animation (added a bird with flapping wings) and tested it in the game. I need to do a little more work before I release an update, I hope it will be later tonite.

          I will post new versions here as they become available. For ongoing discussions about the app, you can check this thread: http://forums.civfanatics.com/showth...threadid=10208. And if all else fails, drop me a line. (moeniir@home.com)

          I'm dying to see a new unit, but I'm no artist! Let me know if you create something!
          But hey, thats just my 31,000 Turkish Lira

          Moeniir

          Comment


          • #6
            UPDATE: FLICster v0.1.2beta with improved palette support

            First, sorry this is very late in being posted. Had something unexpected come up this evening.

            Second, I'm not building a new full install, at least not tonite. If you already have the tool, just replace FLICster.exe with the new one. If not, please run the installer (at the start of this thread) and then replace the exe with this version.

            NOW: What's new? Palettes, thats what. In a CIV3-FLIC, all the directional animations share a palette. When FLICster splits a CLIV3-FLIC into Standard FLCs, each FLC gets its own copy of the palette. Animation Shop has a nasty habit of "optimizing" the palette (its not a bug, its a feature!) by re-arranging and even merging the entries. This is a Bad Thing. Further, when editing the cells in another program (say, PaintShopPro), if you make any changes to the palette of any cel, you can end up with multiple palettes in one animation. While this is technically legalk in a FLC, it seems to also be a Bad Thing for civ3.

            So, on to solutions. Most of the Civ3 FLCs (mebbe all? not sure) follow a pattern - the first frame of the first direction (SW for those keeping score at home) has a palette (COLOR_256 chunk with 1 packet of 256 rgb tuples, but who's counting), and none of the other frames in any direction do. So, I've updated FLICster to take advantage of this.

            When splitting a file, FLICster 0.1.2 will read the COLOR_256 chunk of the first frame of the first direction (basically, the palette for the whole animation) and emit the palette as a JASC .PAL file - a saved palette file usable by AS & PSP. It's created in the same directory as all the split files.

            When editing a FLC file using Animation Shop, be sure to edit the individual frames in PSP (they're integrated... go for it). Once you open the frame in PSP, go to the Color menu, and choose Load Palette (edit palette and save palette aren't available yet, because PSP thinks the file has transparency info. Go figure), and load the .PAL file created during the split. You will be asked if you want to "flatten" the file. Yes, you do. BE SURE that when you load the palette, you choose 'Nearest color' error correction. Since all the colors in the picture are in the palette already, there's no error correction needed, and everything will look fine. Now, you are using the exact palette the original CIV3-FLIC used. IF YOU CHANGE THE PALETTE (edit palette on the color menu) - there are 3 rules. Rule 1 - stay away from the first row of 16 colors - all shades of blue. These are the colors that CIV3 translates for civ colors, ie, green for persia, pink for france, etc. Rule 2 - Don't touch that last color! The gawd-awful fucia we all know and hate is the transparency color, and I think Civ3 wants that in the last spot on the palette. Rule 3 - save the palette and use it for ALL of the animations, and all of the frames.

            Okay, if you've gotten this far, then you have edited all the cells in a standard FLC file, and it's time to save the changes. First up, select all the frames at once in AS and right click to choose properties. In the ensuing dialog, change the frame delay to 1/1000 of a second. By default, the AS seems to use 6 ms, which is nice for viewing your FLCs in AS, but BAD BAD BAD for saving. Right before you save it, be sure you set the frame delay to 1 MS. Good.

            Now, save it. When you save a FLC in AS, you get a dialog box. Click the CUSTOMIZE button. Pick 256 colors, and choose "Custom Palette". Now click Browse, and browse to your PAL file ( the one FLICster created for you, or the one you created if you edited the original PAL ). Okay, NOW you can save it.

            I did test this, and it worked fine. I put a flapping bird over the shoulder of the Modern Worker's RUN animation (South bound only). Sorry, i'm no artist. Anyway, using the above steps to keep the palettes in sync, I re-merged the file and tried it in game. WORKS! WOOHOO! I would post it for people to see, but I did it at work (blush) and forgot to mail it home. I'll try to post it tomorrow.


            As I've said before, I think this process is pretty &*%^** unwieldy, and I don't like it. I'm working on something better. In the mean while, I figured folks would rather have a poor tool than no tool at all. The updated EXE is attached. Stay tuned for more.

            PLEASE post your successes/failures... I really want to see this help folks, but I don't have the time or the artistic talent to do as much testing as i'd like.

            *File Removed* - Please get latest version from end of this thread. Current version is 1.0.0 as of Jan 5 2002.
            Last edited by Moeniir; January 5, 2002, 17:04.
            But hey, thats just my 31,000 Turkish Lira

            Moeniir

            Comment


            • #7
              UPDATED Info for FLICster Users - Palettes, round 2

              IN the post notes & readme for FLICster 0.1.2:

              Originally posted by Moeniir
              Rule 1 - stay away from the first row of 16 colors - all shades of blue. These are the colors that CIV3 translates for civ colors, ie, green for persia, pink for france, etc. Rule 2 - Don't touch that last color! The gawd-awful fucia we all know and hate is the transparency color, and I think Civ3 wants that in the last spot on the palette.
              This isn't the whole story. SWB of the CivFanatics forums provided the following correction:

              (In the following discussion, I'm assuming the colors in the palette are numbered 0-255, and the palette is conceptually arranged in 16 rows of 16 colomns. Row 1 contains colors 0-15, row 2 contains 16-31, etc.)

              Actually, there are more reserved colors than the ones Moeniir mentions. For any of the reserved entries, the particular color used is irrelevant - the only thing that matters is its position in the color table. If you don't like the magenta, feel free to use any color you wish, as long as it's at position 255.

              The last 8 colors (numbered 248-255) in the palette are used for alpha blending. The last color (number 255, usually magenta) is fully transparent. The other seven colors (248-254, usually all red) represent a "transparency ramp" (for lack of a better term). These colors are used for the shadow. Color 248 is the darkest (least transparent) part of the shadow, and each successive color is progressively lighter (more transparent).

              The first 4 full rows (64 colors, numbered 0-63) - not only the first 16 colors - are used for civ colors. The civ colors are stored in the PCX files in the "Palettes" subfolder (under "units"). Each PCX file is only 1 pixel (in the primary color of the civ), but contains a palette of 70 civ-specific colors. The PCX palettes are reversed compared to those in the FLC files. For civ colors, the first 4 rows in the FLC palettes are replaced with the last 4 rows (in reverse order) of the civ's PCX palette (color 0 in the FLC is replaced with color 255 in the PCX, color 1 in the FLC is replaced with color 254 in the PCX, etc.). I'm not sure what the extra 6 colors (numbered 186-191) in the PCX palette are used for.

              So, this means there are 184 colors (numbered 64-247) left over for arbitrary use in your units. It also means that creating professional, high-quality units is going to be really complicated - you'll need to use the right reserved colors in the right places to get nice looking shadows and proper civ-specific coloration.

              Steve W. Brewer (SWB)
              So be extra careful with your palettes. Big thanks to SWB for the info.
              But hey, thats just my 31,000 Turkish Lira

              Moeniir

              Comment


              • #8
                NEW & IMPROVED: FLICster 0.2.2 (build 5)

                It's still beta, but it's a whole lot better. Full details in the readme, but here's what's new:

                CURRENT: v0.2.2 (build 5) beta

                * New versioning scheme. The build numbers will always go up, even with major version changes. The build numbers may also skip, because not all builds get released.

                * Fixed a merge bug causing incorrect chunk counts in frame headers after direction 0

                * Fixed a merge bug caused by assuming color_256 chunks always follow a byte_run. Sometimes they precede it.

                * Now sets the Creator field of the standard FLC header to 0xF2F2F1F1 when merging. Civ may crash if another number is present.

                I'm attaching the latest SMALL patch, use if you already have the program. If you want the full installer, I'm mailing it to MarkG to post (too big for me to post), so look for it on this thread.

                Removed. Please download latest version from end of thread. New version is 1.0.0 as of Jan 5 2002.
                Last edited by Moeniir; January 5, 2002, 17:03.
                But hey, thats just my 31,000 Turkish Lira

                Moeniir

                Comment


                • #9
                  Hmmm. Interesting. I'm curious, is there anyway to change an avi animation of same pixel size into a flic format?
                  By working faithfully eight hours a day, you may get to be a boss and work twelve hours a day.

                  Comment


                  • #10
                    I don't know much about this tool, but check out Smacker at www.radgametools.com. I believe it will do that.
                    But hey, thats just my 31,000 Turkish Lira

                    Moeniir

                    Comment


                    • #11
                      latest full version in my first posts on this thread....
                      Co-Founder, Apolyton Civilization Site
                      Co-Owner/Webmaster, Top40-Charts.com | CTO, Apogee Information Systems
                      giannopoulos.info: my non-mobile non-photo news & articles blog

                      Comment


                      • #12
                        Originally posted by MarkG
                        latest full version in my first posts on this thread....
                        The zip file you have attached is corrupted Markos...

                        Comment


                        • #13
                          Here's an alternate encoder/decoder for unit FLICs. This one also allows you to alter rendering parameters such as X and Y offset and frame speed without having to re-encode, and decodes directly to bitmaps, not flc's. I'm not sure why I bothered finishing it, but I just felt I had to.
                          Attached Files

                          Comment


                          • #14
                            New and Improved!: MAKE YOUR OWN UNITS - FLICster v1.0.0

                            Version 1.0.0 Now Available

                            Well, It's finally done. FLICster v1.0.0 (build 17). Its a major revamp. Hopefully you won't even recognize it. Here the short list of new stuff:

                            * New FLC Viewer. Allows viewing of Civ3UnitFlcs. Each direction can be viewed. Units can be viewed with default colors or with any civ-specific colors. Also allows viewing with 'simulated alpha blending', to show how shadow effects actually look.

                            * New Export formats: StoryBoard PCX, Filmstrip PCX, and Cel PCX. Storyboard creates a single PCX containing all frames of all directional animation laid out in a grid. Each direction is tiled left-to-right in its own row. Filmstrip is similar, except that each direction's row of frames is saved to a different PCX file. Cel creates a separate PCX for each frame in each direction of the animation. Exporting to these formats also creates a FXM (FLICster eXport Manifest) file, containing information required to create a new Civ3UnitFlic from the PCX File(s). Storyboard and Filmstrip formats can include an optional border (recommended!).

                            * New FXM Viewer. The FXM viewer allows the animations stored in a PCX Storyboard, or PCX Filmstrips/Cels, to be viewed just like a completed FLC. Viewer features are the same as the FLC viewer. Additionally, the FXM viewer has a 'Popup' mode, which hides the full application, and displays an always-on-top version of the viewer, for checking your progress while editing the PCX file(s).

                            * Change more stuff - when exporting to PCX, you can change the frame size, frame count, filename, color palette, and animation speed.

                            * Start from scratch - Just select File|New... to create a blank StoryBoard (or other PCX format).

                            * Support for single-direction Civ3UnitFlcs, such as CruiseMissileDeath.flc

                            * Additional PAL file created with 'Alpha' coloring. See 'HOW TO USE IT' for important details.

                            * FLICster 0.2.2 style 'split' and 'merge' functionality is still supported, although it is deprecated. To split a file into standard FLC files, open the Civ3UnitFlc and set the export type to 'Multiple Standard FLCs'. Still creates an INI file. To merge the standard FLCs into a Civ3UnitFlc, Choose File|Open... and select the INI file. You may need to set the file type to "*.*"

                            * Help|About... function.

                            * Rewrote the readme file.


                            As always, I will send copies to the mods, to post here if they wish. In the interim, I've posted the full install and a small install to my Yahoo! Briefcase - http://briefcase.yahoo.com/moeniir. Note that in order to use the small install, you will need the latest comdlg32.ocx, mscomctl.ocx, mscomct2.ocx, and msvbvm60.dll. If you aren't sure, just grab the full install.
                            But hey, thats just my 31,000 Turkish Lira

                            Moeniir

                            Comment


                            • #15
                              1.0

                              small version

                              Moeniir, please remove previous versions from other posts in order to avoid confusion...
                              Attached Files
                              Co-Founder, Apolyton Civilization Site
                              Co-Owner/Webmaster, Top40-Charts.com | CTO, Apogee Information Systems
                              giannopoulos.info: my non-mobile non-photo news & articles blog

                              Comment

                              Working...
                              X