OCMOD4

Discussion in 'Modding' started by Ftoomsh, Nov 30, 2019.

  1. Ftoomsh

    Ftoomsh Well-Known Member

    OCMOD4 is an experimental mod, publicly available, done at the request of Daddio. The key features of OCMOD4 so far are;

    (1) No firing though friendly troops (same as the new OCMOD3).
    (2) Only the front 3 ranks of formations will fire (same as the new OCMOD3).
    (3) Formations changed to suit line tactics (same as the new OCMOD3).
    (4) NO upgrades at all in barracks, stables and depots (different from OCMOD3).
    (5) NO upgrades in the Academy (different from OCMOD3).
    (6) Higher costs of military units as upgrade costs are removed (different from OCMOD3).

    What's the idea behind OCMOD4? The idea is to release the player from upgrade clicking and trading clicking (probably best played with no market). The player can then spend more time on military tactics, especially linear tactics and flanking which both become more important with the firing changes.

    Next Goals

    My next goals for OCMOD4 are first to prevent unit bunching, especially in attack, and also to prevent formation stacking. So far, I am having a lot of trouble understanding moveable unit radius and moveable unit collision in terms of how it is implemented in vanilla. As usual, the code seems to be spread all over the place in the scripts and there are obviously different rules for spacing and different rules for collision depending on units and unit situation. For example when units bunch in attack they act like they require no unit radius at all (or maybe just one pixel). Another example, formation spacing is not set by collision, otherwise other friendly formations could not be stacked on top of the first formation.

    Secondly, I will look at morale but first I would like to diminish unit bunching and formation stacking as much as possible without excessively affecting unit pathing, formation movement etc. Preventing even friendly formations passing though each other, for example, would be great, at least for close order formations.

    However, I am a bit stuck on these goals. I think I need some hints from better programmers. Help! :eek:

    I should mention that State vs Country has a great innovation to prevent player-ordered bunching in attack. The attack button moves the formation forward in correct formation shape and spacing even if the attack icon is clicked on an enemy troop or formation. Can I ask where and how in scripts this is implemented? This is a great improvement. However, it still does not solve (so far as I can tell) engine auto-attack effects when units are in attack range. This still generates bunching. I know the following question has been asked before, but I don't recall the answer. How does one turn off peace mode when in-game-editor testing State vs Country Plus?
     
    Last edited: Dec 13, 2019
    Loner likes this.
  2. Loner

    Loner Active Member

    This is exactly my thinking, my '19th Century Mod' has the same basics with no Barrack upgrades and limited Academy upgrades for the same reason you mention. If you want I can PM you what I have done so far for you to look at.;)
     
  3. Ftoomsh

    Ftoomsh Well-Known Member

    Sure, you can PM me. While a mod is still in test you can always put it on Steam as a private mod which gives access to Steam friends only.

    To me, it's important to work in no-fire-through-friendlies, anti-bunching/anti-stacking and morale/veterancy at some point. Because I am not a good programmer (just a parameter modder) I take a long time to figure these sort of things out. Or I have to copy ideas from other modders. Cavalli paved the way for no-fire-through-friendlies. I tested a different variant of his approach and came up with the idea (with helpful suggestions probably, I forget) of lifting the "y" origin of the shot just enough that ranks 2 and 3 could fire (over the heads of ranks in front while bfriendonline checking was happening.

    I've seen some great modding work done by accomplished programmers. It's always puzzled me that anti-bunching/anti-stacking and morale haven't received more attention. That's why I am hoping to get some hints in that direction to aid my search for the relevant routines. Ebel has sent me some files on a possible approach to morale in the relevant game engine. However, as yet I do not understand those files. Meanwhile, after getting 3 rank fire, I have fixed on bunching and stacking as in more desperate need of a fix. Bunching and stacking are bugs not features in my book. Morale is a nice to have add-on that may have to wait a bit... although whichever turns out easiest to fix will get done first. ;)
     
    Last edited: Nov 30, 2019
  4. Loner

    Loner Active Member

    I have no code writing ability at all, Awar has helped a lot, all I can do is delete what I don't need and art work to a reasonable, but not brilliant, standard.
     
  5. Ftoomsh

    Ftoomsh Well-Known Member

    UPDATE on OCMOD4

    This is still a work in progress. Here is the latest;

    (1) Most of the upgrades have been removed, even economy upgrades. The military and economy have been re-balanced to work without upgrades. Fine re-balancing will be ongoing.
    (2) Stables are a little cheaper and easier to get in 17th C. This means 17th C stables and cavalry numbers balance more sensibly with 17th C barracks and infantry numbers.
    (3) All Muskets (friend or enemy) now cannot shoot through any stone walls or buildings. Hat tip to General WVPM and Awar for helping me with this. Also to Ebel for unit box height data.
    (4) The AI is untouched as yet and has been broken by the extensive changes in OCMOD4. My intention is to finish the basic mod design, all other code and the balance testing before fixing the AI.
    There is no point in fixing the AI until the rest of the game is finished and balanced. Unfortunately, you can't game test this mod yet except in multiplayer (or in the game editor for plain tests).

    Ideas behind this mod are;

    (1) Remove the upgrades and change the focus to strategic and tactical management and coordination of formations of the army. (Almost finished removing upgrades).
    (2) Have realistic firing, with no shooting thru friendlies and no shooting through solid structures except wood walls, to enable more realistic tactics. (Substantially solved. Might need further tweaks.)
    (3) Prevent unit bunching and formation stacking (not solved yet).
    (4) Introduce a morale system (not solved yet).

    Please try it, if it sounds interesting to you.
     
    Loner and Awar like this.
  6. Ftoomsh

    Ftoomsh Well-Known Member

    I am thinking that OCMOD4 needs a peasant limit. However, I am also thinking that an absolute limit is a mistake. Rather, I would prefer to make the peasant limit about 15% (or even 10% if possible) of the population limit set in Options. For example, if a multiplayer game had a population limit of 5,000 set then the peasant limit would be 500 or 750 at the most. The idea would be to leave most of the population limit for troops. This would require re-setting peasant production rates of course. When full population is reached, the ability to support the army should be stretched to the limit. This would give a knife-edge criticality to keeping peasants safe and deter the use of them in fights away from base. No fire through friendlies also does that too. Peasants are less useful as bullet absorbers. To go along with that I would probably cap resource accumulation for Eu nations at 100,000 per resource except gold. Other nations would probably need different caps and even caps on gold as their economies and costs work differently. This sort of model would not support navies. OCMOD4 is really just a land battles mod. At most I would permit landing ships and gun-boats on water. Yachts are the closest thing to gunboats in vanilla.
     
  7. Ftoomsh

    Ftoomsh Well-Known Member

    Deleting what you don't need in upgrades leads to breaking the AI as I found out. The AI is not my priority yet but I tried a quick fix of the AI (just progresseconomicai.inc) but it was not as easy I thought it would be. I commented out all the references to TryUpgrade that I didn't need. I searched for logic where the AI depends on an upgrade to progress to the next stage and found what I could and dealt with it. Still the AI was broken and would not make more than 28 peasants. It would not make any military units and would not make a building past the barracks, on 5,000s start. I've put that issue aside for now. How has your mod affected AI?
     
  8. Loner

    Loner Active Member

    I didn't delete anything from progresseconomicai, it was just country.script and unit.script I was talking about, as far as I'm aware it hasn't had an affect on the A.I but I don't know for certain.
     
  9. Ftoomsh

    Ftoomsh Well-Known Member

    But you must have rewritten progresseconomicai to accommodate the new units. Otherwise, the AI would not produce them... or that's my guess.
     
  10. Loner

    Loner Active Member

    If you subscribe to my mod and compare with the vanilla there's not a lot of difference, Awar helped a lot but mainly just with Ukraine.
     
  11. Ftoomsh

    Ftoomsh Well-Known Member

    Yes, I have subscribed to your mod and had a try. Nice and smooth, good units. I guess you are adding more units as you go. High gold costs for units make sense with no upgrades. I will compare the AI scripts.

    Awar's AI for State vs Country Plus is a revelation. So very good. And the warprogress makes armies behave so much more intelligently. I am interested in AI theory but my programming skills are non-existent for that sort of work.

    Theory says that for units without upgrades, the defender will always have the advantage with more units at the battle (shorter lines of reinforcement) but that is with all else equal. With better AI like Awar's, surely no human can keep pace with the AI economy. Bigger economy = Bigger army. Hard to beat that with AI market trading like a fiend (I guess).
     
    Last edited: Dec 12, 2019
  12. Ftoomsh

    Ftoomsh Well-Known Member

    I sort of fixed my AI for 17th C but it still won't make 17th C pikes. I put a quick and dirty fix in so it at least made 17th C muskets.
     
  13. Loner

    Loner Active Member

    I'll have a look with my, definitely not, expert eye.:p
     
  14. Ftoomsh

    Ftoomsh Well-Known Member

    Yeah, it is weird. I had a look at the condition statements in progresseconomicai in case they affect economic progress in OCMOD4. You know, things like "if upgrade xyz done then make pikes". I found a few other cases that were stopping progress (because I have removed all upgrades) but still could not see what was stopping pikes being made. I did a quick and dirty fix as I said. I have not cleaned up the file at all and I just threw in a line to try 17th C muskets at a point where I thought it would work. It did.The assignment of the variable for 17thCinfantry (pikes) might be messed up or it might be something else.

    In the long run, I would like to do a lot more with AI. A no-upgrade mod is suited to scripted economic AI. It makes economic progress much more linear and obvious and thus straight-forward to script. This is assuming one is just scripting the economic AI part and not trying to make economic progress goal seeking. If I then copied and added Awar's war progress AI or something like it, if I could understand it, the mod would play very well with AI. I would have to check with Awar to make sure it was okay to use some of his ideas and some of his code for OCMOD4 AI.
     
    Loner likes this.
  15. Loner

    Loner Active Member

    Sorry Ftoomsh, tried a few things but no luck, beyond my ability I'm afraid.:(
     
  16. Awar

    Awar Well-Known Member

    For Ftoomsh!
    it is necessary to comment out the lines for the release of AI units
    progresseconomicai.inc
    [*] = ;procedure _ai_ProduceUnits(plind, cid, airole : Integer; var sid : String; count : Integer);
    [*] = ;begin
    [*] = ; var buildid : Integer = gPlayer[plind].aidata.buildlink[cid][airole];
    [*] = ; var id : Integer = gPlayer[plind].aidata.aiunit[cid][airole];
    [*] = ; _ai_SelectBuildingsWithId(plind, cid, buildid);
    [*] = ; var i : Integer;
    [*] = ; {for i:=gPlayer[plind].aidata.ailist.GetCount-1 downto 0 do // Important!!! Delete or comment
    [*] = ; begin
    [*] = ; var goHnd : Integer = gPlayer[plind].aidata.ailist.Get(i);
    [*] = ; var pobj : Pointer = _unit_GetTObj(goHnd);
    [*] = ; if (pobj<>nil) and (TObj(pobj).orders[0].itype=gc_obj_order_type_produce) and (TObj(pobj).orders[0].info.amount<>gc_obj_order_produce_infinite) then
    [*] = ; gPlayer[plind].aidata.ailist.Delete(i);
    [*] = ; end;}

    [*] = ; if (gPlayer[plind].aidata.ailist.GetCount>0) then
    [*] = ; begin
    [*] = ; var binfinite : Boolean = count<0;
    [*] = ; var inProduce : Integer = _ai_GetUnitCountInProduce(plind, cid, id);
    [*] = ; count := count-inProduce;
    [*] = ; if binfinite or ((count>0) and (inProduce<gPlayer[plind].aidata.ailist.GetCount)) then
    [*] = ; begin
    [*] = ; var plHnd : Integer = GetPlayerHandleByIndex(plInd);
    [*] = ; _unit_ProduceUnit(plHnd, gPlayer[plind].aidata.ailist, cid, id, count, true, true, true);
    [*] = ; end;
    [*] = ; end;
    [*] = ;end;
    [*] = ;
     
    Loner likes this.
  17. Ftoomsh

    Ftoomsh Well-Known Member

    By heavens, it works! I knew, or thought I knew, I was looking for a condition statement (an "if" most likely) that was attached or related to upgrades and pikes. But I never would have found that section and figured it for deletion. To be honest, I don't even understand that code properly.

    if (pobj<>nil) and (TObj(pobj).orders[0].itype=gc_obj_order_type_produce) and (TObj(pobj).orders[0].info.amount<>gc_obj_order_produce_infinite) then
    [*] = ; gPlayer[plind].aidata.ailist.Delete(i);

    Does this say?:

    If a given unit to be possibly produced is not nothing and the order is to produce it and the production order to produce it is not infinite then delete the order from the order list?

    However, I thought infinite production was ordered in progresseconomicai by putting a 0 (zero) in the tryunit parameter for continuous production.

    like _ai_TryUnit(plind, cid, gc_ai_unit_peasant, 0, False); which I have found sets infinite production like human players use.


    The 17th C pikeman seems to be the only unit set up for limited production by this statement:

    if (pikemanCount<=(36*7+gc_ai_max_guards)) then

    Does this have anything to do with the whole issue or am I off target? And why did removing upgrades mess with this?
    Apologies, the above questions show I am a parameter modder who doesn't understand code more complicated than if a>b then do x. When (a) is TObj(pobj).orders[0].itype and( x) is gPlayer[plind].aidata.ailist.Delete(i) then I get lost. :confused:
     
    Last edited: Dec 14, 2019
  18. Awar

    Awar Well-Known Member

    A programmer is a creative person. ;)
    This bug appeared in the first year of release of the game. That the changed in one place, and forgotten correct here.
     
  19. Ftoomsh

    Ftoomsh Well-Known Member

    MAKING EVERY UNIT USEFUL

    One of the things I have tried to do in OCMOD4 is make every unit useful. This means it should be to a player's advantage to produce it in some circumstances for some purposes. I've pretty well succeeded except for sharpshooters and dragoons. I am still thinking about them.

    17th C pikes - Useful early, especially in no or low peacetime games. Useful for players who want to rush headlong with little or nothing in the way of tactics. Strong enough to fight heavy horse on their own and in numbers.

    17th C swordsman - Useful because they can swarm muskets. Not so good against pikes and heavy horse.

    17th C muskets - For the player who plays a defensive campaign, not attacking early and building for the long term game. To fight early pike and sword rushes, the muskets need to be split into smaller formations which stand apart and take advantage of the longer musket range in OCMO4. Wooden fences or at least wooden fleches will assist plus heavy horse are needed to support them.

    17th C Heavy Horse - A must have in the 17th C as I have not found a way to really make 17th dragoons useful without having them defeat heavy horse too easily.

    17th C Dragoons - Not sure how to make these useful. They could be useful if made faster than heavy horse but not as fast as hussars. Then they could kite heavy horse. (Thinking about this and can do it with General WVPM's formation bonus system.)
    I am not sure how to directly make a unit faster. Maybe I should look at how they made clansmen faster than ordinary infantry.


    18th C muskets - Backbone of the army. Combine good production rate, good shot power and good bayonet power.

    Grenadiers - Elite units which produce slower than 18th C muskets. Will defeat equal numbers of 18th C muskets. Stronger shot and cold steel attack plus have the grenades as a bonus.

    18th C pikes - Occasionally useful after a huge battle has depleted army numbers . Can rapidly produce numbers, though not so rapidly as vanilla.

    18th C sharpshooters - Need to be given considerable extra range I think to improve these units. Still experimenting.

    18th C Cuirassiers - Combat enemy heavy horse and cuirassiers. Can roll up lines of infantry from the flank or even frontally sometimes.

    18th Hussars - Can roll up lines of infantry from the flank or even frontally sometimes. Can raid, capture and capture cannon.

    18th Dragoons - Again, can't find how to make these useful without making Cuirassiers or Hussars much less useful.

    Artillery - For destructive power at range against both troops and structures, obviously.
     
  20. Foeurdr

    Foeurdr Moderator Staff Member

    In my opinion XVIIth C. dragoon are more usefull at provoking the opponent into a fight or punishing an all pike army. They are here to pressure constantly the opponent and need to be used as a constant skirmishing units, I doubt they will shine in a direct full on confrontation bewteen two army, that the role of the heavy rider.
    So probably more of a situational unit but it certainly has its use.

    XVIIIth C. dragoon would be more difficult to make use of, pike army are a rarity at this stage and hussars would be better as a constant threat to the opponent base.

    OCMod doesn't have the possibility to play on the upgrade price to balance units so it can be a bit of a headache to adjust units with what little there is to Cossacks 3 battle system.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice