Announcement

Collapse
No announcement yet.

DESIGN: Changing the units.txt layout

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

  • DESIGN: Changing the units.txt layout

    Hi all,

    I was just trying to 'import' the units.txt-file into an excel-file to be able to have an easier overview over the different values. I did it because of the discussion in DESIGN: Armor and HP's. I must admit I am still having a headache to finish it.

    My idea, which I would like to propose (and I would be willing to create it) is instead of having the till now structure in the units.txt file changing it to a more moder and user-friendly version, based on Excel.

    So instead of really changing it by hand, we could do it via Excel. The changes for this to implement (me thinks) shall be easy.

    The file shall be saved as csv, all entries ,even if empty would have a comma-delimiter, so making it easier to check afterwards. This would also allow to re-import into Excel, although I would suggest to have just one master-template (as I said I would be willing to create it, so that you would just select (like: Yes/no, or a value).

    Example:

    So instead of looking like this:

    ## UNIT 0
    UNIT_ABOLITIONIST {
    Description DESCRIPTION_UNIT_ABOLITIONIST
    DefaultIcon ICON_UNIT_ABOLITIONIST
    DefaultSprite SPRITE_ABOLITIONIST
    Category UNIT_CATEGORY_SPECIAL
    Attack 0
    Defense 10
    ZBRangeAttack 0
    Firepower 1
    Armor 1
    MaxHP 10
    ShieldCost 540
    PowerPoints 250
    ShieldHunger 5
    FoodHunger 0
    MaxMovePoints 300
    VisionRange 1
    EnableAdvance ADVANCE_CLASSICAL_EDUCATION
    ActiveDefenseRange 0
    LossMoveToDmgNone
    MaxFuel 0
    IgnoreZOC
    NoZoc
    CanBeExpelled
    CantCaptureCity
    NoSlaves
    IsSpecialForces
    Civilian
    SoundSelect1 SOUND_SELECT1_ABOLITIONIST
    SoundSelect2 SOUND_SELECT2_ABOLITIONIST
    SoundMove SOUND_MOVE_ABOLITIONIST
    SoundAcknowledge SOUND_ACKNOWLEDGE_ABOLITIONIST
    SoundCantMove SOUND_CANTMOVE_ABOLITIONIST
    SoundAttack SOUND_ATTACK_ABOLITIONIST
    SoundWork SOUND_WORK_ABOLITIONIST
    SoundVictory SOUND_VICTORY_ABOLITIONIST
    SoundDeath SOUND_DEATH_ABOLITIONIST

    CanSee: Standard
    CanSee: Stealth
    MovementType: Land
    MovementType: Mountain
    Size: Small
    VisionClass: Stealth

    SlaveUprising {
    Sound SOUND_ID_SLAVE_UPRISING
    Effect SPECEFFECT_SLAVE_UPRISING
    }

    UndergroundRailway {
    Chance 0.75
    DeathChance 0.5
    Sound SOUND_ID_UNDERGROUND_RAILWAY
    Effect SPECEFFECT_UNDERGROUND_RAILWAY
    }
    }

    ################################################## ##########


    It would be looking like this:

    ##_UNIT_0;UNIT_ABOLITIONIST;{;Description;DESCRIPT ION_UNIT_ABOLITIONIST;DefaultIcon;ICON_UNIT_ABOLIT IONIST;DefaultSprite;SPRITE_ABOLITIONIST;Category; ;UNIT_CATEGORY_SPECIAL;Attack;0;Defense;10;ZBRange Attack;0;Firepower;1;Armor;1;MaxHP;10;ShieldCost;5 40;PowerPoints;250;ShieldHunger;5;FoodHunger;0;Max MovePoints;300;VisionRange;1;EnableAdvance;ADVANCE _CLASSICAL_EDUCATION;ActiveDefenseRange;0;LossMove ToDmgNone;MaxFuel;0;IgnoreZOC;NoZoc;CanBeExpelled; CantCaptureCity;NoSlaves;IsSpecialForces;Civilian; SoundSelect1;SOUND_SELECT1_ABOLITIONIST;SoundSelec t2;SOUND_SELECT2_ABOLITIONIST;SoundMove;SOUND_MOVE _ABOLITIONIST;SoundAcknowledge;SOUND_ACKNOWLEDGE_A BOLITIONIST;SoundCantMove;SOUND_CANTMOVE_ABOLITION IST;SoundAttack;SOUND_ATTACK_ABOLITIONIST;SoundWor k;SOUND_WORK_ABOLITIONIST;SoundVictory;SOUND_VICTO RY_ABOLITIONIST;SoundDeath;SOUND_DEATH_ABOLITIONIS T;CanSee:;Standard;CanSee:;Stealth;MovementType:;L and;MovementType:;Mountain;Size:;Small;VisionClass :;Stealth;SlaveUprising;{;;;;Sound;SOUND_ID_SLAVE_ UPRISING;;;;Effect;SPECEFFECT_SLAVE_UPRISING;};Und ergroundRailway;{;;;;Chance;0.75;;;;DeathChance;0. 5;;;;Sound;SOUND_ID_UNDERGROUND_RAILWAY;;;;Effect; SPECEFFECT_UNDERGROUND_RAILWAY;};};;

    Actually a few commas missing, as I said still working on. And it doesn't appear correctly, everything shall be in one line , whatever....I hope you get my idea anyway.

    For purpose I didn't open a poll as I am not 100% sure, if it would take a lot of effort to change it, if it is possible and if we want to do it. As I said, I would do the excel-sheet. If for any reason CTP2 can not read such a long line, there would be another possibilty to translate all commas into 0d0a (CR/LF) sequence with either a hex-editor or an external program (would need to be writen in any language).

    Attahced is my pure excel-file so that people get a better idea. I will update it once I got further.
    Attached Files

  • #2
    I guess we could... but I don't think we should.

    My vote would be... no.

    Comment


    • #3
      Errrm... you call that modmakers friendly?

      Excel can work with the existing setup as well and there are programs like J Bytheway's CtPEd for those who want more advanced editing tools. For those of us who actually have and know how to use a decent text editor (i.e. NOT Notepad/Wordpad), the current setup works great. Your proposal makes text-file editing near impossible.
      Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

      Comment


      • #4
        I'd like to see it in a format that would allow for an easier mod editor, i guess excel would be one way.

        It should also allow for a lot of different abilities or requirements (like consume shield, food each turn, or resources) in anticipation of new features
        Formerly known as "E" on Apolyton

        See me at Civfanatics.com

        Comment


        • #5
          what about linux

          i don't play ctp2 on Linux but I would say at the moment most scenarios are probably compatible with Linux ( tell me if I am wrong) if we change it to this set up the linux moders will lose out
          "Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
          The BIG MC making ctp2 a much unsafer place.
          Visit the big mc’s website

          Comment


          • #6
            There's no such thing as a CtP2 port to Linux for CtP2. Some people are working on it but it doesn't exist yet. And no, for Linux it shouldn't make an awful lot of difference how the scenarios/mods are organised as far as I can see. But because the end-of-line characters are different in Linux, they'll will have annoying reduntant /r's at the end of every line. Shouldn't cause any problems, but in some text editors it looks ugly (but the better editors can even deal with all sorts of EOL formats -- I know mine can )
            Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

            Comment


            • #7
              Originally posted by Locutus
              Errrm... you call that modmakers friendly?

              Excel can work with the existing setup as well and there are programs like J Bytheway's CtPEd for those who want more advanced editing tools. For those of us who actually have and know how to use a decent text editor (i.e. NOT Notepad/Wordpad), the current setup works great. Your proposal makes text-file editing near impossible.
              CtPed, is it in the directory? I haven't seen it there.

              How do you want to have it working with the current setup? It ttok me quite some work (hex-editor) to get it into this format?

              BigMc,

              as I said, it shall be saved as a csv-file, means comma-delimited and IIRC also under Unix/Linux there are programs like excel which can read those files.

              Coming back to those text-editor guys:

              There wouldn't be really any need anymore, just use the master-sheet, change&save. Easy to go.

              Comment


              • #8
                Originally posted by Gilgamensch


                CtPed, is it in the directory? I haven't seen it there.
                Not sure, don't think so. But it's in the topped threads in the CtP Creation forum for sure. Here's the CtPEd thread: http://apolyton.net/forums/showthrea...threadid=50102

                How do you want to have it working with the current setup? It ttok me quite some work (hex-editor) to get it into this format?
                I never try to use Excel for stuff it wasn't meant to be used for, but I suggest you ask the guy who did the Excel sheet for CtP1.

                There wouldn't be really any need anymore, just use the master-sheet, change&save. Easy to go.
                Yes, there would be a need for something more for most people: about €200 to buy a stupid M$ product you'd probably never use for anything else.
                Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                Comment


                • #9
                  Thanks for the link

                  I'll have a look, if you remember who it was I would appreciate it

                  Yes, there would be a need for something more for most people: about €200 to buy a stupid M$ product you'd probably never use for anything else.
                  Most computers which you by nowadays (even for the last 2 years) are normally equiped with it and second as the file is saved as cvs you can use any similar program. IIRC even the (IIRC) free star-excel (or however it is called) can import from a csv-file. It would be just, that we would just need to change once, what you use afterwards, isn't really the question. Excel I suggested as I know it not to bad and it is fairly easy to use (if you know what you are doing )

                  Comment


                  • #10
                    Originally posted by Gilgamensch
                    I'll have a look, if you remember who it was I would appreciate it
                    I remember who it was just fine, it was Fin Fahey. But since I doubt you know him I figured I wouldn't mention him by name.

                    But I did you a favour and looked the file up: turns out it's Access, not Excel. Which makes sense, since Fin was a very intelligent guy, he's smart enough not to use a Spreadsheet program to manage a database. The file can be downloaded here: http://apolyton.net/dir/index.php?id...ts=4650&cat=36

                    Most computers which you by nowadays (even for the last 2 years) are normally equiped with it
                    No, they don't. Maybe if you buy a HP or Packard Bell PC, but how many people are that stupid? And even those people who do still pay the €200, they just don't realize that.

                    Excel I suggested as I know it not to bad and it is fairly easy to use (if you know what you are doing )
                    Excel works fairly well if you use it properly -- as a Spreadsheet. Why people always complain it's a crappy database manager is beyond me: it isn't a database manager at all, so you shouldn't use it as such.

                    Either way, I don't think we should shut those of us who don't know how to use Excel (or similar programs who can open the same file) out of modmaking. Which is probably about 70-80% of all PC users. A text file everyone can deal with.
                    Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                    Comment


                    • #11
                      Thanks for the link, just downloaded it and checked. Even into there you can import csv without problems.

                      But I am not talking about having an mdb-file, which we can't use at all for CTP2. I was talking about using excel (and similar programs) to create

                      CSV-files not an XLS file. Those files you can still edit via a text-editor or use Excel (and similar) to modify it easily.

                      And I am not talking about having excel as a database-manager, just a tool to make it easier to change.

                      SO Excel would just be a tool to create csv-files, if you still don't understand what csv stands for:

                      CSV, comma separated view, so a normal text-file.

                      The Excel would be for people, who have it and could use it to CREATE a csv-file. If you don't have excel, just import the CSV to any program which can handle csv and you can do whatever you want, just has to be saved again as CSV.

                      Comment


                      • #12
                        The MDB file links to the text files, it updates them as well, while leaving them in their original format (or at least that's my understanding, I have little experience with Access myself, not exactly my favourite database program).

                        I'm not opposed to having tools to help modding, aux contraire. But I *am* opposed to using a format for the text files that seriously hinders modding, as your proposal does.

                        If Excel doesn't have a decent import function that can handle EOLs, that's a deficiency of Excel, not CtP2 (but again, Excel was never intended as database program, so you can hardly hold that against the program). A deficiency which other programs (such as Access, to the best of my knowledge) don't have, so you could use one of those instead.

                        But if you want to use CSV to store CtP2 data, you could easily write a simple script that converts CSV files to and from CtP2 format. Doesn't Excel have (limited?) VBscript support? Never used it myself, but I think I read about that somewhere. Even a simple VB script should be able to handle such a conversion.

                        I know what a CSV file is but have you ever actually tried editing one with a text editor? CtP2's file format is by far superior for its purpose, much easier to read and edit without the aid of non-standard software. By using a CSV file, you pretty much force people to use a database-like program rather than a simple text editor. A lot of people wouldn't even know any such programs, let alone be happy to have to buy/download and learn to use one.

                        Adding extra tools for CtP2 modding is great, but the tools should be designed for CtP2, not the other way around.
                        Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                        Comment


                        • #13
                          yes locutus excel does have vba code. it would be posible to generate the code to change it but why bother the amount of code needed would never pay for the time you save
                          "Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
                          The BIG MC making ctp2 a much unsafer place.
                          Visit the big mc’s website

                          Comment


                          • #14
                            Well, I don't know how VB works in Excel but replacing a few comma's with EOLs and vice-versa and inserting a few braces shouldn't be that much work...
                            Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                            Comment


                            • #15
                              The file by Fin Fahey is only partially 'useful'. Some files are covered some others aren't.

                              And Access is even less known as Excel or similar.

                              But if you want to use CSV to store CtP2 data, you could easily write a simple script that converts CSV files to and from CtP2 format.

                              The reason why I suggested to move to csv is, that a lot of programs alow import/export of csv without any problem. CSV was/is a 'standard' transfer format, even for databases.

                              Even a simple VB script should be able to handle such a conversion.
                              Yes you can, but that would ultimitvly restrict it only to excel.

                              I don't know access to well, but there isn't any EOL into whatever translation.

                              When importing a csv-file (supposed all the commas are there), you can use any program and have a nice overview, like in a table. Same goes for modifying, just change it, save it as csv and all done.

                              CtP2's file format is by far superior for its purpose, much easier to read and edit without the aid of non-standard software
                              don't really agree, have you ever tried to find units with certain values/restrictions ? Like which units are ignoring ZOC? With csv and imported into excel, make a sort on this coloumn and off you go. You want to easily change 10 units to have ZOC, no problem. You want to know all flanking units? Again no problem. You want to see all sound-files.........whatever........

                              You want to quickly see, who can attack what?


                              It would be all in the same position, easy readable and changeable.

                              And about how to learn to use it:

                              I think everyone can learn in 2 minutes (even if via help) how to import/export a csv-file. So that sounds a bit off.

                              The buying 'reason':

                              CSV would not prevent people from being able to modify it with a text-editor. As you might have seen I left the descriptions in:

                              ;DefaultIcon;ICON_UNIT_ABOLIT
                              IONIST;DefaultSprite;SPRITE_ABOLITIONIST

                              So the only difference for using a text-editor, you would be reading horizontal instead of vertical ...yeah..great deal........

                              Comment

                              Working...
                              X