Overlords Max

Status
Not open for further replies.
Reich Chancellor Amadeus speaking to the commander of his ground troops in the captured White House!

KirkSpock.jpg
;)
 
Guys, I will weigh it up, and definitely watch the vid. Not sure if is an issue, as not all players would want to have limits placed. But it might be interesting to have a peacetime military, until the war tech is researched. At the same time, I like to offer the player many ways to play. Putting restrictions "just because" might be cool to one player, but not so for others. I am not really up for anything that slows the game down. Happy to test any new module component if you are willing to let me try it. :)
Turns out that the computation was causing noticeable lag because it was being done 255 times! The section of code that makes it run only once when the menu is opened (instead of once for each item in the menu) is in events.lua, and I just forgot about that until investigating in the hope of finding a quick solution.

You should just be able to place the 3 attached files in the appropriate places (main folder for events.lua, LuaCore for the other two) and have things work. Save backups of these files just in case.

If you want to use the automatic code generator to make can build settings, put the attached scripts folder in your scenario folder. Then, from the Lua console (with the scenario running), run makeObjectJS.lua, and replace object.js in the folder with the generated file. You should then be able to open autoCanBuild.html in your browser.

To use generated code, you will also have to add these lines to canBuildSettings.lua
Code:
local addBuildConditions = canBuildFunctions.makeAddBuildConditions(unitTypeBuild,improvementBuild,wonderBuild)
-- addBuildConditions(item,buildabilityParameters)
--      adds the buildabilityParameters to the appropriate table and index for item.  If the item
--      already has buildabilityParameters registered, the new set of parameters are automatically
--      added to the alternateParameters table
-- addBuildConditions(tableOfItems,buildabilityParameters)
--      for each item in the table, register the buildability parameters as above
This code should go near the bottom of the file, just before these lines:
Code:
canBuildFunctions.supplyUnitTypeParameters(unitTypeBuild)
canBuildFunctions.supplyImprovementParameters(improvementBuild)
canBuildFunctions.supplyWonderParameters(wonderBuild)

Here's a small example of a limited US army. The army is limited to 20 'points' until America gets the total war advance, after which they get an additional 500 'points' of allowed army. Infantry use up 1 point of quota each, while Shermans are two each.

Airborne units are not part of this quota, but are limited to 1 per 10 infantry, and no more than 10 total.

Spoiler Limited US Army Example :

Code:
-- contribution towards unit quota
-- higher number means fewer built
-- so, with a limit of 20, the US can build either
-- 10 shermans or 20 infantry
local americanJointMaxTable = {
    [object.uUSArmy] = 1,
    [object.uUSArmyII] = 1,
    [object.uM4Sherman] = 2,
}
-- The American army can have 20 "points" of material, until they discover total war,
-- then they can have 520 points of units.
local americanStandardMax = {base=20,tribeTotals={[object.aTotalWar]=500}}
--AMERICAN UNITS
--American home cities with a Barracks can train US Army units
unitTypeBuild[object.uUSArmy.id] = {location=USAHomeCities,allImprovements={object.iBarracks},
maxNumberTribe = americanStandardMax, tribeJointMaxWith = americanJointMaxTable,
}
unitTypeBuild[object.uUSArmyII.id] = {location=USAHomeCities,allImprovements={object.iBarracks},maxNumberTribe = americanStandardMax, tribeJointMaxWith = americanJointMaxTable,}

unitTypeBuild[object.uM4Sherman.id] = {allImprovements={object.iBarracks,object.iMunitionsPlant},maxNumberTribe = americanStandardMax, tribeJointMaxWith = americanJointMaxTable,}

--Certain American home cities with a Barracks and an Airbase can train US Airborne units
-- US Airborne aren't in the americanJointMaxTable, so building them doesn't use up
-- the army size quota.
-- Instead, the maximum number is 1/10 the number of USArmy and USArmy II,
-- However, 1 can always be built, and no more than 10 can be built, even if the
-- army is over 100 strong.
unitTypeBuild[object.uUSAirborne.id] = {location=USAirborneCities,allImprovements={object.iBarracks,object.iAirbase}, maxNumberTribe={tribeTotals={[object.uUSArmy] = 0.1,[object.uUSArmyII] = 0.1}, min=1,max=10 }}


