Announcement

Collapse
No announcement yet.

CSPL: Towards a new Macro-Language?

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

  • CSPL: Towards a new Macro-Language?

    Hello all,
    It seems to me that a lot of people finds CSPL really interesting but "a bit difficult" to learn.
    I'm wondering if a possible solution could be to create a Macro-Language from CSPL, i mean, imagine a normal CSPL program which instead of following a pre-coded sequence of orders, reads instructions (with a syntax similar to standard events.txt) from a text file (maybe CSPL.txt?) and executes them.
    This seems a good idea to me because, in that way, serious scenario designer may still use CSPL in the hard way to obtain new events while others may access a limited-version of CSPL without having to learn a row of C++.
    I don't have a lot of free time right now (even if, i could use time i planned to spend watching World Cup matches...you know, if one wants to watch a pre-written story usually goes to the cinema... soccer is another thing, oops, sorry 'was' another thing ...) and i'm not a scenario designer so i had no idea about which events to insert into this macro language and about the syntax it will use.

    So what about discussing here which events you consider interesting and also about the macro language syntax?
    When i'll have more time, i'll take your conclusions and i'll start to implement the macro engine in CSPL (again, this probably will not be very soon, so take it easy), or maybe some other CSPL programmer will start to implement it, anyway, i think it's imperative to start defining the events you would like to have in the new language.

    Greetings,
    Angelo
    Korea Republic-Italy
    18 June, 20:30
    Daejeon, Korea

    Man of the Match: MORENO Byron

    "Siamo al mondiale: i guardalinee bisogna prenderli dalla serie A, non dall'interregionale... "
    --- Bobo Vieri
    "If it works, it's obsolete."
    -- Marshall McLuhan

  • #2
    It'd be nice to see a macro language for those who don't know C/C++. After taking a semester of C++, It's not too difficult for me to whip up an awesome event with the CSPL library.

    If you were to add just to the library, I'd like to see an interface with technologies. That way I could add and take technologies which would also allow me to set and unset flags inside the events.txt itself. This would make it so the program could interact with the events file in a round-about way.

    As for just a macro language, I'm sure there's a number of pre-designed events that people would like to see. Since I can use the library and C++ I don't have any complaints so I can't think of any macro design right now

    Comment


    • #3
      1. An event where two units can't kill one another

      2. A CITYBUILT type of trigger:
      @IF
      CITYBUILT
      cityname=whatever
      owner=whoever
      @THEN
      whatever

      3. A trigger that performs an action when a trade route is established between some city and another
      "The self is a relation that relates itself to itself, or is the relation's relating itself to itself in the relation; the self is not the relation but is the relation relating itself to itself." -Kierkegaard, at one of his less lucid moments

      Tremolando shows rage! Sforzando shows excitement! C Minor means gravity!–D Minor means terror!...Round and round like donkeys at a grindstone! -Amadeus

      Comment


      • #4
        Wish list

        Angelo, C++-challenged ToT designers everywhere celebrate 'We love the new possiblities day'. My own wish list is:

        1) Most of the examples in the documentation. (Darth did you ever try to compile the artillery example?). Leave out the Geobuilder until there is popular demand.

        2) An Attrition action, like the one you emailed. Units ending their turn in a particular type of terrain lose strength. Arguments could include unit type, terrain type, health lost. For a kicker, allow the designer to set a negative health lost.

        3) A KillUnit or HurtUnit action. Arguments could include unit type, xyz coordinates (in a rectangle), health lost.

        4) Something like the ChangeTerrain action, but changing only the passable/impassable toggle of a terrain. Arguments: terrain type, impassable or passable.

        5) Oobir's CityBuilt trigger is a good one. Arguments could also include a map rectangle and the unit type that builds.

        When can I beta test? Seriously though, how much free time do you have for this project? That would define the length of our wish list.
        El Aurens v2 Beta!

        Comment


        • #5
          Some ideas . . .

          But I must say that I'm still a little sketchy on what the capabilities will be. Are you just talking about new events triggers and effects? If so, then I have some ideas.

          1.) I'd like an event that transferred ownership of a city from one civ to a specified other civ.

          2.) I'd like to also see a destroy-a-city event too.

          3.) It would also be convenient to have an event that performed the same function as the global warming--changing terrain.

          4.) I'd really like to see an event that created more than one unit. Like an event that created a dozen or even more units.

          5.) It would be nice to have an event that destroyed/eliminated a certain, specified unit type, all over the map.

          6.) It would be a LOT of fun to have an event that caused a civil war, especially so that it could be precisely scheduled. I'm referring to a civilization split that occurs when an AI capital falls to attack and there are only 6 civs in the game. Might as well add that I'd like to be able to then specify the resultant civ names and colors too.

          I'll think of more directly, but these are the ones that came right off the top of my head.
          Lost in America.
          "a freaking mastermind." --Stefu
          "or a very good liar." --Stefu
          "Jesus" avatars created by Mercator and Laszlo.

          Comment


          • #6
            Great news, Angelo! My list:

            1. unit killed or bribed > new unit(s) of another type created in the same square or nearby

            2. attrition (Boco's idea)

            3. units not always killed as a result of combat

            4. supply lines to avoid attrition

            5. transfer of city ownership (Exile's idea)

            6. Leonardo's Workshop effects for more than one civ

            Exile, Test of Time already has multi-unit creation event: up to 255 units in up to 10 locations in ONE event.
            Tecumseh's Village, Home of Fine Civilization Scenarios

            www.tecumseh.150m.com

            Comment


            • #7
              Originally posted by techumseh
              3. units not always killed as a result of combat
              This is one that I meant to put in my above list. This one is important!
              "The self is a relation that relates itself to itself, or is the relation's relating itself to itself in the relation; the self is not the relation but is the relation relating itself to itself." -Kierkegaard, at one of his less lucid moments

              Tremolando shows rage! Sforzando shows excitement! C Minor means gravity!–D Minor means terror!...Round and round like donkeys at a grindstone! -Amadeus

              Comment


              • #8
                Originally posted by techumseh
                3. units not always killed as a result of combat
                Yeah, that's got my vote as well. But what arguments? Could start with UnitKilled parameters. I like tying it in with Techumseh's #1 (create another unit - same or different type - created in the same square or adjacent square). Then allow some control over the health of the new unit.

                As far as resupply, I'd be happy with either supply units, a resupplyling 'terrain' (even airbases or fortresses), or a supply line (x squares to a city). That last one could be tough to program.

                This is going to be one active thread, Angelo!
                El Aurens v2 Beta!

                Comment


                • #9
                  While I won't ever be able to use this program (I'm on a mac) here are some suggestions anyway:
                  • A way to make sure that ships cannot repair themselves above the first "yellow" while at sea, for this they will have to be in ports.
                    For 100% repairment they must be in cities with port facilities.
                  • A way to make unit support cost money?
                    As well as a way to make disbanding units cost money (or whatever other trigger you want).

                    These things would be great for a 17th century scenario (well the ship thing would be great for all kinds of scenarios since it's simply more realistic).
                  • A way to make peace between civs via events (I'm not sure but I think this can be done in ToT allready).
                  • A way to use the "copy another kings tech" via events.
                  • Would it be possible to bring up an event with a yes and no button (or even more buttons)?
                    With different things as result.

                    For example "Nation A has just been invaded by nation B, do you wish to support nation A, B or stay neutral."
                    (there will be lots of way more advanced ways of using this for sure).
                  • A way to determine the comodity of newly created caravans.
                  • A way to make units cost food and population witout being settlers.
                  • An "Anycity" or "Anyunit" for the unit killed/city taken triggers.
                  • A way to make the AI build certain things in it's cities (you would define the cities (either as one, or several, ie: City=London, Newcastle, Birmingham) in question or use "anycity")

                    Now I don't have the slightest idea of what this program is capable of, but those are some nice things I would want to be able to do with civ.
                  No Fighting here, this is the war room!

                  Comment


                  • #10
                    Darth, you're right, i've to update the library too (i've a list of new features i would like to add apart from yours), but maybe implementing this macro engine is the way to test the library i was searching for.

                    Coming back to the engine discussion, it seems to me that there's a lot of work to do...
                    Some of events you described are very easy to implement, some others are difficult (without updating a bit the library), while others are (up to now) impossible to obtain even with CSPL.
                    The events i think will be (nearly) impossible to implement actually are:
                    - Changing Passable/impassable toggle (Boco) : Since i don't know where this info is stored this one is impossible, maybe in a future library update i'll add this one but with the current library it's not feasible.
                    -Global Warming-on-demand (Exile): I mean, it's very easy to trigger a standard global warming, but if you mean something similar to a whole-map version of change terrain i think it's difficult if not impossible to implement it: what parameters you think are necessary, and which syntax? (i don't know, a list of = which means that TerrainType1 tiles will be transformed into TerrainType2 tiles? or what else?)
                    - Civil War (Exile): Again, here the problem are the parameters: how can one chose which cities became of a civ and which stays with the old owner? With CSPL is feasible (and easy) to create a similar event but we must think a way to discriminate if a City stays with the old civ or not.
                    - unit bribed -> new units (Techumseh): Actually CSPL cannot detect the bribing of a unit (while the unit killed->new unit event is ok)
                    - units not always killed after a combat (Techumseh): The problem here is that CSPL cannot override standard Tot combat routines, this means that we may be able to bring back to life a unit after a battle if we want, but this probably is not the way you intended.
                    - Leonardo Workshop's for more civs (Techumseh): This is feasible but i can't imagine its syntax, it's an event which enable Leonardo effect for a particular civ? and exactly how works Leonardo Workshop? (i mean, mechanically how can CSPL detect units types to upgrade? shall it check into Rules.txt?)
                    - Disbanding units cost money (Henrik): CSPL is not able to detect the disbanding of a unit
                    - Event with Yes/No button: It exists in CSPL so it's not difficult to insert it in the engine, but for multiple (>2) selections, well this is unfeasible with current library (even if this is one of the top-most in my CSPL-TO-DO list) so i don't think i'll put it into (it's feasible but hard to code, better wait to insert it into the library and then upgrade the engine)
                    - Units costing foods and populations (not settlers) (Henrik): Yes, this is feasible but you've to be careful because CSPL will subtract food at the end of each turn while Tot will not show you that the unit is costing you food (so you may see your food decrease turn after turn even if your city screen shows that you have a +5 surplus)
                    - Forcing AI Building list (Henrik): I've no idea, it depends how AI reacts to CSPL changing its orders, maybe it get stuck with new building orders or not, anyway, i need to test it

                    Are you sure you can't think a way to turn around limitations i described?

                    As for timing, the situation is the following: i need to pass 2 exams during this summer, if i succeed in passing them before August (but it's very unlikely, they're big and difficult), i'll have all the free time i need to complete the engine, but in case i pass just one of them (more realistic), i don't think i'll find the time to work on the engine, maybe i'll start it, and insert in it easier events, but nothing more than that.

                    Greetings,
                    Angelo
                    Korea Republic-Italy
                    18 June, 20:30
                    Daejeon, Korea

                    Man of the Match: MORENO Byron

                    "Siamo al mondiale: i guardalinee bisogna prenderli dalla serie A, non dall'interregionale... "
                    --- Bobo Vieri
                    "If it works, it's obsolete."
                    -- Marshall McLuhan

                    Comment


                    • #11
                      Not sure just how on-topic this is, but . . .

                      Responding to Techumseh's idea about killed units generating, via an event, another unit nearby; I had thought of something like this for WWII era scenarios. The idea was to create battlegroups, the remnants of units destroyed in combat. It was often the practice to take cadres of dissipated units and construct entirely new organizations around these remnants. This could be done pretty easily with an event that created battlegroups. The bg unit would have a high shield cost, but could not be produced, and would have a 0 attack factor. It's only use would be to disband in a city, thereby assisting the creation of a new unit.

                      Ok, now back to topic.

                      Angelo, for both the Civil War and Global Warming events, I'd be happy with the random results that are already part of the game engine. Changing these would be a task easily set aside for some later date.
                      Lost in America.
                      "a freaking mastermind." --Stefu
                      "or a very good liar." --Stefu
                      "Jesus" avatars created by Mercator and Laszlo.

                      Comment


                      • #12
                        This is feasible but i can't imagine its syntax, it's an event which enable Leonardo effect for a particular civ? and exactly how works Leonardo Workshop? (i mean, mechanically how can CSPL detect units types to upgrade? shall it check into Rules.txt?)

                        @IF
                        techgiven=x
                        @THEN
                        upgrade
                        who=musketeers
                        whom=riflepersons
                        whose=ku****e
                        @ENDIF

                        I haven't coded these things manually in ages, so my naming conventions are probable a little off.
                        Blog | Civ2 Scenario League | leo.petr at gmail.com

                        Comment


                        • #13
                          How about the following types of triggers:

                          2 additional optional parameters for the UNITKILLED trigger (much like Boco suggested)

                          @IF
                          UNITKILLED
                          unit= name of defending unit
                          attacker= attacking civilization name
                          defender= defending civilization name
                          attackerunit= [name of attacking unit]
                          maprect= [x1,y1,x2,y2,x3,y3,x4,y4]
                          @THEN


                          Moving specific units into a specific location trigger

                          @IF
                          UNITLOCATION
                          unit= name of unit
                          owner= civilization name
                          maprect= x1,y1,x2,y2,x3,y3,x4,y4
                          @THEN

                          Both will need to work with the JustOnce modifier.
                          Catfish's Cave - Resources for Civ2: Test of Time | Test of Time FAQ | War of the Ring scenario

                          Comment


                          • #14
                            A souped-up CreateUnit action

                            Techumseh et al., you can make some comment about my grasp of the obvious, but your wish for "units not always killed after a combat" can be accomplished with an enhanced CreateUnit action. The trigger could either a UnitKilled (hopefully enhanced as suggested by Catfish) or a CityTaken event. The keys to enhancement are:

                            1) positioning the new unit in a square defined relative to the trigger, not in absolute map coordinates. This could allow a new unit to be created in or close to the eliminated unit's square. If the unit type is the same, it appears as though the original unit was never eliminated, merely weakened and/or retreated. CSPL would have to check whether the square is occupied by another civ, though.

                            2) allowing the Health of the new unit to be adjustable.

                            In addition, if the original "Unit=" and "Owner=" arguments are retained, you'd have the ability to create, say, 'Kampfgruppe', 'Partisans', or 'Deserters' units. Though some of these ideas are already available via the partisan rule or Leo, doing it via CSPL allows much more flexibility.

                            Angelo, would such an action occur immediately after the trigger? If a defending unit is killed, could the new unit be created before the attacking civ moves other units?
                            El Aurens v2 Beta!

                            Comment


                            • #15
                              Actually, Angelo did make this work for me some time ago, when I was experimenting with concepts Mike Dauman thought of respecting food requistions in the Russian Civil War. The idea was that if you bribed a peasant unit, you got a food caravan, and if you killed it, you got hostile partisans in adjacent squares.

                              The main use of units not always killed after combat might be for bombardment type units such as artillery, ships and aircraft. If they miss or otherwise fail to destroy the target, there shouldn't necessarily be any adverse effect on them. I think the easiest way to do this is to recreate certain types of destroyed attacking units in the same location, but with some damage, and with that turns' movement used up.
                              Tecumseh's Village, Home of Fine Civilization Scenarios

                              www.tecumseh.150m.com

                              Comment

                              Working...
                              X