[TOT] &ToTPP with Lua : EpicWWiiEurope

creation diary
Spoiler :
Guess I found the issue :
The early file allocation is erased by the allocation of the "loading" function.

Thus, the allocation will have to be done at the beginning of the .Scn file (if new game) with specificities for the industries distribution
For now, I tricked it by putting the state allocation instead of the unserialization, then saving the file, allowing that right structure allocation to be serialized.

Removed that "trick", and the unserialize(buffer) is now providing the right state structure, removing the error.
 
Last edited:
creation diary
Spoiler :
So, industries synchronisation is done
(intitialisation/onbuild/unitdestruction/eachturntest/citytaken)

Took advantage to organize the first layer of state, initializing Ammo and Oil for civs.
In citytaken, guess i'll go for the loot of these on conquest !
 
Last edited:
creation diary
Spoiler :
So, Production Restriction is done, following :

1rst layer : Game restriction, mainly technologies & rules.txt civ restriction (eg French infantries are restricted to french civ)
2nd layer : Improvement restriction (eg palace needed to build diplomat)
3rd layer : "Colonial zones" specificities on infantries
4rth layer : Geographic zone restriction for nonMainCivInfantries
5rth layer : Core Zone restriction applied to MainCivUnits*

*Each civilisation start with territories considered as "core". In these lands are installed their industries, thus producing their own MainCivUnits.
Then, as an exemple,
if the German have an Plane Factory in Paris while France is french cored, the german may build french planes in it but not german planes.
In the mean time, Berlin, german cored, would be able to build german planes only.

It is planned to have cores a little dynamic, offering ability to convert occupied territory in core, taking more or less time, at the cost of more resistance and at the risk of failure ; yet with rewards if successful.
Occupied territory would oppose average resistance, coring one strong resistance, if sucessfully cored woudn't oppose resistance anymore, destroy other core claim, and allow its own MainCivUnits' production.
 
Last edited:
creation diary
Spoiler :
So, working on Oil production/Consumption system,

came to figure a unit oil value of 1K litre, estimating monthly* consumption of unit (at the exception of flying planes) as :
fighter (&light bomber) 12u
heavy bombers 120u
armored car and light tank 10u
medium tank and SPartillery 50u
heavy tank 90u
Capitalships 20u
Cruiser 10u
Destroyer 5u

Estimated number considering average fuel tanks of their kind, average number of vehicles in squadron or division, and ships as lonely, factored by their range of action, particulary for ships.
May have to be changed on balance purpose.

Oil production has more than 190 potential spot defined on map, visibles to players (Oil bonuses and coal bonuses with tech, both mine needed for exploitation), may be granted better production with some tech, to be seen.
It shall then be given to the defender of the tile, if nil to the owner of the neighbor city.
Oil bonuses shall gives more than the Coal ones anyway.
About the base number monthly* production, it is not yet defined, and shall be calculated/tested for balance. <- +(x2 ?) bonus production shall be given to non-neutral AI civ.

Oil is automatically looted from enemy stocks when a city is captured.

One with not bad enough relations with neutral shall be able to buy/sell oil from/to neutral at a floatting price (considering neutral stocks, to their benefit).



Missing oil would lead thirsty units to being unable to move !!


*one month being one turn.
 
Last edited:
The greater issue for the jagdwaffe wasn't really that their planes lacked fuel for combat operations (though that was a problem), but that there was simply no fuel whatsoever for pilot training. You'd have a situation where rookies were being clubbed left and right like baby seals by more numerous and far better trained Allied fighters from early 1944 onward.