Here's the extra documentation for limited numbers of units. If you're going to use the code generator, you probably won't need to have this reference in your file.
Spoiler Maximum Number Documentation :

Code:
--      .maxNumberTribe = nil or integer or table with the keys and values specified below
--                          or function(tribe,item) --> number
--          if nil, there is no maximum number of the item that can be built
--          if integer, the number is the maximum of the item that can be built by that tribe
--          if function, the returned value is the number of the item the tribe can build
--          if table, consider these keys and values, rounding down at the end of the calculation
--          .base = number or nil
--              base number 
--              nil means 0
--          .max = number or nil
--              maximum number even if calculation would be larger
--              nil means no limit
--          .min = number or nil
--              minimum number even if calculation would be larger
--              nil means no limit
--          .turn = number or nil
--              increment limit by the value each turn
--              nil means no change
--          .tribeTotals = nil or {[luaObject or "cities" or "population"] = number or nil}
--              for each luaObject the tribe owns, increment the limit by the corresponding value
--              nil means 0
--              if unitType, increment by the number of units owned
--              if improvement, increment by the number of cities that have that improvement
--              if wonder, increment if the wonder is owned by the tribe
--              if technology, increment if tribe has the technology
--              if tribe, increment by value if the tribeObject is the tribe building the object
--              if "cities", increment for each city owned by the tribe
--              if "population", increment for each population point of the tribe
--
--          .globalTotals = nil or {[luaObject or "cities" or "population"] = number or nil}
--              for each luaObject in the world, increment the limit by the corresponding value
--              nil means 0
--              if unitType, increment by the number of units owned by all players
--              if improvement, increment by the number of cities that have that improvement among all players
--              if wonder, increment if the wonder is owned by any tribe
--              if technology, increment for each tribe that has the technology
--              if tribe, increment by value if the tribeObject is active in the game
--              if "cities", increment for each city in the game
--              if "population", increment for each population point of all cities in the game
--          
--          .activeWondersTribe = nil or  {[wonderObject] = number or nil}
--              if the tribe owns the wonder, and it is not expired, add the increment
--          .activeWondersForeign = nil or  {[wonderObject] = number or nil}
--              if another tribe owns the wonder, and it is not expired, add the increment
--          .discoveredTechs = nil or {[techObject] = number or nil}
--              if the tech is discovered by any tribe, add the increment
--          .trueFlags = nil or {[flagKey] = number or nil}
--              if the flag associated with flagKey is true, add the value to the production limit
--          .counterValues = nil or {[counterKey] = number or nil}
--              for each counter specified by counterKey, multiply the value of the counter by the
--              number specified, and add that product to the production limit
--          .customFunction = nil or function(tribe,item) -> number
--              if a function is provided, add the output of the function to the production limit
--
--      .tribeJointMaxWith  = nil or {[luaObject] = number or nil}
--              each of the tribe's instance of luaObject in the table uses up a portion of the ownership
--              limit for the item in question, with that portion given by the value
--              e.g. unitTypeBuild[object.uSettlers.id] = {maxNumberTribe = 6, 
--                  tribeJointMaxWith = {[object.uEngineers]=2}}
--              and unitTypeBuild[object.uEngineers.id] = {maxNumberTribe = 3,
--                  tribeJointMaxWith = {[object.uSettlers] = 0.5}}
--              Here, the limit is 6 settlers, or 3 engineers, with an engineer using up 2 settler
--              allotments, and a settler using up 0.5 engineer allotments.
--              By default, the item we're checking if we can produce is given a cost of 1,
--              but we can specify a different number instead.  Here is another way to have
--              6 settlers or 3 engineers:
--              e.g. unitTypeBuild[object.uSettlers.id] = {maxNumberTribe = 6, 
--                  tribeJointMaxWith = {[object.uSettlers] = 1, [object.uEngineers]=2}}
--              and unitTypeBuild[object.uEngineers.id] = {maxNumberTribe = 6,
--                  tribeJointMaxWith = {[object.uSettlers] = 1, [object.uEngineers]=2}}
--              
--
--
--      .maxNumberGlobal = nil or integer or table with the keys and values specified below
--                          or function(tribe,item) --> number
--          if nil, there is no maximum number of the item that can be built
--          if integer, the number is the maximum of the item that can be built by all tribes together
--          if function, the returned value is the number of the item that can be built in the world
--          if table, consider these keys and values, rounding down at the end of the calculation
--          for the maximum number for all tribes together
--          .base = integer or nil
--              base number 
--              nil means 0
--          .max = integer or nil
--              maximum number even if calculation would be larger
--              nil means no limit
--          .min = integer or nil
--              minimum number even if calculation would be larger
--              nil means no limit
--          .turn = number or nil
--              increment limit by the value each turn
--              nil means no change
--          .globalTotals = nil or {[luaObject or "cities" or "population"] = number or nil}
--              for each luaObject in the world, increment the limit by the corresponding value
--              nil means 0
--              if unitType, increment by the number of units owned by all players
--              if improvement, increment by the number of cities that have that improvement among all players
--              if wonder, increment if the wonder is owned by any tribe
--              if technology, increment for each tribe that has the technology
--              if tribe, increment by value if the tribeObject is active in the game
--              if "cities", increment for each city in the game
--              if "population", increment for each population point of all cities in the game
--          
--          .activeWonders = nil or {[wonderObject] = number or nil}
--              if the wonder is built and it is not expired, add the increment
--          .discoveredTechs = nil or {[techObject] = number or nil}
--              if the tech is discovered by any tribe, add the increment
--          .trueFlags = nil or {[flagKey] = number or nil}
--              if the flag associated with flagKey is true, add the value to the production limit
--          .counterValues = nil or {[counterKey] = number or nil}
--              for each counter specified by counterKey, multiply the value of the counter by the
--              number specified, and add that product to the production limit
--          .customFunction = nil or function(tribe,item) -> number
--              if a function is provided, add the output of the function to the production limit
--
--      .globalJointMaxWith  = nil or {[luaObject] = number or nil}
--              each instance of luaObject in the table uses up a portion of the ownership
--              limit for the item in question, with that portion given by the value
--              e.g. unitTypeBuild[object.uSettlers.id] = {maxNumberGlobal = 6, 
--                  globalJointMaxWith = {[object.uEngineers]=2}}
--              and unitTypeBuild[object.uEngineers.id] = {maxNumberGlobal = 3,
--                  globalJointMaxWith = {[object.uSettlers] = 0.5}}
--              Here, the limit is 6 settlers, or 3 engineers, with an engineer using up 2 settler
--              allotments, and a settler using up 0.5 engineer allotments.
--              By default, the item we're checking if we can produce is given a cost of 1,
--              but we can specify a different number instead.  Here is another way to have
--              6 settlers or 3 engineers:
--              e.g. unitTypeBuild[object.uSettlers.id] = {maxNumberGlobal = 6, 
--                  globalJointMaxWith = {[object.uSettlers] = 1, [object.uEngineers]=2}}
--              and unitTypeBuild[object.uEngineers.id] = {maxNumberGlobal = 6,
--                  globalJointMaxWith = {[object.uSettlers] = 1, [object.uEngineers]=2}}
--


