Announcement

Collapse
No announcement yet.

simple mod blog : adding a harvester unit (aka crawler in smac)

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

  • #16
    I'm wondering if there might be a better way to do it, both gameplay and from a technical perspective. Like when you start crawling, the crawler "deploys" into another unit type, which is imobile (this deploying could be done as an upgrade methinks). That new unit type would then have a couple of options:
    1) Set home city.
    2) Undeploy. (returns to mobile crawler)

    Now, the only custom information would be the deployed crawlers home city (lets call a deployed crawler an extractor). Each turn you'd iterate over every extractor and add the resources to the home city.

    If you want to be ultra sneaky you could force-name the crawler/extractor to the city it's crawling too, as a bonus the information is then readily available to the player and you wouldn't have to store ANY custom data at all!

    So this is how I think it could work:
    A new crawler is built. Player sends it to a tile.
    Player deploys crawler once it reaches tile, if there is already an extractor there, the deployment is cancelled.
    Dialog pops up asking which city you want to crawl to, the default (first position) is the nearest city.
    The crawler is renamed to that city.
    During the appropriate event, use the extractors names to locate the city and add the resources, at some point perform sanity check like player ownership.
    Edit the rename unit event function to prevent people renaming crawlers.

    Something to think about, anyway.

    Comment


    • #17
      is it possible to allow the harvester unit only to harvest titles which are not used by cities (and if a harvester is using a certain title cities are not allowed to use this titel)?

      Comment


      • #18
        Originally posted by Blake
        I'm wondering if there might be a better way to do it, both gameplay and from a technical perspective. Like when you start crawling, the crawler "deploys" into another unit type, which is imobile (this deploying could be done as an upgrade methinks). That new unit type would then have a couple of options:
        1) Set home city.
        2) Undeploy. (returns to mobile crawler)
        I don't think this would be easier to program. The problem is giving custom commands to units. In this case I would still need to catch the player commands to transfer a crawler to an extractor (deploy) and back (undeploy). This only changes the problem from catching "crawl food" / "crawl hammers" / "crawl gold" commands to catching "deploy" and "undeploy" commands. Once one of them works, it's pretty straightforward to do the others.

        Renaming the units might be a good idea to store the data in save games for now. Thanks.

        As far as the gameplay changes you propose, I'm develloping this mainly for c4:ac, so I'm trying to stay as close to smac crawlers as possible. Without the "home city" notion, there is no way to use crawlers to transfer resources from one city to another.
        no sig

        Comment


        • #19
          When you rename crawlers to a "home"city, in the gold version a check must be included for namechanges of cities. Imagine a player just for the heck renaming his cities while they depend on a bunch of crawlers, but suddenly those crawlers harvest for a non-existant city.
          He who knows others is wise.
          He who knows himself is enlightened.
          -- Lao Tsu

          SMAC(X) Marsscenario

          Comment


          • #20
            geomodder, I would rename them just before saving the game (in the onSaveGame event) and load the info again when loading the game. City names shouldn't change between these actions. In-game, I'll use the same method I do it now.
            no sig

            Comment


            • #21
              Good read... Keep it up ... "We're watching you!"
              Populus vult decipi, ergo decipiatur

              Comment


              • #22
                Just for future reference, you can use the angular brackets by using HTML entity codes. &lt; for < and &gt; for >

                Code:
                <this works>
                (\__/) 07/07/1937 - Never forget
                (='.'=) "Claims demand evidence; extraordinary claims demand extraordinary evidence." -- Carl Sagan
                (")_(") "Starting the fire from within."

                Comment


                • #23
                  edited.... maybe not... ;(

                  Comment


                  • #24
                    Just use "reply with quote" on my post
                    (\__/) 07/07/1937 - Never forget
                    (='.'=) "Claims demand evidence; extraordinary claims demand extraordinary evidence." -- Carl Sagan
                    (")_(") "Starting the fire from within."

                    Comment


                    • #25
                      I've stumbled upon this topic by coincidence, and this is what I have to say:

                      Keep up the good work !


                      EDIT: I've just thought of two ideas that might help you, PJayTycy, in the solution of your problems. I'm not really acquainted enough with Civ's Python API to determine whether they'll work, but I hope the following will help somewhat, at least.

                      OK, so the two possible solutions for implementing the crawler might be:
                      1. If the API allows for free manipulation of a city's worked tiles list, the harvester could deploy as follows:
                      a) plop down necessary terrain improvements. They would be three new terrain improvements needed, adding -6 to resources that are not harvested.
                      b) add the harvested square to the worked tiles list of the city.
                      THE PROBLEM: this seems as a bit of an ad hoc solution, so it might never work, or work after additional extensive modifications.

                      2. Use super-specialists to add the relevant resource for the city. This would have the advantage that the resource info for the harvesters would be visible in the city screen.
                      a) calculate the amount of resource generated.
                      b) spawn a corresponding super-specialist in the city.
                      THE PROBLEM: there would have to exist a specialist type for each kind and possible amount of resource. If dynamic specialist type creation is not allowed (and that's probably the case), the mod would have to contain some 18 pre-defined super-specialist types.
                      Last edited by LoD; January 13, 2006, 07:07.
                      I love the tick of the Geiger counter in the morning. It's the sound of... victory! :D
                      LoD - Owner/Webmaster of civ.org.pl
                      civ.org.pl's Discussion Forums and Multiplayer System for SMAC and Civs 2-4

                      Comment


                      • #26
                        Here are a few screenshots from the civilization 4 - alpha centauri forum about progress on this unit:

                        First, I had to add a "home city" concept, so I added it for ALL civ4 units.

                        The rehome command is available when a unit is in a different city.


                        Crawler units can be used to hurry production (but a lot less hammers than great people).


                        And finally, here, a screenshot that shows most of the features:
                        => Home city is listed in the unit info box
                        => Crawling amount is listed in the unit info box
                        So, here we see a city working city plot + 1 other plot, for a total of 1 hammer. One crawler is working a forested hill (outside culture borders) for +3 hammers. The correct info is shown for the unit (home city, +3 hammers) and the city (total turn production = +4 hammers).



                        I'll probably upload a polished version here today. Oh, the crawlers are enabled with iron working and cost 90 hammers.
                        no sig

                        Comment


                        • #27
                          Release Candidate 1 ready:

                          Fixes / Changes:
                          => Interface is updated immediately (ie: after rehoming a unit, the rehome command disapears immediately)
                          => Enable crawl-actions for a unit if he is the one currently crawling a tile.
                          => Changed all references to "crawl" to either "convoy" or "supply".
                          => Replaced the fixed "Home city:", "Independant" and "Crawling:" texts with TXT-tags to be loaded from xml.
                          => Solved save/load issues
                          => Rehoming only works in bases of your own team (previously it was possible to rehome in every city you could enter (ie: open borders)).

                          Left issues:
                          => Start crawling without moves left.
                          Currently I show the icon, but the action isn't started. There are 2 options:
                          a) Remove icons from the interface when no moves left.
                          b) Try to remember you ordered the crawl command the previous turn.

                          => Some text needs rewording and translation.



                          Screenshots:
                          xml-loaded texts for rehome command


                          xml-loaded texts for the convoy missions (notice this unit is currently convoying hammers and I moused-over the "convoy commerce" mission.


                          xml-loaded text and strategy when the "what to build next" popup appears.


                          I don't have a screenshot of the civilopedia, but it should be OK too.


                          Mod:

                          SDK Source:
                          no sig

                          Comment

                          Working...
                          X