I'm dealing with this in my scenario by having Luftwaffe units "weak" unless they're veteran, and having the Jagdfliegerschule improvement cost an arm and a leg (I'm still using gold as fuel). You're a bit more technically proficient with lua than me, so I'm sure you could come up with better solutions, but the bottom line is, a critical fuel shortage should lead to decreased performance.
 
Just thinking it further, onActivate allows a unit to have increased attack ratings. I suppose it could also check against the fuel level to reduce the attack rating if there isn't enough?
 
creation diary
Spoiler :
onActivate allows a unit to have increased attack ratings. I suppose it could also check against the fuel level to reduce the attack rating if there isn't enough?
Truth, I'm not sure yet about the best way to figure lack of fuel, on both a practical effect, moment of consumption, having the weight on game's performence in mind.

A consumption at the begin of a turn, imposing mobility restriction is a light and easy way to figure restrictions without having more than oil stocks stored in state.
Such a consumption solution also has the advantage to be easily shut off if changed for a finest one.


I could indeed change that movement restriction for a stored in state "figthing factor" variable as you says.

I wasn't fond of that solution howether, as it :
-gives advantage to human player, when AI wouldn't hide back its armored infantries behind an infantry/artillery wall and rather crash its units. The x2 bonus shall help ai yet not makes him unable to issue shortage if he plays dumb.
-get things harder to implement (and read later) on self propulsed artilleries and their ammo.



/
In the mean time, concluding some tests with the dialog object.
Rather sad with it at the moment, discovering quite some strong restriction uses. That's still a great tool one would have to adapt to.
 
Last edited:
In the mean time, concluding some tests with the dialog object.
Rather sad with it at the moment, discovering quite some strong restriction uses. That's still a great tool one would have to adapt to.

What are the issues you're finding?
 
creation diary
Spoiler :
What are the issues you're finding?
Its text section seems way more restrictive than civ.ui.text, can't manage to have a ReturnLine in it.
Furthermore, Options can't be integrated within text and is then always at the end.
 
Last edited:
Have a look at my text module (attached). If you just need general text windows and menus, it is probably sufficient. If you have very specific needs, it will at least give you an idea of how to do things.
Its text section seems way more restrictive than civ.ui.text, can't manage to have a ReturnLine in it.
Try using
-- text.addMultiLineTextToDialog(text,dialogObject) --> void
-- adds text that is in multiple lines to a dialog object,
-- performing all necessary splitlines

Furthermore, Options can't be integrated within text and is then always at the end.
I'm pretty sure this is hard coded into Civ II's menu box system, which Lua allows us to access. Every text box I can think of has a text section and then after it some options.

If you need to give more detailed descriptions of options, you could have a nested menu system, where selecting an option in the first menu brings you to a second dialog box that describes the option in more detail, and lets you confirm or choose a different option.
 

Attachments

creation diary
Spoiler :
you could have a nested menu system, where selecting an option in the first menu brings you to a second dialog box
Muhaha already builded this scenario menu this way :D !
Have a look at my text module (attached). If you just need general text windows and menus, it is probably sufficient. If you have very specific needs, it will at least give you an idea of how to do things.
I'll have a look at this for sure !
Truth, there's no specific need at the moment, as I'm orienting features with a growing knowledge and understanding of ToTPP Lua's possibilities.

The little sadness expressed about the limits of dialog doesn't change its value as a wonderful tool.
Just some excessives dreams and hopes cold-washed ;)
 
Last edited:
So, Oil system is full up, featuring allocation (to ajust production or price range easily, also adding production point), production at the begin of each turn, consommation following, and its secondary menu allowing for info, projection and exchanges with neutrals or allies (if conditions are met).
Added "Colonial" oil bonuses to Allied and French civs.

I'm thinking about features that could be added, namely :
-A third production source, namely Refinery improvement in cities, at 1/10th or 1/5th of the Oil bonus tile each.
-The ability to (under)sell Oil to civils in order to take some Oil out of the WorldMarket (and alter a little prices, to avoid deflation)
-Lack of Oil affecting related units power.

That would (or not) be for later anyway.
 
creation diary
Spoiler :
Going for the Ammo system,
i'm beginning with the cleaning. Rather than doing it once a turn, I'll launch it under onActiveUnit once each turn for each civ only, so it shouldn't ever be in situation to defend.
Rest is "classic" :)
 
Last edited:
creation diary
Spoiler :
Ammo (unlaunched) cleaning one a turn at each civ's turn in done.
Ammo creation is done, way more easy than feared.
Ammo destruction if winner + transmitting veteran to launcher is nearly done. (have an issue with the "no more fuel" pop up showing up. /edith no more muhaha)
IA Ammo creation is done
The ammo menu, similar to the Oil one, numbers being different is done.

Next is ... giving a new role to "material" unit.
 
Last edited:
creation diary
Spoiler :
giving a new role to "material" unit, which is buildable (at high cost) in any city without any tech needed.
I'm thinking of building a kind of "commercial weight" system, generating a commercial income (yeah, yeah, I played euIV, i recognize).