I think that's everything. Let me know if you run into difficulties.
 

Attachments

@Prof. Garfield
I really appreciate the example and files posted. It has got my head thinking for applications, especially when I do the next update of Imperialism. The mass flood of naval vessels was in need of culling. :)
Leave it with me - I'll do the next Overlords Max update this weekend, run some play tests and then see if there is a call to cut back on armies, etc. :)
 
Head up, chaps! The battle erupts once more!
art-soldaty-kohimskaya-bitva-516.jpg
Version 2 is now ready...!

I've just completed the updated files and attached a new zip! I recommend a new playthrough.
Just overwrite the old files, or clear the folder to a backup, and post all the v3 files afresh.

Sounds are the same.

Download link:
 
Last edited:
Shatner, the greatest Canadian ever - He even looks good in the uniform of evil!
Certainly pulled it off better than Harrison Ford's awkward impersonations in Raiders of the Lost Ark and Last Crusade.
 
I think this will be the last update for this round. The Tripartite Pact was cancelled in July 1945, meaning the German Reich and Japanese Empire are at a state of war.

Fronts, Dec.’45:

Indochina—the Germans have pushed British out of India, the Japanese out of Burma and Thailand and were closing in on Laos and Cambodia.

Northern Rhodesia: Panther IIs sent from the German Congo were intercepted by a South African artillery battery. The colonial outpost at Winchester (founded in the 1940s) is close to being overrun.

