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

The Great Patriotic War: WWII on the Eastern Front (Development Diary)

Discussion in 'Civ5 - Creation & Customization' started by ww2commander, May 9, 2012.

  1. ww2commander

    ww2commander Emperor

    Joined:
    Aug 23, 2003
    Messages:
    1,243
    Location:
    Australia
    Just spent (wasted) a whole night trying to figure out why my UI code is not adding things up correctly. Basic maths stuff, but using decimal values (i.e. 0.04).

    Turns out after some reading that LUA has an issue with rounding numbers properly, thus some randomness sneaks in that results in values shifting a few digits.

    What may be displayed as a total value, does not equal its individual parts when displayed in a UI screen.

    As the image below shows for Population Eligible For Conscription, the 3 individual values (27479820, 41223988 and 412223) do not add up to the total (69116032) which is a variable in the code which sums those three values. All I know is that the third entry (classes 1924-1927) uses a decimal value (0.04) to get its result via the math.ceil function.

     
  2. ZeroZeroSix

    ZeroZeroSix Prince

    Joined:
    Oct 15, 2008
    Messages:
    347
    It seem you are calculating the total from Real Number (number with décimal) then converting this total to Integer wich seem to lead to a minimal mistake. My advice is to convert the opérands first so you work only on integer on first hand. Humm...did I sound logical ?
     
  3. ww2commander

    ww2commander Emperor

    Joined:
    Aug 23, 2003
    Messages:
    1,243
    Location:
    Australia
    I will try your suggestion as well as numerous other things and see how I go, but this is really make me lose faith in calculating things via LUA.

    When two integers don't add up correctly you start to worry what else could be wrong in all your code you have written!!!

    Thanks for the tip.
     
  4. primordial stew

    primordial stew Emperor

    Joined:
    Sep 1, 2005
    Messages:
    1,219
    Location:
    a puddle
    Yes, it is very disconcerting when simple math isn't even working.

    Actually any "native" calculation will give the same result. Some applications (like the window calculator) do the conversions for you so the result is what is expected (eg .8 + .2 = 1.0), but with fixed precision floating point the .2 != 2/10. This is why many variables are "times 100" or "times 1000". So if you're going with floating point then the result should always be rounded in some way (%-f3.2).

    BTW, will there be an additional penalty in conscription if one gets near the limits of the pool? A "Too old or too young" extra penalty.
     
  5. ww2commander

    ww2commander Emperor

    Joined:
    Aug 23, 2003
    Messages:
    1,243
    Location:
    Australia
    I tried so many different ways but every single time the digits would shift around across any given value. Heck, adding simple round numbers started to become chaotic.

    Thus I have given up on this approach. I am going back to the drawing board in the hope of deveoping something more streamlined around population.

    Key things I want to consider include:
    - Staggered pop availability in line with age groups like historic model
    - Women/older men being recruited
    - Emphasis on pool shortage and limitations.
    - Pool dynamically linked to territory controlled in game.

    Whilst the Soviets had lots of manpower, they struggle to train and equip men fast enough in the early part of the war. Only from 44 did things get better.
     
  6. ZeroZeroSix

    ZeroZeroSix Prince

    Joined:
    Oct 15, 2008
    Messages:
    347
    I know nothing about LUA but I remember having trouble doing a sum of rounded real number.

    What I did was something like IntegerX = Round(RealA) + Round(RealB))...Anyway, I did that some time ago so I don’t remember exactly.

    The point is that all of that is interpreted code assembled by some application and some times the compiler doesn’t assemble it the way we want it. Will the number be converted before or after the sum ? That can be your case if you are using complicated functions to calculate real. Maybe you should decompose the function like converting real to integer in a separate line then adding those integers.

    Anyway I look forward to play your mod wich remind me of an old game called Second Front by SSI.
     
  7. Catalonia

    Catalonia Warlord

    Joined:
    Jan 4, 2012
    Messages:
    118
    It looks very good
     
  8. ww2commander

    ww2commander Emperor

    Joined:
    Aug 23, 2003
    Messages:
    1,243
    Location:
    Australia
    Following up on my previous post, after much research it becomes apparent that the USSR had a significant pool of manpower, but struggled to obtain and train it in sufficient quantities.

    With a manpower pool of around 30 million 17-45 year old men (plus women), it seems pointless (trivial?) for me to waste time on calculating and setting a cap limit on civilian population based on cities and towns on the map.

    Instead, I am leaning towards focusing on intake levels and relate this to city size and towns currently held on the map. Thus, less map ownership translates to smaller manpower intake irrespective of population size.

    Will keep playing around with my code and see what magic numbers come out the other end!

    All I have as good reference point is that the Moscow Military District recruited 1,020,000 men during 1944-45. Based on this snippet I can calculate the output per turn for each city ingame on a good turn (holding all original territory).
     
  9. ww2commander

    ww2commander Emperor

    Joined:
    Aug 23, 2003
    Messages:
    1,243
    Location:
    Australia
    Being a little bored tonight, I thought I would stitch together an image of the game map. This will prove useful in planning things without going in and out of world builder all the time and also give you guys a sense of scale for the scenario.

    The map is pretty much done but I do adjust things like rivers, hills and other features as I uncover more details from research.

    The unit placement is not complete and is subject to constant change. You will notice a lot of trading post icons on the map. These represent actual towns and serve a useful purpose in the scenario.

    Enjoy

    Spoiler :


     
  10. fdregal5912

    fdregal5912 Chieftain

    Joined:
    Jun 16, 2012
    Messages:
    24
    Location:
    Mexico
    thanks for the head up, something is better than nothing ;) my only remark so far is that Kiev (& Gomel of course) seems to me something like 4 tiles too much to the West, maybe you were loosing space there for other cities, most of the maps I've seen put Kiev pretty much due North of Odessa.

    I think you choose a good span of the main action, only I don't know how USSR will regain strength once Germany corner their forces to the front line during 1941, there will be not much territory for recovery as happened for real.

    But in general looking good :goodjob:
     
  11. ww2commander

    ww2commander Emperor

    Joined:
    Aug 23, 2003
    Messages:
    1,243
    Location:
    Australia
    Short Answer: The map has been designed with the scenario in mind as opposed to true scaling.

    Long Answer:The map has a slight curvature applied which pinches the top portion of the map to reduce dead space in the Urals area and ensure a usable portion of the Murmansk region is include (you will note the slight compression in this area of the map).

    However I will admit that the lower portion of the map (Italy, Caucasus and Southern Ural regions) have retained more of their flat map positions to ensure vital cities are on the map and not offset further east (or south in Italy's case) which would then mean further expanding the map...and more Ural/Siberian dead space!

    Applying the rivers on the map also allowed me to gauge roughly the right positions using the hex map system.

    As a side note, if you look at maps from other games such as 'War In The East', the hex grid has been applied onto an accurately drawn map and thus tends to be spot on.

    We modders, unfortunately, have to do things in reverse by drawing a real map onto a restrictive hex grid which tends to throw things off. This means some creative licensing must be applied :sad:.

    If you look at the screenshot you will notice all those Red Army units. Those are actually ALL the units (at a divisional level) that were on the East front during Operation Barbarossa...and there is no 2UPT for the Red Army units!

    As you can see, there is a lot of space to defend...thus space is not actually limited but a burden to defend for the Soviet player. The Petrozavodsk-Kaluga-Voronezh-Rostov is huge 44 tiles long which I don't expect the player to be capable of defending. River crossings, forests/swamps and towns are your best-friend on this map. Creating strategic choke-points is key to winning just like the real war.

    From a historical sense, the Ukraine, Belorussian and West Russian areas were the most vital and did indeed cause a manpower/resourcing issue when captured by the Axis, and this in turn will be emphasized in my scenario.

    The way to get around these limitations is to evacuate industry, rebuild your resource base and re-capture lost territory . The myth of the huge Red Army horde is not quite correct (especially in 41-42) as the Red Army had to fight mostly with units that were divisional only in name and not size.

    The whole war is a complex series of parameters and events which I am trying to (slowly) breakdown and re-engineer into workable game rules.

    Thanks for the feedback :goodjob:
     
  12. ww2commander

    ww2commander Emperor

    Joined:
    Aug 23, 2003
    Messages:
    1,243
    Location:
    Australia
    Ok so where am I up to with this neverending mess? :twitch:

    After posting that image of the scenario map and some feedback from fdregal, I started to prefer the map less and less. City placement might have been good enough, but the vast 'wasted' space on the northern part of the map (Urals, Murmansk, Norway areas) really bugged me.

    I eventually stumbled across a hi-res map on the web that suited my scenario orientation better (coincidentally it is map from 1939-40) and overlaid a pre-made civ5 hex grid over the top of it to pinpoint coordinates of cities, towns and rivers.

    Thus has begun a redevelopment of the scenario map that has accurate city and town placement as well as all the rivers in the region (more than I ever realised :eek:). As I progress I am noticing more and more errors in my original map that I am glad I have resolved.

    Also, I have dropped Sweden as a city-state and reduced Norway map area to a non-playble portion (no major cities). The Murmansk peninsula has also been eliminated along with a large portion of the empty Ural/Komi north areas. The lack of Murmansk on the map is not a deal-breaker for my scenario as the flow of lend lease can easily be controlled via LUA based on what is happening on the map with the rail network.

    I have finished placing all the major cities as well as 80 of the towns (trading post improvements). I have also finished all the rivers (it took 2 whole nights!). By the end of the weekend I am hoping to have completed the transport routes as well as features (marshes, forests etc). Having the civ5 hex grid overlaid on the map has dramatically reduced the time needed to redo the map.

    As soon as I am finished, I will need to readjust my defines files in LUA that use old town/city coordinates (not a huge issue) and then dive back into finishing code and unit placement.

    I know it seems at times as if I am going back and forth randomly, but I really want to make this scenario as accurate as possible. I'm hoping this does not put off interest in my project as I am noticing a significant lack of interest lately :( (Maybe most people prefer to browse by rather than comment :dunno:).
     
  13. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,780
    Location:
    France
    Be sure that I'm reading with interest each update you make, and I guess I'm not alone to follow your thread with interest, even if not commenting :)
     
  14. magzhi

    magzhi Warlord

    Joined:
    May 23, 2010
    Messages:
    197
    I've read each one of your updates. I just have nothing to say right now because Lua it is outside of my knowledge.
     
  15. ww2commander

    ww2commander Emperor

    Joined:
    Aug 23, 2003
    Messages:
    1,243
    Location:
    Australia
    Quick Update....

    I have now finished the new version of the scenario map. All cities are aligned correctly (1 or 2 spacing exceptions) and even more towns are now represented on the map.

    Rail routes are historically placed on the map with two types being represent:
    - Ingame roads (light single tracked routes)
    - Ingame rail (heavy double tracked routes)

    I am planning on releasing a separate graphics file for those who wish to replace the road graphics with rails ingame.

    I have also started to address something that has been troubling me for a while...the production system code. This code started to get messier and messier as each feature was added.

    I have begun rewriting this code with an objective of making it more modular (less prone to breaking if I remove buildings/units and more streamlined (reducing loops on player buildings/units to a minimum) which should hopefully improve next turn waiting times.

    This in turn has allowed some new features to be more easily included in the scenario such as rail transport system and workforce pool. Both of these factors are directly linked to the situation on the map such as critical junctions being cutoff and larger cities falling into enemy hands.
     
  16. magzhi

    magzhi Warlord

    Joined:
    May 23, 2010
    Messages:
    197
    any progress? ^^
     
  17. ww2commander

    ww2commander Emperor

    Joined:
    Aug 23, 2003
    Messages:
    1,243
    Location:
    Australia
    Unfortunately I will be mothballing this project.

    A couple of factors that have made me come to this decision:
    1. Spending more time with my family (too much time spent coding and modding)
    2. The whole lone-wolf thing has seriously caused burn out. I actually don't look forward to modding at times and lately it feels like a job which I have to push myself to complete.
    3. The Civ5 community is still in its infancy with little or no knowledge on complex areas. This is not saying anything about the help/responses I get on this forum, but you can tell a lot by the few threads that get answered regarding complex issues and game mechanics.
    4. The announcement of a soon to be released DLL has given me a 'wait and see' gut feeling given the amount of code I have written to date!

    I think I will take a 3-6 month break and see what its like next year. I still want this mod to see the light of day so I am not abandoning this project....just mothballing it for a more appropriate time when Civ5 reaches 'peak modding' similar to where Civ 4 is right now with content, knowledge and so on.

    Thanks to all those who have provided support and words of encouragement to date.

    My posts will become less frequent in the coming days but I will still pop in from time to time to check updates.
     
  18. primordial stew

    primordial stew Emperor

    Joined:
    Sep 1, 2005
    Messages:
    1,219
    Location:
    a puddle
    Sorry to hear that :cry: We've all been there though ;) The mythical debug DLL will help matters tremendously, someday..

    Is there anything you can post, like interesting bits of Lua or learning's that might help others out?

    I'm trying do something on the same topic, but much less detailed. For example units are at the corp/army level. There is no production, just a OOB, and then some sort of code to be added later for reconstituting units. Axis casualties are too high in the first few months, but it's getting better. In last nights game the Finns ignored Leningrad and went and took the 2 cities behind it. I've never seen a CS land unit travel so far from home! Hungary's 1 controlled unit just sat in their lone city the whole time. The Romanians actually came out to support the drive on Odessa :goodjob: They took a beating trying to cross the Bug river, but managed to retreat in good order.
     
  19. ww2commander

    ww2commander Emperor

    Joined:
    Aug 23, 2003
    Messages:
    1,243
    Location:
    Australia
    So I have been working on and off with this project for the past few weeks. Having played some major vanilla games, I have learned quite a few things along the way I plan to improve with the scenario.

    Anyhow....I upgraded to the latest fall patch to see what changed. The good news, each turn is now reduced from roughly 3 minutes to 1 minute. Thats with a couple of hundred units on the map for test purposes.

    The bad news, all my unit graphics have disappeared off the map (someone posted a similar thread elsewhere). The unit icons are there, but the actual units themselves are gone!

    I upgraded to the latest graphics drivers and have not changed anything in my code to prompt this so I am a stumped. For the time being I think I will put this baby back on the shelf until others with the same graphics problem figure out the cause. I gather it has something to do with ingame code changes with the latest patch???

    The reason I say this is that a similar disappearing problem would occur with my cities when I had placed several buildings in the same city that where mutually exclusive. Once I removed them, the city graphics reappeared on the map!
     
  20. rhettrongun

    rhettrongun Prince

    Joined:
    Mar 19, 2011
    Messages:
    341
    Location:
    TX
    The map looked fantastic and some of the features you had planned sounded great. I see that the project is shelved though.

    Ah that's too bad :(, although I certainly understand how this stuff can go stale and turn into a job after a while.
     

Share This Page