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 and Python Changes WIP

Discussion in 'Civ4 - World War II 1939 Mod' started by asioasioasio, Sep 14, 2009.

  1. asioasioasio

    asioasioasio Fallout Scrubber

    Joined:
    Mar 4, 2006
    Messages:
    3,058
    Location:
    Poland, EU
    I start this thread to discuss the future changes and actual development of SDK and Python to the gameplay. I hope it'll easier to exchange the toughts and valuable information, and not doubling the work, and dividing tasks since at least two persons actually (Dom Pedro II and LoneTraveller) work on SDK and Python and one additionaly - primordial stew on Python. + of course me with my noobish attempts to change and merge code ;)

    I'll post link to actual source code here - 2.02
    http://www.mediafire.com/download.php?4jlmxyz243n
    Contains Events with images

    I'll setup account on sourceforge or google code - if you'll find it useful

    And of course list of changes - the one that's done, and the one we would like to see.

    To discuss the Development of Events in Python
    see this thread also:
    http://forums.civfanatics.com/showthread.php?t=334338
     
  2. Dom Pedro II

    Dom Pedro II Modder For Life

    Joined:
    Apr 3, 2002
    Messages:
    6,811
    Location:
    Exit 16, New Jersey
    Ok, so regarding interception fall off, would you prefer that I make the fall off unit dependent? So maybe one type of Fighter could have a fall off of -3% and another a fall off of -5%. If you are looking to have more differences between fighters, this might be useful. But if you don't think you will use it, I will just use a value in the GlobalDefines.xml


    EDIT: Also, we discussed this like two years ago, but I had an idea for having Radar Stations increase interception chance for fighters in the area. I think that would be better than the current aerial attack protection.
     
  3. asioasioasio

    asioasioasio Fallout Scrubber

    Joined:
    Mar 4, 2006
    Messages:
    3,058
    Location:
    Poland, EU
    The change just in Global Defines.xml will work well I think.
     
  4. Dom Pedro II

    Dom Pedro II Modder For Life

    Joined:
    Apr 3, 2002
    Messages:
    6,811
    Location:
    Exit 16, New Jersey
    Another thing to discuss is the changing of the seasons.

    I think we should create maybe 2 additional terrain types and possibly an additional feature type. We could call them Wintry Grassland, Wintry Plains, Winter Forests, or Snowy Grassland or whatever. Russian units could get bonuses when defending or attacking these types of terrains. Non-Russian units, on the other hand, could suffer penalties.

    Of course, this would then apply to all winter terrain on the map. So we could either create separate terrains unique to the Russian part of the map, or we could make a promotion that is given to Russian units called General Winter that would appear during the winter season and give them extra strength inside Soviet borders. The other problem with that, of course, is that the Russians could conquer territory well outside and to the south of Russia and those units would still get the promotion.

    Another thing is the addition of one or two additional terrain types like Muddy Plains. This would be applied to Russian territory in the spring (and possibly autumn) and will double movement cost. This won't affect Infantry, but it will certainly slow down armor and land transport units.

    Then there's other things like reduced success for air missions like in RtW, or the small chance of ships sinking the North Sea during winter maybe? I don't know how likely military ships were to sink in bad weather... Anyway, it depends on how realistic one wants to get.

    Even if the terrains don't do anything, I think we should still add them for aesthetics. We could create some very nice retexturing of the plains, grassland and forests.

    EDIT: I'm also going to add in the Radar Station functionality I mentioned above.

    I will also add an offset value in the GlobalDefines for interception falloff.

    This offset value will allow you to adjust when the falloff starts to count. For example, let's say you have a Fighter with an interception chance of 50%. An enemy bomber hits a city 8 tiles away. If the offset is 1, the penalty will be calculated as (8 tiles - 1 tile) * (-3% falloff per tile) = -21%. So the Fighter will only have a 29% chance of interception. If the offset is 3, then penalty will be calculated as (8 tiles - 3 tiles) * (-3% falloff per tile) = -15%. And if a Bomber attacks any tiles within 3 tiles of the Fighter, the Fighter will suffer no interception fall off penalty at all.
     
  5. Dom Pedro II

    Dom Pedro II Modder For Life

    Joined:
    Apr 3, 2002
    Messages:
    6,811
    Location:
    Exit 16, New Jersey
    I know you're planning to create a Maginot Line unit, but it would also be possible to create unit behavior scripts to get the French to reinforce these fortifications with units.
     
  6. primordial stew

    primordial stew Chieftain

    Joined:
    Sep 1, 2005
    Messages:
    1,219
    Location:
    a puddle
    There was a PC game I played a long time ago, "V for Victory: Velikiye Luki" in which there was a turn when the winter terrain was applied. I was blown away by this, it was so fantastic :) If that effect can be captured here will be worth doing.

    The effect though can also be done pretty well (the AI wouldn't understand which plots the promo wouldn't apply to) with just setting a promotion in each traversed plot in python. I don't know what hit there is to turn speed by doing this though. Another way is to only process the promo at the end of the turn would work well enough so long as movement isn't too far.

    One question on this though. In the Winter War it was the Russians who would be weakened (I am a fan of negative promos), whereas the Finns would not. Obviously the Siberian reinforcements would get such a promo, but would the regular Russian army get it if the Winter War did not happen?


    I will offer a suggestion to add "garrison" (Volkstrum/Militia...) types of units into the game which have 0 movement to help speed things along some.

    One possibility would be to combine both ideas to force the AI to guard the Maginot Line, etc. Basically there would be a "fort" promo that makes the unit immobile. As for getting new units there, if the unit was of a specific type or name it could be done in python. In RFRE I do it by name, but setting scriptdata on the unit would probably work too.

    The full implementation might be a specific French national unit (to keep them from producing too many) + python dictation of movement (pushMoveToMission + collateral) + fort promo. The python would have to do some load balancing across the set of plots, but that is easy too.
     
  7. asioasioasio

    asioasioasio Fallout Scrubber

    Joined:
    Mar 4, 2006
    Messages:
    3,058
    Location:
    Poland, EU
    Awsome ideas.

    Would you make that both values (fallof offset and falloff per tile) can be set in Global defines? It would be easier to balnce the changes if there would such need. It would be cool to apply similliar settings to bombers - bombing mission - the farther the object to bomb/strike is - the less damage would be done - it has also sense - you need to carry more fuel and less bombs. Also this air superiority option from DCM - that fighters attacks fighters in other city seems to me to much powerfull. It would be cool to weaken it with this falloff options too (of course after we add to the source code merged mod wich contains DCM).

    I love the idea with winter terrains. It'll be all the time on the map, or do you want to change the look of the terrains in the winter/spring? I disliked the second option in RtW - not that this is cool idea, but it slowed down pc so much that during winter months when I pressed end of turn, I could go to kitchen and make tea ;) The second option adds more flavour, but if it'll slow down much old pcs, i will definitly stay with option number one if there isn't possible to make the second option fast and efficient. The first also could have greater impact on food and hammer production - so Canada won't turn into superpower, and Soviet Union having more cities than other players still won't be so much powerfull and Siberia won't change into very habitted place on Earth).
    Similliar promotion could get Finland - adding extra defense and speed in winter terrains.

    The terrains graphics aren't the problem. I can work or it - I should present something to the end of week.

    For MaginotLine - I don't think that unmovable unit is good idea - it would get obsolete, so more classes and units should be done in xml - I would like to stay with good idea with making 'fort' promotion, not available by traditional experience points. This way anything with this promotion (artillery (it would be cool to bomb adjuscent tiles with DCM merged in), machine gunners I-II, infantry I-IV, AT Infantry I-II, Jaegers I-II, Mountain Infantry I-II, Medic) could be used in Maginot Line or Zigfried Line or Mannerheim Line, Atlantic Wall or any other bunker systems / pillbox, strategical city (like Leningrad, Moscow, Stalingrad, Gibraltar), etc..
    Yeah reinforcement should be done - all units dies after certain amount time in battles. The Ai could be forced to do that with scripts - maybe even a little bit cheat (but of course not to offten - max 2 fresh units per turn could be added for France, and max 1 for rest countries) - that if there'll be such need new units with the promotion 'fort' could appear in plot x/y
     
  8. Dom Pedro II

    Dom Pedro II Modder For Life

    Joined:
    Apr 3, 2002
    Messages:
    6,811
    Location:
    Exit 16, New Jersey
    I said I would ;) Actually, I already did. It's done. Just let me know how you want to merge it into your SDK.

    EDIT: Something that's just occurred to me... These falloff factors actually make Aircraft Carriers more important in the game. I normally don't build them because I can usually find a few friendly cities within range. But now, it's not just about being in range, it's about being as close as possible to maximize damage.

    I agree completely. I'll add it immediately.

    This is one of the things I am a big fan of from DCM. I hate having to airstrike with Fighters in hopes that they bait an enemy interceptor.

    Would you want the falloff distance to decrease the Fighter's attack strength?

    I would really like to have the tiles change with the passing of the seasons. Part of the reason why RtW slowed down in the winter months was the fact that the Bitter Winter was being calculated and was changing tiles throughout the winter months rather than once at the start and again at the end.

    I'm looking at the code and trying to see if there's a way to streamline the process to reduce the processing time. Examining Bitter Winter in the RtW SDK code, it seems like there is room to reduce the processing time. I'll do some tinkering, make some changes, try some experiments and get back to you.


    EDIT: I've also made changes so that Radar Stations will give +20% intercept chance to interceptors defending surrounding plots. But... this will only affect the place being bombed. So if the Fighter is in London and the Radar Station is in Manchester, the Fighter in London will get +20% Intercept when the enemy attacks Manchester.
     
  9. Dom Pedro II

    Dom Pedro II Modder For Life

    Joined:
    Apr 3, 2002
    Messages:
    6,811
    Location:
    Exit 16, New Jersey
    I'm going to make some changes to the interface also so when players select air strike or air bomb and mouse over the targetted tile, they'll get a breakdown of evasion chances, interception probability, and air combat strength on that tile.
     
  10. asioasioasio

    asioasioasio Fallout Scrubber

    Joined:
    Mar 4, 2006
    Messages:
    3,058
    Location:
    Poland, EU
    Awsome. The code would merge LoneTraveller with Merged Mod and few other small modcomps. Right now there's beta of MMerged Mod and we wait for cuurent version. I think you can make as a modcomp for 3.19 or even better merge with current SDK code (check first post) and we'll worry later if some problems will appear during merging the mod. with Merged Mod

    BTW What compiler do you use Codeblocks or VS 2005 Express?

    Yeah cool option, and I'm glad that carriers will be more important :). It was also for me one of the last units to be built in game.

    Yeah I use it offten too :)
    Yeah it could make smaller strenght (or add another factor in combats odds -18% strenght for range (-3% per tile)), Not to much, but I think it's always easier to defend than to attack - so flying to another cities should always put more risk on air missions.

    OK but will it still slow down for example in November and April?

    OK :)

    :goodjob: :)
     
  11. Agent327

    Agent327 Observer

    Joined:
    Oct 28, 2006
    Messages:
    16,048
    Location:
    In orbit
    Wouldn't it be possible to let such unmovable units disappear per event? (Like Maginot Line units disappear with defeat of France?)

    That's only true if units get annihilated; all units sustain combat damage and need time to restore to full strength. (In reality this would mean replacing lost personnel with fresh recruits and/or materiel.)
     
  12. Dom Pedro II

    Dom Pedro II Modder For Life

    Joined:
    Apr 3, 2002
    Messages:
    6,811
    Location:
    Exit 16, New Jersey
    Visual Studio


    Yes. But not necessarily to the point that you can make tea ;) I think I can create a method that will be more efficient than the technique used in RtW.
     
  13. primordial stew

    primordial stew Chieftain

    Joined:
    Sep 1, 2005
    Messages:
    1,219
    Location:
    a puddle
    > Similliar promotion could get Finland - adding extra defense and speed in winter terrains.

    Equipment freezes, and sentries try to stay warm instead of looking out for the enemy. The unprepared unit's effectiveness is reduced.


    > For MaginotLine - I don't think that unmovable unit is good idea - it would get obsolete, so more classes and units should be done in xml -

    By the end of turn 2 both the Finns and French have completely abandoned their forts. The only solution is to make the units immobile.

    BetterAI might improve this I don't know, but for sure the stock AI won't behave.


    > Yeah reinforcement should be done

    If it's true that the AI will not intentionally man a fortified line then some special mechanism needs to be done in order to get the desired effect. If just any non-mechanized unit can man the line then it could just be a random chance that the built unit gets sent there. While unlikely it would happen eventually that much of the French artillery units would get sent to the Maginot Line which would make for not much of a defense at all.

    With a special fort unit type these units could be give a lower gpt cost. Fort units wouldn't have trucks, or horses either.

    There could be an abandonment condition. The fort promo gets removed if too many of the lines plots have been taken. It would just be a variable in the players scriptdata that would be check at the end of each turn to see if the fort promo gets removed.


    Another concern about the Maginot Line is the ease at which Mountain infantry can be built since they can easily go around it. Mountain units were pretty rare, and overall I think would be weaker than regular units. While training is very good, they had much less heavy equipment than a regular infantry division did.
     
  14. LoneTraveller

    LoneTraveller Chieftain

    Joined:
    Apr 30, 2008
    Messages:
    283
    Location:
    Montreal, Quebec
    The maginot line was obsolete when the germans when through the Ardennes instead...it is almost as if it should only be a defensive line when attack from a certain angle.
     
  15. Dom Pedro II

    Dom Pedro II Modder For Life

    Joined:
    Apr 3, 2002
    Messages:
    6,811
    Location:
    Exit 16, New Jersey
    I mean, honestly, the Maginot Line should almost just be a set of impassable tiles since no player is going to attack it if they could just as easily go around it. Unless you somehow make the alternative options less desirable, it's somewhat pointless.
     
  16. tron47

    tron47 Chieftain

    Joined:
    Jan 7, 2009
    Messages:
    13
    the magiot line was the strongest and biggest line but not the only one.
    the siegfreid line, the stalin line, the gothic line, fortress europe, etc. some of these were fortifications for troops which we already have, some were fixed artillery positions, some both.

    we need an engineer unit that upgrades to a fixed artillery position.
    the magiot line is a series of forts with infantry stationed there and heavy fixed artilery as well on hills. the nations can build new lines and fortify cities as was done in the war.

    the sdk change i would like to see is a loss of 10% of each units strength each turn until it is at 50% if a unit is cutoff from supply. and no healing in enemy territory.
     
  17. LoneTraveller

    LoneTraveller Chieftain

    Joined:
    Apr 30, 2008
    Messages:
    283
    Location:
    Montreal, Quebec
    Finally got my nation specific general code to work with any country.

    Thanks to xienwolf for showing me a way to do it...only toke 4 days to figure out which function to replace the GC.getDefineInt("UNITCLASS_GREAT_GENERAL") with... :

    GC.getInfoTypeForString("UNITCLASS_GREAT_GENERAL", false);
     
  18. LoneTraveller

    LoneTraveller Chieftain

    Joined:
    Apr 30, 2008
    Messages:
    283
    Location:
    Montreal, Quebec
    For a few weeks now I've been working on my idea of making oil tankers carry resources from "territory to other territory".

    For example I have edited the map so that the main british isles don't have oil on them, I created Bagdad and linked them through artificial cultural borders to Egypt, Cyprus, etc. Now for the main isles that gain access to oil, a tanker unit must be made then sent to some city contained inside cultural borders containing a working oil pump. Once there the ship uses the custom action called "load oil abord ship" and then sets sail for England (hopefully with some escort :) ). If it survives the trip and enters a main isles' port it can them use the action "unload oil" to give it's oil to the territory it has entered.

    Each unloaded tanker gives 3 turns of oil to the territory. If there is no oil available then no production of units requiring oil is possible. Every turn consumes 1 integer of oil whether there is production requiring oil or not (call it domestic consumption).

    The current status of this little project of mine is :

    What I have completed :

    - Unit (tanker) is created and has it's load/unload action (SDK + python + button (GUI))
    - Territories (SDK name : PlotGroups) can accumulate oil from unloading ships
    - Production requiring oil must have either the natural resource on it's territory or having a positive number of turns left for oil production.
    - Show the status of each tanker (empty/full)

    What I have left to do :

    - Edit the characteristics of "open borders" diplomacy
    - Make it so that the number of available oil per territory is reduced by each turn.
    - A menu somewhere listing the territories of the player and it's number of turns available with oil.
    - Make the AI for it.
    - Make other ships that would carry other types of resources (Incense, Chemical Resources, etc) from producing territories to needed territories


    That's it for now. Just telling what I'm doing other than waiting for that MergedMod to be completed.
     
  19. LoneTraveller

    LoneTraveller Chieftain

    Joined:
    Apr 30, 2008
    Messages:
    283
    Location:
    Montreal, Quebec
    Finished my semester a few days ago and I'm starting to merge the Merged mod with this one.

    I have a few problem along the way and I'm debugging them one by one.
     

Share This Page