1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

SDK changes

Discussion in 'Civ4Col - Wild West Mod' started by Kailric, Aug 23, 2009.

  1. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,095
    Location:
    Marooned, Y'isrumgone
    Here are the lastest changes to the SDK and XML:
    DOWNLOAD

    -Added route "trails"
    -Added "route to" commands for trail, road, and railroad
    -Added Take Train command. If two or more cities are connected by railroad and have a train station the unit can select the city to move to. You can also move Cargo this way and it will be auto unload being added to the arriving towns warehouse. Only one unit can be transported this way per town.
    -Added the railstation art and adjusted the City Management screen to show the train station. Needs better art though in City Management


    Just make sure everything works right and I encluded all the files.






    First post:
     
  2. TC01

    TC01 Deity

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Units that can be purchased is all handled via XML.

    I'll remove the ability to purchase naval units and add the ability to purchase land transport units, while making sure to make the cheapest land unit the Wagon Train.
     
  3. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,095
    Location:
    Marooned, Y'isrumgone
    K, it didn't take long. The ole prez will give you a Wagon Train now instead of a ship. I had to make the Wagon Train cost something in Europe though or you get a CTD. Also the locomotive only moves on rail roads now. The directions are messed up though. It always faces opposite the direction it is going so it moves backward?

    To set a unit as a "locomotive" and only run on rail roads you just make sure it has cargo space, DOMAIN_LAND, and bMechanized is true. If bMechanized is set to false it will be the same as a Wagon Train and can move any where.

    I also set the "Value" of the railroad in CIV4RouteInfos to 2. For locomotives the code checks the value of a route, if its greater than 1 then it knows its a railroad.

    All I need is a working version of the Homecities on the map to finish up this part...

    Here is a question, should routes have a build hierarchy? Say you have to build roads first then railroad, like in CIV4? If so those changes may have to be made in SDK as well.
     
  4. TC01

    TC01 Deity

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Working on this. I made the switch to starting with a Wagon Train instead of a Caravel, but now I'm making sure that all of your starting units appear in your home city. Koma had it coded it so it just dropped your first starting unit in the home city (since the Caravel had the other two loaded into it) but now I need to do that for all three units.

    Then I need to place Mexican civs in the Desert region of the map and American civs in the Mississippi river area.

    Probably a good idea. It provides a better way to restrict Railroads then, say, making the build command take tools out of a city as you suggested.

    If you use the "Value" tag, you could make routes with a value of 2 require a route of value 1 on the plot to be built.
     
  5. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,095
    Location:
    Marooned, Y'isrumgone
    K, That will be easy to add in. We need a "Build RailRoad" button too, I can fix this up. Also, I'll make the button greyed out if there isn't a road present already, much like found city is when you are too close to another city.
     
  6. TC01

    TC01 Deity

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    For the record, we have a button. I stole it from Civ 4 and added it in one of the three patches for v0.2.

    But yeah, graying it out if you aren't on a road would be good.
     
  7. TC01

    TC01 Deity

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Okay. In order to get HCOM working on WH, you need to do this:

    -Unzip HCOM to a temporary directory.

    -Copy over/merge the DLL.

    -Copy over the art.

    -Copy over every XML file except: CIV4CivilizationInfos.xml and CIV4GameText_Colonization_Objects.xml (Westward Ho uses both of these files)

    -Copy over every PY file except: CvEventManager.py

    -"Copy CvUtil.py and sdToolKit.py from MN into Assets/python" (sdToolKit goes into Assets/Python/Screens)

    -Copy the zipped CvEventManager.py into Assets/Python at the bottom of the post.

    -In CIV4CivilizationInfos.xml, replace the Caravel as a starting unit for colonial civs with the Wagon Train, and set <bWaterStart> to 0. (You can also allow the Wagon Train to carry all Land units in CIV4UnitInfos.xml).

    This should let it work on the WildWest script.
     
  8. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,095
    Location:
    Marooned, Y'isrumgone
    K, here is my frist upload. I made a few more changes than mentioned based on what was need as explained below.

    Changes that need to be tested are:

    -Locomotives should only move on railroads and cities
    -Land units can load into Wagons from anywhere, was only in Cities
    -Build Railroad only appears if there is a road present
    -President wont ask you if you are sure about founding a city inland
    -President wont send help unless you lose your last Wagon Train and can't afford a new one. Then he sends a new one.
    -Wagon Trains and Locomotives can "sail to Europe"
    -Pioneers will unload from a Wagon before trying to build. So if you move the wagon they want go with it :p

    XML changes:
    -CIV4Civilizations: changed so that Civs wont start on water and start with a wagon
    -CIV4RouteInfos: set Railroad value to 2
    -CIV4GlobalDefines: added a define int "ROUTE_RAILROAD_VALUE" for railroads. This number should always be the "Value" of the railroad set in CIV4RouteInfos
    -CIV4Unit: only edited Wagons to carry land units. And set Locomotives as a Mechanized unit

    I found one error while building railroads in the attached picture. The red blob should be a railroad but its not. Something to do with the direction of other railroads around that plot, you can see which plots have raid roads in the pic.

    Lots of the graphics need to be adjusted of course and the changes that koma mentioned need to be addressed as well.

    There will probably be lots of SDK stuff that needs to be adjusted like the ones I mentioned above as well. Just let me know the things you come across. I put this together rather fast so lookout for CTD as well :crazyeye:
     

    Attached Files:

  9. TC01

    TC01 Deity

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Well, I know that the Colonization road has nearly double the amount of route models then the Civ 4 one (and the Civ 4 railroad). This probably has something to do with the problem.

    Check. It works, and they can't enter native cities either. Thanks.

    Check.

    Check. And I completely forgot that Colonization build buttons and Civ 4 build buttons are completely different, when I tried to use the Civ 4 button. Could you please "clone" that button into a Col-ish circle and shape? It's in "Art\Interface\Buttons\Builds\buildrailroad.dds" of WestwardHo.

    Check.

    Check. However, when returning from Europe, if you exited from a city, you get the "Do you want to trade with this city?" Blocking that message on return from Europe (can I do it via python?) would be good.

    Check.

    Everything appears to work based on brief playtesting. I did have another idea, though. I don't know how much work this would be to implement, but Beyond the Sword has a "NewConceptInfos" XML file. Colonization doesn't. I was thinking that a "Westward Ho Concepts" pedia page might be helpful.

    I'm not suggesting creating a new file, but it might be a lot easier to make a tag (or GlobalDefine of some sort?) "<bNewConcept>" in CIV4BasicInfos.xml. Then in the python screen for this pedia page I can get anything with a NewConcept and put it in the new concept article.

    Is this doable?
     
  10. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,095
    Location:
    Marooned, Y'isrumgone
    K, I'll work up a button, actually I done that already but wasn't quite happy with it. I am not sure what causes the Trade with City to pop up, if its SDK that will be easy to fix though. I didn't actually put code in for not entering a Native Village... at the moment it just checks for a "FriendlyCity" so maybe the friendly city code checks for natives. I use existing code when ever possible but it don't always do what you want it to. So I'll recheck the code to make sure its doing what we want there.

    I haven't ever added a seperate Pedia page yet but its definately doable of course, just learning how. But in my Privateers mod I added new concepts to the existing concepts page and its really simple. You can use that mod for an example on that.

    I'll make another upload tomorrow after work. If there is anything pretty simple that can be fixed let me know and maybe I can get it in.
     
  11. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,095
    Location:
    Marooned, Y'isrumgone
    Here are a couple buttons for Railroading. I looked into the code about the "Do you want to trade with this city?" and the code for makeing the popup work is there but not the code for making it appear...

    I just found the below code in CvAdvisorUtils.py.
    I guess it just needs a check for isEurope() don't popup.

    Code:
    if (player.shouldDisplayFeatPopup(FeatTypes.FEAT_TALK_NATIVES)):
    		if (pUnit.canSpeakWithChief(pUnit.plot()) or pUnit.canLearn() or pUnit.canTradeYield(pUnit.plot()) or pUnit.canEstablishMission()):
    			if pUnit.getID() not in g_listUnitNags:
    				popupInfo = CyPopupInfo()
    				popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TALK_NATIVES)
    				popupInfo.setData1(pUnit.getID())
    				popupInfo.addPopup(pUnit.getOwner())
    				g_listUnitNags.append(pUnit.getID())
     

    Attached Files:

  12. TC01

    TC01 Deity

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    I went with the high_res button, but I liked both of them.

    Adding a "if not (pUnit.plot()).isEurope():" check to that code worked fine.

    I could of course just add things to the main concepts page, but I felt that since at this point I don't actually know how much new stuff this mod will have (it already replaces the focus on water and ships with the focus on your home city, railroads, and land) it would be a lot easier to get people to notice the information in a new page.

    It doesn't look like there are any other issues, from my testing.
     
  13. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,095
    Location:
    Marooned, Y'isrumgone
    Oh yeah, I forgot to mention that one button is ment for the "Build Railroad To" command, much like the "Route To" command. That's why it has arrows on it. I figure it would be useful to add that command at some point. Should be easy to do.
     
  14. TC01

    TC01 Deity

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Sorry for delay in responding, I've been busy and working on updating my other mods (however I did just finished the native civs for v0.3).

    A Railroad Route To button might be useful, but how would it work? Would the pioneer build roads then railroads on the plot? If so it should be made a lot more expensive.

    I guess Route To commands are done via SDK? That would be another command (along with the train ones) that need to be added.
     
  15. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,095
    Location:
    Marooned, Y'isrumgone
    Yeah, it would have to build Roads then RailRoads. I been working on a ModComp myself but just got done with the first release today. So I'll look into those other commands over the next few days.
     
  16. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,095
    Location:
    Marooned, Y'isrumgone
    I am going to work on this today. I haven't delved into the trade routes so I am not sure what I'll have to do to get the train commands working. If I have to write a bunch of new functions it may take me a long while but I'll get back to you on my progess...
     
  17. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,095
    Location:
    Marooned, Y'isrumgone
    Ok, I have questions..

    1. When you say the "Change the name of your Civilization on Revolution" where is this name going to be displayed? Right now the Civs name doesn't appear very much in the game actually, I only see it listed once in the Victory Conditions/Settings Screen. Plus the Civs name has three names actually in the XML. ... The "Description", "ShortDescription", and "Adjective". The Civ Adjective, and ShortDescription appear sometimes when the King talks to you, but other than that I don't see where it appears much during the game.

    I just figured out how this is done and it would be an easy thing to do. I didn't know you can go into Options/Your Details and change all the Titles that appear so you can edit them yourself. It would be an easy thing to do this automatically on revolution though. I just need the Names and adjectives you would like to change them to so they can be added to the Text.XML. But Like I mentioned the Civ name isn't used enough really to make such a change even noticeable, that I can tell. We could change the Player's name to "Player, President of the State of Deseret" or something like that.

    What was your thoughts on this and how was it going to function?


    2. Looking into the trade routes and just thinking on how to add in Passenger pickup commands. Its really going to take some fancy coding to get it to work seamlessly. But I wonder though how useful these commands will be? Like when I suggested this I was thinking if you had cities spaced out long ways apart this would be a neat command to move units about but how far apart does the player place his cities... not very I would think. I try to keep mine close together. That being so even with roads it would normally take no more than two turns to move a Colonists from one city to the next. Thats probably faster than actually "Waiting on the Train". So I am thinking unless some game mechanics are changed these commands wont be used often.

    Some ideas or suggestions:

    -There could be hazards for trying to "trek across country" by foot. This would be very historically correct as well. Indians, Starvation, getting lost, or bad weather, where some of the major events that could happen to travelers. There could be some kind of random check for each plot a Colonists has to travel across. If say the Colonists encounters bad weather he could become immobile for a turn. Or you could charge Health points for each plot a Colonist crosses on foot. Just a couple ideas off the top of my head. But something like that would make "waiting for the train" a more viable option.

    -Instead of having the train pickup a Colonist there could be an automatic transport feature. Much like Civ4 is, once you have railroads movement is basically free right? So maybe something like if you had a railroad between two cities Colonist could move between those two points in one turn. A feature such as that would be more useful.

    I haven't been keeping up with all the threads so I don't know if much has been mentioned on this but maybe we could take up a general census on these ideas and see what players would think the most viable solution would be.

    What are your thoughts?
     
  18. TC01

    TC01 Deity

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    I was thinking ideally of adding text strings such as "RevolutionDescription", "RevolutionShortDescription", "RevolutionAdjective", etc to CivilizationInfos.xml rather then referencing specific strings in the SDK for this, allowing me or others to change them directly.

    The idea was that since we had an argument over Deseret versus Utah, Cascadia versus Oregon, etc., this would be a compromise. Possibly, on revolution we can have a popup (or at least something appearing in the event log) saying "The Utah Territory is now known as the State of Deseret", along with the existing revolution messages (constitution, etc). Maybe also, in the pedia page for each colony, there could be a line "Revolution Name: State of Deseret" as well. (Though I could do this in the XML text for the civilization instead).

    Several people have suggested making rivers an actual feature, which you can send ships across. The suggestion I liked best was making rivers a feature that took up most of a plot (whereas the current rivers are minor rivers and streams), that have an incredibly high movement cost for non-water units. Then you could build bridges as an improvement across them and railroads and roads over the bridges. I kind of liked the idea.

    Chibiabos also suggested that we could make Canyons impassable features found along rivers... this might also work.

    We could add blizzards (like in the FFH Age of Ice scenario) to frequent the Rocky Mountains area, thus making travel near there dangerous. Once the west coast section is added to the mapscript this will become more meaningful.

    We could also make random events that cause colonists to become ill, or suffer bad weather like you said. They would only trigger outside of your borders. Perhaps promotions like "Woodsman" and "Mountaineer" could also decrease the likelyhood of such events occuring.

    I don't know how much of a graphical challenge it would be to design, but perhaps we could make this work like it does in Planetfall? In that mod for Civ 4, your land units can cross ocean tiles as long as they are inside your territory. When this happens, your unit looks like it is "attached" to a transport ship.

    Perhaps when you move a non-train onto a railroad, we could make it look like there's a Locomotive or other train unit in front of it, as if it is "riding the train"?

    I will open up a thread on this to discuss it.
     
  19. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,095
    Location:
    Marooned, Y'isrumgone
    Change Name on Revolution files.

    Here is an upload to test. I tested it once and it worked seemingly. You will see in the CivilizationInfos.xml 3 new tags for Revolution names. I just copied all of Texas's Descriptions for each one for testing. I played as Oregon and after Revolution I was refered to as Texas names. So I believe it works. Test it for me though and I'll be back this afternoon.
     

    Attached Files:

  20. TC01

    TC01 Deity

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    One thing before I test/merge (I edited CivilizationInfos.xml since v0.23): I notice in CIV4CivilizationInfos.xml it looks like this:

    Code:
    			<Adjective>TXT_KEY_CIV_DESERET_ADJECTIVE</Adjective>
          <RevolutionDescription>TXT_KEY_CIV_TEXAS_DESC</RevolutionDescription>
          <RevolutionShortDescription>TXT_KEY_CIV_TEXAS_SHORT_DESC</RevolutionShortDescription>
          <RevolutionAdjective>TXT_KEY_CIV_TEXAS_ADJECTIVE</RevolutionAdjective>
    			<Civilopedia>TXT_KEY_CIV_DESERET_PEDIA</Civilopedia>
    Shouldn't it look like this?

    Code:
    			<Adjective>TXT_KEY_CIV_TEXAS_ADJECTIVE</Adjective>
    			<RevolutionDescription>TXT_KEY_CIV_TEXAS_DESC</RevolutionDescription>
    			<RevolutionShortDescription>TXT_KEY_CIV_TEXAS_SHORT_DESC</RevolutionShortDescription>
    			<RevolutionAdjective>TXT_KEY_CIV_TEXAS_ADJECTIVE</RevolutionAdjective>
    			<Civilopedia>TXT_KEY_CIV_TEXAS_PEDIA</Civilopedia>
     

Share This Page