American Far West: the Americans only hold the cities past the Rockies and after a thrust north took Vancouver. Aside from that, all of Canada and the continental United States is under German occupation.

Japan: German paratroopers dropped on Sapporo, Akita after a prolonged Luftwaffe campaign.

Letting the AI take the wheel for 6 months to see what happens, AI Germany managed to take Los Angeles in May '46 and other parts of Japanese Mongolia as well as northern Vietnam, but also lost the occupied parts of the Japanese home islands. A poor showing; I would have managed much better. :)
 
I started a game as Japan, but as soon as I attacked a Chinese unit during the first turn, the neutrals, Americans, and British all declared war on me. If I let the Chinese attack, then the war happens normally. Next time around I’ll give it another fresh start and see if it happens again.

But until then, I’m back to playing Uncle Joe.
 
I started a game as Japan, but as soon as I attacked a Chinese unit during the first turn, the neutrals, Americans, and British all declared war on me. If I let the Chinese attack, then the war happens normally. Next time around I’ll give it another fresh start and see if it happens again.

But until then, I’m back to playing Uncle Joe.
Dogpiled by both Western Allies right in 1940. No Pearl Harbour required! Chiang must be a lot more popular on the global stage, this game... :P
 
Dogpiled by both Western Allies right in 1940. No Pearl Harbour required! Chiang must be a lot more popular on the global stage, this game... :p
An aside, but I had a book called The Two Worlds of Jim Yoshida which tells the story of an American-born Japanese man who sailed to Japan before the war to deliver some ashes to the family grave when WWII breaks out. Yoshida, despite being an American English-speaker, is conscripted into the IJA and forced to fight in China.

I mention this because even in 1940-41 there was still, though tense, a state of non-belligerency between the two.
 
I started a game as Japan, but as soon as I attacked a Chinese unit during the first turn, the neutrals, Americans, and British all declared war on me. If I let the Chinese attack, then the war happens normally. Next time around I’ll give it another fresh start and see if it happens again.

But until then, I’m back to playing Uncle Joe.
Oops...I better take a look at the Chinese diplomacy settings in Lua. I might have it that only the Neutrals can speak to others.

I've been messing with the Panzer vs Red Army tank dynamic, and playing on recommended difficulty has interesting results. The AI is much more pro-active at this setting, and the German tanks have more durability. On the other hand, the Soviets are
piling on the units, but killing one Panzer for about 2-3 units...A good ratio! The later units for Germans and Russians are both hardcore. So it should be a good bloodbath in the East...Which is what we want!

The US/Brits are storming all over the map, I reckon this difficulty setting must have some triggers where the AI goes much more all out, as I am noting the battles are much more intense. I'll be playing exclusively at recommended setting...Just wonder what the ultimate setting is like...Is anyone a bad enough dude to try it? :D In the meantime here is a little patch, with the tank changes I mentioned...I'll look into the diplomacy for China too.

PATCH ADDED! Please drop this zip contents into your folder and over-write.
Should fix up the diplomacy - Neutrals can only talk to the "bad guys". I made a KMT partisan attack first, so the Allies cannot get involved,
and Japan calling in Germany was cancelled out too. So the Sino-Japan war should run normally now. New play through is recommended.
 

Attachments

Been very busy at work, but I am continually editing the rules. I have got a brand new version of the unit stats coming up, more based on vanilla values, as the AI will use the units fully if they are close to the classic stats.

For some reason, I won the game in 1947, due to the "unified field theory" being found...Wow! Quite a breakthrough in the 2nd world war! I will find out what triggers this message and see if it can be edited to fit the mood. :)
 
