Announcement

Collapse
No announcement yet.

New SLIC functions from patch

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

  • New SLIC functions from patch

    Don Blevens (aka skorpion59) and I made an inventory of the changes that were made to SLIC in the patch and it turns out that 46 new functions were added, most of which are diplomacy-related. I updated the xls file on my website to reflect this. Here's a list of the new functions:

    ArmyIsValid
    CanFormAlliance
    CityHasWonder
    DestroyBuilding
    FindCityToExtortFrom
    GetAgreementDuration
    GetAtRiskCitiesValue
    GetBioWeaponsCount
    GetBorderIncursionBy
    GetCounterProposalResult
    GetCurrentPollutionLevel
    GetDesiredAdvanceFrom
    GetDesireWarWith
    GetEmbargo
    GetLastBorderIncursion
    GetLastCounterResponseArg
    GetLastCounterResponseType
    GetLastNewProposalArg
    GetLastNewProposalTone
    GetLastNewProposalType
    GetLastResponseType
    GetLastThreatResponseArg
    GetLastThreatResponseType
    GetMostAtRiskCity
    GetNanoWeaponsCount
    GetNewProposalPriority
    GetNewProposalResult
    GetNextAdvance
    GetNuclearWeaponsCount
    GetPersonalityType
    GetPiracyIncomeFrom
    GetPollutionLevelPromisedTo
    GetProjectedScience
    GetRelativeStrength
    GetRoundsToNextDisaster
    GetStopResearchingAdvance
    GetTotalValue
    OpenBuildQueue
    PersonalityDB
    PlayerHasWonder
    RoundGold
    RoundPercentReduction
    SetEmbargo
    SetStrategicState
    TileHasImprovement
    WonderOwner

    Now all that needs to be done is figure out how all these work
    Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

  • #2
    This list is cool. Just some speculation, by someone who couldn't program SLIC to get out of a paper bag:

    CityHasWonder, WonderOwner and PlayerHasWonder: there once was a thread where lots of people liked the idea of wonder limits. Each player can only build so many, and/or each city can only have so many. Now it looks like that is possible to implement.

    DestroyBuilding: This has lots of possiblities. For instance a wonder that destroys all of a certain type of building and replaces it with a more modern version.

    TileHasImprovement: This one is really key. One of the things I would most like to see in a mod is cutting down the PW cost of building a tile improvement if that tile has already been improved. For instance, if you're building an Advanced Farm where a Farm already is, it shouldn't cost as much as building something from scratch. But this couldn't be done with SLIC, I was told. Maybe now it can?

    It also looks like this means diplomacy is much better now.

    Still, the one great failing of SLIC seems to remain. That is, when I was making stuff for my Alexander scenario, one thing I was told wasn't possible was changing stats of a unit. For instance, change the hitpoint value of a unit when it moves into a certain terrain type if you want, say, travelling over Desert to weaken a unit. The only way to do this apparently was by deleting the unit and instantly rebuilding it, which of course loses the hitpoint status, veteran status, etc... I really hope they fix that.


    Comment


    • #3
      I suspect that theres always been a way to tell if a tile has an improvement. have you ever laid out a long railroad that overlaid some road? You'll notice that the overlaid tiles (same type as non overlaid) will be build much faster.

      Not that I have a clue how it was done tho.

      ------------------
      History is written by the victor.

      Comment


      • #4
        If all that stuff just worked...

        Locutus, did you take a look at the new script.slc file (patch 1.1)???

        It seems to have some very interesting alert boxes (border intrussion, attack-an-ally warnings, and more), but nothing works for me. OmniGod has the same problem. I assume it simply doesn't work (how surprising...).

        Do you know something about those "new" (not-working) features?

        C-ya
        Candor dat viribus alas.

        Comment


        • #5

          Locutus,

          Do you know why the command
          MovePathOrder(%a,%l) does not work?

          I can make the MoveToOrder(%a,%d) command work, but not the above. Also, are there any other commands to create appropriate paths (say between 2 locations)?

          What does the %i in your spreadsheet mean? What is the structure of the %p ?

          Comment


          • #6
            quote:

            Originally posted by Rebel Rick on 12-16-2000 05:56 PM
            If all that stuff just worked...

            Locutus, did you take a look at the new script.slc file (patch 1.1)???

            It seems to have some very interesting alert boxes (border intrussion, attack-an-ally warnings, and more), but nothing works for me. OmniGod has the same problem. I assume it simply doesn't work (how surprising...).

            Do you know something about those "new" (not-working) features?

            C-ya


            Don't know much about SLIC yet, but seeing this file mentioned got me interested enough to take a look at it.

            From what I can see, these are the message box definitions. That's only have the puzzle. Somewhere else there would need to be a trigger that sends off the message box.

            So maybe someone is halfway towards implementing some of these things. They may have created the message boxes, but are still working on getting them to fire off at the right times.

            I hope so, some of the ones like "You're attacking your ally." and "Hey, you just wandered into someone else's country." are very needed.

            marc

            Fear not the path of truth for the lack of others walking it.

            Comment


            • #7
              Harlan,
              Actually, wonder limits were already possible (in fact, I have some portions of code for it done already that I wrote before the patch came out), these new functions just streamline everything a bit. For me they're actually kind of a bad thing 'cause now I'll have to rewrite all my code to make it more efficient

              Destroy building should have been possible but in these forums Mr Ogre came to the conclusion that it wasn't after all and hence he fixed it. Very nice of him

              The TileHasImprovement is cool indeed, as well as the diplomacy stuff (I think the possibilities with the latter are endless: as far as I can see, anyone who wants to seriously improve diplomacy can't do without SLIC now).

              As far as the unit stats thing goes, I don't know what to think of that. There's a couple of mod_* functions in the game that appear to do exactly what you describe but since I too understood that it isn't possible I haven't messed with those yet. Maybe it was made possible after all but noone bothered to inform you (or anyone else) about it.
              But units don't have to loose hitpoint and veteran status, you can store those with SLIC, so you can fully mimick the change-status thing the way you mentioned (it's just not very efficient). Therefore, IMHO this is an important but certainly not vital issue.

              What *is* still missing and is vital IMHO is some functions to change the food/production output of a city and/or tile. This could be used for dozens of things. FE natural disasters, the presence of special units (e.g. leaders) that increase efficiency, give trade goods a food/production bonus, do the unit-repair thing from the MedMod properly (Wes originally wanted it to cost production instead of PW but this wasn't possible), etc. etc. Hopefully this will be addressed in a next patch.


              Alpha Wolf,
              Yes, it was probably always possible to check for this but not in SLIC and hence it was probably out of range for modmakers until now.


              Rebel Rick,
              I haven't had time to look into this yet but I'll have a look at it tomorrow or so (it's in the middel of the night here and I've been programming for 7 hours straight so I need some sleep first if you don't mind ).

              colorme,
              Hmmm, so far I only used the MoveUnits event to move around units so I wouldn't know actually. Since this is a part of SLIC that intruiges(sp?) me very much, I'll definitely have a look at this ASAP. There are a lot of unitmovement-related events in the game but I think the 2 you mentioned plus the MoveUnits event are the most important ones.

              The %i stands for Integer, which is simply a number. %p usually means Player, but I think it is also used for Path and maybe one or two other things here and there (too tired to look it up right now). You can usually treat the player variable as a number (i.e. store it in an int_t variable), though it is in fact a structure and can has variables attached to it (such as units, cities, capital, etc.), which you can also use in the appropriate circumstances. This can be rather confusing at times and I sometimes make mistakes with this myself.

              Going to get some sleep now
              Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

              Comment


              • #8
                About the changing of units, as I think about it more, it may not have been that it was impossible, but just that it would have been so resource intensive. You'd have to use coding that really slowed things down, so in my scenario they said no way, since its already running slow. Some things were like that, I can't totally remember. Wes keeps saying though that making a Seige Tower unit function is impossible. If what I'm saying is possible, that you could say, have a Seige Tower have an attack of 0, but if there's a check that the square its attacking is a town, the attack changes to 8 (or whatever).

                If that was doable, I wonder if one could also get the AI to use the unit correctly.

                People haven't done any SLIC coding along these lines yet, but I hope they will be possible and not too time consuming. In particular, Ignore City Walls and Ignore All Terrain movement are two flags from Civ2 that I think are sorely missed in the CTP series. CTP2 units can do just about everything else Civ2 units could do, plus so much more, except those two.

                Or maybe these are things we could pester Mr. Ogre to add .

                Locutus, do you think you could make a stab to see the tile improvement thing I described is possible now? That would be great.

                Comment


                • #9
                  What about the "Magnificent Samurai" scenario?
                  When you gained a level one of your stats would increase (+5 Attack, etc.) Couldn't this be modified to occur in different situations?

                  Has anyone dismantled the scenarios and found anything useful there? I mean the samurai scenario stands out in my mind because it plays quite differently than a normal civ game. Even more so than the Alexander scenario, although the latter it is more fun to actually play

                  Comment


                  • #10
                    I know nothing about SLIC (Awaiting some Documentation). But would it be possible to have building become obsolete. I have been toying with the idea for a little while, but waiting on some SLIC documentation. For example, a stockade that is replace by City Walls, that would be replaced by something else. I think it would be rediculous to have everything, but why not have one replace the other, or better yet, be upgraded by it (that is if it already exists, the cost would be less). Not have the stockade as a prerequisite though, that would be too much a pain in the arse. Well, give me you thoughts. Thanks.

                    ------------------
                    Yours in gaming,
                    ~Elucidus
                    Yours in gaming,
                    ~Luc

                    Comment


                    • #11
                      Locke,
                      The same thing happens in the Alexander scenario to Alexander- his stats change over time. But what really happens is that he is killed and instantly replaced by a unit with slightly different stats- I assume the same thing happens in the Samurai scenario.

                      Comment


                      • #12
                        Rebel Rick/Omni/Marc420,

                        I don't know where you guys got the idea that all those messages are new with patch 1.1, they were all in the 1.0 version of CtPII as well. In fact, a lot of those were already present in CtPI: I noticed that there were a lot of Gene Splicer and and other CtPI-specific messages in there.

                        Most of these messages don't do anything (anymore), they're simply remnants of previous versions of CtPI or CtPII (alphas, beta, release versions). Activision once intended to include them but at some point, for what reason so ever (other, non-SLIC solution took it's place, no more time, no longer desirable, etc.), decided to throw them out again. I don't think Activision has the intention to include them in the future, they're just too lazy or busy to delete them.

                        Contrary to what one might expect (and what marc420 said), they don't need functions in SLIC that call them, but they are called from the game-engine itself. I know this because I found the names of these messages in the ctp2.exe (and ctp.exe) files. So they're pretty much useless. It's still possible to get a warning when you're about to cross a border or when someone else crosses your border or when you're about to attack an ally or whatever, but to do that you'd have to write accompanying SLIC eventhandlers first.

                        Harlan,
                        The only reason why Wes could think a Seige Tower is impossible is because the AI won't know how to use it, SLIC can handle it just fine.

                        The Ignore All Terrain Movement should be fairly easy to implement in SLIC. The Ignore City Walls can probably somehow be mimicked, but I wouldn't dare to say for sure before seeing the documentation.

                        Yes, the Tile Improvement thing you described is possible, as far as I can see.

                        Locke,
                        Harlan is right, that's exactly the same as what happens in the Alexander scenario.

                        Almost all the interesting things in the scenarios are SLIC code, so if people want to do similar (or even cooler) things in their own scenarios, they'll have to learn SLIC

                        Elucidus,
                        With the new DestroyBuilding function what you describe will indeed be possible.
                        Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                        Comment


                        • #13
                          About the Seige Tower thing. The way I describe it, it doesn't really matter if the AI knows how to use it or not, right? Lets say the attack is ranged and its a ranged unit. If the unit engages in a battle outside cities, it does nothing cos its range attack is 0 (or 1, if necessary for the AI to do a ranged attack at all). If its in a stack, its in the back row doing nothing, so chances are it survives if the rest of the stack does well. But if its part of an attack on a city, suddenly it has a strong range attack. Furthermore, one would have to program the AI to group its units in stacks more so one doesn't get a lone Seige Tower wandering around, but that's a good thing to do in general. Is urge to stack vs. lone wandering unit controllable, and if so, by unit type or by civ?

                          The AI behavior might not be perfect in the above example, but it would be smarter than the way the AI handles other units, like Carriers.

                          Comment


                          • #14

                            Locutus,

                            Thanks for info. I was actually trying to write some SLIC code to do the following:

                            1. attack.slc: Get the goddamn AI to collect a big army and move
                            it towards a city of mine. I believe that once the AI army is close enough to a prime target, it has enough intelligence to attack it. So, this may be one way to create bigger attacks.

                            2. transport.slc: Get the AI to protect its transport ships with military vessels, and then to transport larger armies across water, by moving an armada of transports, rather than the single transport that it usually uses.

                            3. carrier.slc: Put planes inside its aircraft carriers.

                            Once the unit-pathing is figured out, these three should be fairly easy to program.

                            Don't know how to make the AI understand the concept of air-fuel though ... HOW COULD ACTIVISION HAVE SCREWED UP SOMETHING AS SIMPLE AS THIS?? I mean it is not that the AI has to do very complex calculations to
                            figure out whether an aircraft has enough fuel to get back to its base!!!

                            BTW, to prevent the AI from interfering with the SLIC commands you program for its unit, would you use
                            the

                            MoveUnits pre{
                            ....
                            STOP
                            }

                            event-handler combination?

                            Comment


                            • #15
                              Harlan,
                              I'm not much of an AI expert, so I wouldn't really know how well the AI would be able to deal with a Seige Tower unit, I guess one would have to try to figure it out. Stacking is more something to accomplish through the AI files than through SLIC, if that's what you're implying: the code to stack units is present, but to do it in an intelligent way requires a lot of (complicated) code: you'd have to keep track of dozens (or even hundreds) of parameters (that's why they invented AI in the first place ).

                              colorme,
                              That's a very ambitious project but I fear that what you want could well be way over your head: what you're trying to do is basicly letting SLIC take over large parts of the AI. This means rewriting the AI completely in SLIC but this is a mayor task that, if it's possible at all, will take months or even years to complete and slow the game to a crawl, even on a PIII 1GHz or faster.

                              One example: if you have one transport and one battleship, how do you know for sure that it is a good idea to use that battleship to escort the transport? Maybe that battleship is on course to bombard an enemy city or maybe it's used to patrol the coastline to prevent enemies from bombarding his cities. Other than in specific situations, it's very difficult to determine whether or not something is a good move or not. You'd basicly have to analyse the entire strategic situation on the map, but that's a very recourse-intensive thing to do.

                              Another example: you can put planes inside aircraft carriers but when should these planes stay inside and when are they allowed to fly around? It won't be easy to detect when they are needed in the field and when not (and they only run the risk of not returning to the ship timely or returning to another city or airbase instead of the ship), the probably AI does a much better job at this then SLIC will ever do. The best way to do solve this particular problem might be to just have the AI build more aircraft (haven't played very often in the modern age yet, but it seems to me that the AI doesn't build an awful lot of aircraft anyway, and putting planes in carriers that don't exist is rather difficult ).

                              IMHO, you're much better off trying to improve the AI behaviour through the AI files and other 'conventional' means than through SLIC. Only after those methods have been exausted, should one use SLIC to make (further) improvements.

                              That said, I'm fairly certain that someone with extensive knowlegde of both the AI and SLIC could use SLIC to improve the AI. I don't want to discourage you too much, since I *do* think that you could make some improvements but you shouldn't think too lightly of this. I for one wouldn't know where to start when it comes to implementing the ideas you propose.

                              My suggestion would be to start by studying the AI files and trying to tweak those and once you've concluded that the AI will never learn certain, fairly simple, things, try to write some replacing SLIC code for those. Only if you get these small things to work properly, you might want to try something bigger.

                              Oh, and yes, the MoveUnits event can be used to stop human or AI players from moving units, that works just fine. I used exactly that code to prevent militia units from moving in the MedMod and had no problems with it (so far ). Of course, if you want the AI to not fortify or pillage or do anything else while your SLIC code controls some units, you'll need similar eventhandlers for pillaging, fortifying, etc as well.
                              Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                              Comment

                              Working...
                              X