General Idea is :
1 Created "material" contribute to its Civ's Commercial Power :
a-once ? then kill at onBuild after contributing CCP, CCP is depleted each turn of like math.ceil(10%CCP) ?
b-EachTurn ? then CCP is re calculated each turn from 0 and "material unit" gives money if killed to killer.
2 Each CCP generate money (either the depletion from "1.a" solution, or a %from CCP from "1.b" solution
3 For each civ, generated money is shared between civs not at war with the generator :
a-generating civ included with a malus for it ?
b-generating civ excluded ?
The distribution beeing calculated by (civ CCP / Competiting civs CCPs sum)

material unit is at the moment buildable without condition, yet at heavy cost.
Should have like a "marketplace improvement" condition ? Cost lower if 1.a chosen ?

That would also need its own under menu next to oil and ammo ones :)

/ I thought about factorising civs exchanges costs by differences of CCP, yet realised I used gold as common exchange monney, making such idea irrelevant. Could be used in scenario having personalized monney for each civs, which won't be done here.
 
Last edited:
creation diary
Spoiler :
ccp system is done, system i find interesting (one way or another, maybe including a base value of total pop for each civ and/or features to influence it more) to include in some big mod, adding a commercial war dimension to gameplay.

I'm then going on units special bonuses against some other units with or without technologies. (Infantires vs tank, infantries vs infantries, armored cars vs infantries, armors vs armored cars, antitank against armors)
Studying the unit object websheet, i realised it would be a little trickier than expected.

Guess a table with "unittype stats table(att, def & firepower)" generated at "LoadedGame or LoadedScenario" used to reinitialise at the beginning of "unitKilled" all "unitTypes values" shal do the job,
with uniTypes values changed under condition in "onResolveCombat" ?
 
Last edited:
creation diary
Spoiler :
Bonuses are done, next work is on the Planes fights :

-planes against planes work the same as usual done
-planes against ground units are bombing it, thus won't take damage directly from the ground units. done
__+ground damage against the bomber serves to define the end of the unit bombardment. done
__+while it is (unit) bombing or fighting, the plane may take (hidden) damages from nearby AAcanons and fighters, even to its death.
__+fighters going against such planes may take damages too, even to their death.
__+A "strategic menu"* shall propose choices about fighters intervention, like "never", "if fully healed" or "always"


*Shall be divided to propose choices too about artilleries defensive behaviour, like "sleeping" (like usual, saving ammo) or "actives" (stacked artillery uses ammo to support defending unit above it)
 
Last edited:
I'll have a little work on crash sounds and on the menu left, rest is done and functionnal.
It is presented here, and one shall consider balance isn't found at the moment in this exemple :

Youtube video link

I'd like to catch attention of @Prof. Garfield on this point, as this could open the path (if not already done) to the wish of some read on the forum, having an "uncomplete assault" system with retreats, guerillas, surroundings and others.
This alternative fight is nowhere near that of course, yet seems to demonstrate the ability to develop it thus add it (no issue if later indeed) in the Template, isn't it ?

By the way, I simply build that ugly video using Win10 tool. Maybe some more versed in Lua, civ2 and scenario design may build such little videos to advertise Lua uses in civ2 and once avaible the template ?
 
I'd like to catch attention of @Prof. Garfield on this point, as this could open the path (if not already done) to the wish of some read on the forum, having an "uncomplete assault" system with retreats, guerillas, surroundings and others.

Am I correct in guessing that you re-create the 'loser' unit after combat, if the unit didn't actually get defeated? That method wasn't really explored in Over the Reich, since we don't have access to the variable governing how many turns the unit has been in the air (this is the same variable that controls how much work a settler has done, and what the caravan commodity is), and turns aloft is very important in Over the Reich.

This alternative fight is nowhere near that of course, yet seems to demonstrate the ability to develop it thus add it (no issue if later indeed) in the Template, isn't it ?

It would make a lot of sense to add this to the template in some way, but I just hadn't thought of that, since the OTR 'survival' of battle groups is a bit specific to the scenario.

The General Library already has a replaceUnit function, which should do much of the work.

By the way, I simply build that ugly video using Win10 tool. Maybe some more versed in Lua, civ2 and scenario design may build such little videos to advertise Lua uses in civ2 and once avaible the template ?

@JPetroski did stuff like that a little while ago. I was planning on doing some videos related to the template once it is completed.
 
Back
Top Bottom