Announcement

Collapse
No announcement yet.

Ctp2 class definitions needed!!!

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

  • Ctp2 class definitions needed!!!

    is there anyone out there who can give me a list of classes with their functions and variables used by the game? in order to write good scenarios you need to use SLIC which is just c++ and any moderate level programmer can use it- its just knowing the classes. in particular im looking for city_t class functions and unit_t class functions.

    also any info on how "mod_CanPlayerHaveAdvance()" works would be appreciated... does the program automatically check this function if you put anything in or do you have to make a call to this function somewhere else???

    hopefully a ctp2 programmer will find this post!

  • #2
    iozina,
    here are two reference sources i came across. locutus also has info on his site
    R.I.P. Locutus Home Page
    http://www.activision.com/games/civilization/slic.html
    apolyton.net/ctp/modification/

    it seems we are both a little late in the game regarding mods, etc.. by poking around the forums and looking at people's pages i am gathering some info to make a start at it. you wanna maybe try and work together and share info?


    ===============
    give me a second to get straightened out
    ================

    Comment


    • #3
      He, thanks for mentioning my site, phenyl I'm afraid I haven't updated the SLIC part in months though (it isn't called RIP for nothing ).

      However, I'm currently working on extensive documentation for SLIC2, which will (hopefully) make it understandable for everyone, even for people without programming experience. Also, after the patch is released, Activision has promised to give out documentation as well, which will no doubt prove invaluable.

      In the meantime, the documentation on SLIC1 is still very useful and also, if you have any questions, feel free to ask me: I've been working with SLIC2 for several months now (though it has undergone quite some changes in that time), so if I can't help you, most likely nobody can (well, except for the Activisioners of course)

      Though I have only very limited experiences with C++ myself (still using either regular C or Java (or VB)), I wouldn't say SLIC is just C++, but it does resemble it as far as syntax goes. I've found that saying that it's 'just C++' only deters people with little or no programming-experience from experimenting with SLIC, which is unjustified 'cause I believe anyone could learn it.
      One difference between C++ and SLIC is that SLIC doesn't have real classes. What you refer to as classes are in fact no more than structs: objects with several variables attached to them. They can't have their own functions or whatever. All functions in the game are 'regular' functions (the majority of which are documented in the SLIC documentation Mr Ogre wrote for CtPI).

      The mod_CanPlayerHaveAdvance() and similar functions are really one of the most exciting new features of SLIC2. It indeed works as you describe: they're checked automaticly, just use it the same way it's used in the Alexander scenario and it will give you unpresidented power over what people can and can't build or research.

      To get a full list of all functions, variables and events you should simply open up ctp2.exe in a hex-editor and perform a search on known functions and events (such as BeginTurn or mod_CanPlayerHaveAdvance). That should give you full lists of all these and even some, limited, info on some of them. Of course, I already did this and if you'd like I could post these lists tonight once I get home.
      [This message has been edited by Locutus (edited December 13, 2000).]
      Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

      Comment


      • #4
        phenyl,

        yes that would be cool... im still trying to get a feel for how exactly slic works and how it and the program relate. but id be glad to share knowledge- after all two minds work better then one right? hey email me maybe u have AIM or icq so we can talk in realtime!
        "lozina@cyburban.com"

        Locotus: im currently trying to implement my idea on giving certain units prerequisite buildings. (like in order to build a fighter that city must have an airport + factory etc... whatever is rational unilke the current tech tree!!!) It's a pretty simple thing to do using mod_CanCityBuildUnit if i can figure out how to activate it... i also have lots of other cool ideas for ctp2 i cant wait to learn all the triggers and handlers so i can start on a mod. the thing is- i made a necessary scenario substructure under the ctp2 directory and put in only one file in \default\gamedata as mymod.slc (i assume the game uses default txt files for all other data u do not include under scenario subdirectories) in this slic file is a simple bit of code i copied off the nuclear scenario:

        "int_f mod_CanCityBuildBuilding(city_t theCity, int_t theBuilding)
        {
        if (theBuilding == BuildingDB(IMPROVE_AIRPORT)) {
        return 0;
        } else {
        return 1;
        }
        }
        "

        i then copied one of my old savegames into the \scenarioname directory and saved it as savegame.c2g- and ran the scenario expecting that i cannot build airports anymore (just to test that mod_ function) but it dosent work. do i need to make include statements in some file or do i need to make another slic file with something like HandleEvent(Building Buiding) or whatever its called? thanks for any info i really appreciate it! feel free to mail me too instead of replying on this forum. ill load up the exe on my hex editor now and see if i can find all the names (thats a good idea!)

        Comment


        • #5
          lozina, SLIC is saved with the game, so you should start a new game to test your SLIC functions. If you load an old save it will not use the new SLIC functions you added. Other than that I'm not much of a LIC expert, so I can't tell if your function should work.

          Comment


          • #6
            paul i love you! stupid me i was wondering what that "reload slic" button was for in the editor window! yeah i started a new game and its ok- now i can move on! thanks for pointing that out buddy

            Comment


            • #7
              Okay, I uploaded a XLS file to my site with some stuff I put together in a hurry. It ain't much but it's a start. If someone doesn't have Excel or whatever, email me and I'll send you the same info in text files. Tomorrow or so (whenever I have time), I'll try to convert the thing to HTML format or something.

              Iozina,
              Paul caught one problem but another is that you should either rename your file scenario.slc or 'include' it in scenario.slc using the line '#include "mymod.slc"'. If you don't do this, SLIC won't be able to find the code.

              phenyl&iozina,
              If you guys start emailing with eachother, feel free include me as well in the CC field or whatever, so I can share my knowledge with you when needed.
              Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

              Comment


              • #8
                In case anyone is following this, here's how Lozina and I got it working eventually (for the fighter example):

                Code:
                int_f mod_CanCityBuildUnit(city_t theCity, int_t theUnit) {
                   if (theUnit == UnitDB(UNIT_FIGHTER)) {
                      if (CityHasBuilding(theCity, "IMPROVE_AIRPORT") && CityHasBuilding(theCity, "IMPROVE_FACTORY")) {
                         return 1;
                      } else {
                         return 0;
                      }
                   }
                   return 1;
                }
                Wes, something for the MedMod?
                Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                Comment


                • #9
                  But will the AI be smart enough to know it must build these first?

                  To me that seems the most difficult part of upgrading. People are smart enough to understand what needs to be done, but the AI doesnt and its not always easy it tell it what to do

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

                  Comment


                  • #10
                    yes thats the hard part ive been thinking about. There's the BuildListSequences file i can edit,and the buildlists themselves. i still need to study the ai's building system thoroughly... =\

                    Comment


                    • #11
                      Well, the AI doesn't have much of a choice. It simply must build factories and airports first before it can build fighters. If you feel the AI doesn't build these buildings soon enough, give them a higher priority in the buildlists or add the buildings to more buildlists or something like that. Shouldn't be too difficult.
                      Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                      Comment


                      • #12
                        Sorry, wrong thread...
                        [This message has been edited by Locutus (edited December 16, 2000).]
                        Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                        Comment

                        Working...
                        X