So I have finished my new playtest of version three. It is 1950 and the Allies and Soviets are engulfed in never-ending war. Happy ending! But, playing as the Neutrals, I am allied with everyone, dropping stacks of MRL trucks and super battleships to the USA and British, and helping them push forwards with their conquest. The nazis were crushed utterly in 1947, and the Chinese are obliterating the Japanese Empire, with my help of medium tanks and heavy bombers! Being able to gift your friends techs and units adds a really fresh aspect to the game. At the end of this playthrough, my civ is 250K rich in gold, while mass-building units for the Allies and directing the course of the global battle. Illuminati confirmed! :)
1694243492381.png

The new unit values work great, tough units hold out for longer, and the formerly static types now make defensive strikes, with fighters also appearing, so the AI is building them, as long as they are set to attack. The early-mid fighters are not over-powering now, and the big bomers are still tough, but not invicible. I want Lancasters and B-29s to be a dreaded enemy, but one that can be stopped with enough AA defence. So I think this project is nearing a state where I can think about calling it "semi-complete". With any new bugs to be fixed, of course. I will keep updating this thread, and I hope people will try out version three when I post it very soon. It's a fresh experience from the previous ones. Playing at the 3rd hardest difficulty is very interesting...The AI is merciless. And that is what we want! Still trying to get the AI to attack each other with missile-type units...They attack the player, tho - So that at least is a step forward. I'll post v3 soon, stay tuned.
 
I‘m playing the last version posted here as the Chinese Nationalists. It is mid-1942 and I’ve taken back Wuhan, the southern coast, Nanking, Shanghai, and am barreling towards Peking and then on to Manchuria and Korea.

Strategy: salami tactics, no wide fronts! Gather up all the forces I can, KMT army and artillery units, and slowly move them towards one Japanese city at a time. I also had a large enough force to garrison the southern coast to keep the Japanese from spawning any ground forces when they went for Hong Kong. I hope Britain was happy!

I was also lucky to get my two freighters full of goods out to Australia before the Japanese launched their invasion of the Philippines, otherwise all that gold (and more importantly, research) would have been deep sea merchandise netting a total of 0 trade arrows.

Elsewhere in the world, the Russians and Germans are fighting it out in the Ukraine and Byelorussia with a few cities changing hands repeatedly. Finland has been crushed, liberated, and crushed again.
 
I'm looking forward to doing a new playthrough with the new unit stats from the start. I might play as the USSR...The medium Panzers now have x3 movement, and the Tiger-type heavies have
all-terrain x1 movement. I want to have the Germans with fast-moving armour columns, crashing against the tougher stats of the Russians. I am hoping for nail-biting battles...We shall see!

I've attached the new rules...Try it if you dare! :D
 

Attachments

Old version update on my Nationalist Chinese game.

中華民國萬萬歳!
三二年十月十日
(Long live the Chinese Republic!
October 10, 1943)

KMT armies march on TOKYO during the Japan campaign which started after the liberation of Korea in February. While Japanese battleships were scuttled in the bay of Shanghai after repeatedly attempting a landing to retake the city after two years, Chinese landing craft made an assault on Shimonoseki near Fukuoka, pushing out the Japanese garrison before crossing to Shikoku, splitting the country in half. While a small detachment was sent to Kyushu to end resistance on the southern island, a large invasion force, including U.S.-made tanks and artillery, marched towards Japan’s second city of Osaka.

In a fanatical response Tojo declares war on the Soviet Union, sending a massive force to try and rout the Chinese garrisons in Manchuria after wiping out Stalin’s thin Pacific defensive lines. While the Soviets have lost control of their major cities, Stalin is sending wave after wave of Red bombers to recapture the territory. However, the Generalissimo in China will not surrender one inch to the Japanese bandits and sends his armies northward from Peking and Mukden to relieve the local garrisons, as well as enough air support to keep the obsolete and fast-decaying Imperial air force from making any headway.

Other fronts: the Nazis have lost France, North Africa, and Norway to the W. Allies. Italy is also on the verge of collapse. Romania is under Soviet occupation. The once-great cities of Minsk and Odessa have been leveled flat by intense fighting.
 
Exciting report! The KMT is on the rise - May the glorious final victory come soon!
 
Status
Not open for further replies.
Back
Top Bottom