189 Open Daily games
0 Open Realtime games
    Pages:   12   (2 in total)
  1. #1 / 27
    Shelley, not Moore Ozyman
    Rank
    Brigadier General
    Rank Posn
    #38
    Join Date
    Nov 09
    Location
    Posts
    3461

    Based on recent experimentation (see thread below for details), it appears that auto-neutral factories are treated differently than other factories.  It appears that they dominate other factories, maybe they are  applied last, or maybe they simply dominate, but usually factories are triggered in alphabetical order.  This alphabetical ordering is what allows map designers to do a lot of the fancy stuff with factories, and by not having auto-neutral factories treated the same it makes it impossible to use them to turn on/off territories.

    http://www.wargear.net/forum/showthread/4026/on_amp;_off_board_territories_with_no_abandon_and_no_capital_on_board

    I realize this is not necessarily a bug,  but if it's a relatively simple change, it would open up a lot of possibilities for map makers if all factories (regardless of type) were handled as a group and ordered by their names.


  2. #2 / 27
    Commander In Chief tom tom is offline now
    WarGear Admin tom
    Rank
    Commander In Chief
    Rank Posn
    #753
    Join Date
    Jun 09
    Location
    Posts
    5652

    Yes, that's by design.

    Step 1: Loop through all the factories and build a list of auto assign factories and factory unit bonuses

    Step 2: Loop through all auto assign factories and update board state

    Step 3: Loop through all factory unit bonuses and update boardstate.

    It's done this way to prevent infinite loops occurring.

     

    Edited Sat 21st Mar 08:03 [history]

  3. #3 / 27
    Standard Member Korrun
    Rank
    Brigadier General
    Rank Posn
    #74
    Join Date
    Nov 12
    Location
    Posts
    842

    It would be nice in Step 2 if there were a series of auto-capture and auto-neutral factories that each one would process the ownership change and then eliminations are considered after the end of Step 2.

    The specific issue is:

    Auto-neutral factory 'A' neutralizes a player 1's last capital then auto-capture factory 'B' auto-captures that same capital for player 1. The desired outcome is that player 1 is not eliminated immediately upon activation of factory A.


  4. #4 / 27
    Commander In Chief tom tom is offline now
    WarGear Admin tom
    Rank
    Commander In Chief
    Rank Posn
    #753
    Join Date
    Jun 09
    Location
    Posts
    5652

    Korrun wrote:

    It would be nice in Step 2 if there were a series of auto-capture and auto-neutral factories that each one would process the ownership change and then eliminations are considered after the end of Step 2.

    The specific issue is:

    Auto-neutral factory 'A' neutralizes a player 1's last capital then auto-capture factory 'B' auto-captures that same capital for player 1. The desired outcome is that player 1 is not eliminated immediately upon activation of factory A.

    That would be a significant change to the game engine logic - in all situations, if a player has no territories at any point in time then an elimination is enforced. I'm not convinced that changes this would be desirable!


  5. #5 / 27
    Standard Member Korrun
    Rank
    Brigadier General
    Rank Posn
    #74
    Join Date
    Nov 12
    Location
    Posts
    842

    Then would it be possible to have a loop checking for final ownership? So that if there is a sequence of factories A, B, C, and D where each factory is either an auto-neutral or auto-capture that only the final factory in alpha-numeric order changes the ownership?


  6. #6 / 27
    Shelley, not Moore Ozyman
    Rank
    Brigadier General
    Rank Posn
    #38
    Join Date
    Nov 09
    Location
    Posts
    3461

    tom wrote:
    Korrun wrote:

    It would be nice in Step 2 if there were a series of auto-capture and auto-neutral factories that each one would process the ownership change and then eliminations are considered after the end of Step 2.

    The specific issue is:

    Auto-neutral factory 'A' neutralizes a player 1's last capital then auto-capture factory 'B' auto-captures that same capital for player 1. The desired outcome is that player 1 is not eliminated immediately upon activation of factory A.

    That would be a significant change to the game engine logic - in all situations, if a player has no territories at any point in time then an elimination is enforced. I'm not convinced that changes this would be desirable!

     

    I think there is something we are still not understanding.  Even if every auto-capture is applied, and then capital elimination is applied after each step, it should still be possible to do what we want with a second capital, but it doesn't work.

    i.e.

    Player owns two capital territories - Capital A & Capital B.

    Factories should fire like this:

    1) Capital A - Auto-neutral (still alive, because you have a second capital).

    2) Capital A - Auto-Capture (now have 2 capitals again.)

    3) Capital B - Auto-neutral

    4) Captial B - Auto-capture.

     

    At every point the player has control of at least 1 capital, but in my test game i was still eliminated on step 3.  In the history when step two occurs, it says Ozyman conquered territory, but it doesn't change my color, and then when step 3 is applied I get eliminated:

    http://www.wargear.net/games/player/428774

    http://www.wargear.net/games/player/428774?player=flash


  7. #7 / 27
    Standard Member Korrun
    Rank
    Brigadier General
    Rank Posn
    #74
    Join Date
    Nov 12
    Location
    Posts
    842

    Good point. Forgot about that.


  8. #8 / 27
    Premium Member Kjeld
    Rank
    Major General
    Rank Posn
    #15
    Join Date
    Nov 09
    Location
    Posts
    1340

    Is it correct that factory bonuses are applied in aggregate, as opposed to sequentially?

    Take this situation. A player has a single capital with a unit max of 4 (and currently 4 units), and which is also a standard factory on itself for +3. The player also controls 4 other standard factory continents, each of which is a -1 on the capital. If the bonuses are applied in aggregate, then 3 - 4 = -1 factory bonus, so 4 - 1 =3 units left on the capital and the player is still alive. However, if the bonuses are applied in sequence, then 4 + 3 maxes out at 4, and 4 - 1 - 1 - 1 - 1 = 0 and the player is eliminated.

    In this game, http://www.wargear.net/games/player/423874, this exact situation happened to Korrun, but he survived. So I assume that the factory bonuses are applied in aggregate?


  9. #9 / 27
    Shelley, not Moore Ozyman
    Rank
    Brigadier General
    Rank Posn
    #38
    Join Date
    Nov 09
    Location
    Posts
    3461

    That's a really good question.  I think another way to phrase it is, "Are territory maximums applied after each factory, or only at the end of all factories."

    If Tom is up for it, sharing the actual code that applies factories would do the most to disambiguate how they work.


  10. #10 / 27
    Commander In Chief tom tom is offline now
    WarGear Admin tom
    Rank
    Commander In Chief
    Rank Posn
    #753
    Join Date
    Jun 09
    Location
    Posts
    5652

    Ozyman I agree that shouldn't happen in theory so it does sound like a bug. Let me do some more testing my side.

    I'm fine to share the code but it's rather complex and the function that calculates bonuses / factories now runs to 400 lines. I'll try and distil it down to pseudo-code so it's understandable.

    Kjeld - yes, factory bonuses are calculated in aggregate in the first loop then applied in the third loop. Is that a problem do you think?


  11. #11 / 27
    Premium Member Kjeld
    Rank
    Major General
    Rank Posn
    #15
    Join Date
    Nov 09
    Location
    Posts
    1340

    tom wrote:

    Kjeld - yes, factory bonuses are calculated in aggregate in the first loop then applied in the third loop. Is that a problem do you think?

    It's not a problem so long as it is clear to board designers that that is how the system works. I for one (and I think some others as well) assumed that factory are assigned sequentially, and this led to some problems like that which I described above (my Lorax board, actually, probably doesn't quite work as I intended for precisely this reason, come to think of it).


  12. #12 / 27
    Commander In Chief tom tom is offline now
    WarGear Admin tom
    Rank
    Commander In Chief
    Rank Posn
    #753
    Join Date
    Jun 09
    Location
    Posts
    5652

    OK so Ozyman re: http://www.wargear.net/games/player/428774 I don't think it was a bug in the engine logic, it's just a bug in the way the log file represents the code. It was showing in the log that this step took place:

     2) Capital A - Auto-Capture (now have 2 capitals again.)

    Actually this never happened. In fact what happens in that game (and I've fixed the log recording and display bug and restarted the game to show this) is that steps 1 and 3 happen sequentially so the player is eliminated correctly.


  13. #13 / 27
    Commander In Chief tom tom is offline now
    WarGear Admin tom
    Rank
    Commander In Chief
    Rank Posn
    #753
    Join Date
    Jun 09
    Location
    Posts
    5652

    Also this is from an older thread on the continent / factory workflow:

    1. Loop through all continents

    For each continent check to see whether the player owns the continent.

    If the player owns the continent, check to see whether this continent has a factory. If it does, add it to the list of factory bonuses.

    Now check to see if the player owns the factory territory, if they don't and the factory is an auto-assign type (AutoCapture, AutoNeutral) then add this territory to the list of territories to auto-assign to the player / neutral.

    If continent does not have a factory then add the continent bonus to the player's reserves.

     

    2. Loop through list of territories to auto-assign to the player / neutral

    Update ownership of territory

    Check to see if this results in an elimination of a player by capturing their final capital, if so process capital elimination

    Check to see whether this resulted in the player being eliminated

     

    3. Loop through the list of factory bonuses

    Check the bonus will not exceed territory maxes / mins and apply change to board state

    Check for abandonment of territory (if this was a negative factory) and abandon is on

    Check to see if this abandonment resulted in the player being eliminated

    Check to see if this abandonment resulted in a player's last capital being destroyed

     

     


  14. #14 / 27
    Premium Member Kjeld
    Rank
    Major General
    Rank Posn
    #15
    Join Date
    Nov 09
    Location
    Posts
    1340

    Thanks, tom. I've also added this explanation of how the game engine applies factory effects to the wiki page on factories, so we'll have it available easily for future reference.


  15. #15 / 27
    Standard Member Korrun
    Rank
    Brigadier General
    Rank Posn
    #74
    Join Date
    Nov 12
    Location
    Posts
    842

    tom wrote:

    Now check to see if the player owns the factory territory, if they don't and the factory is an auto-assign type (AutoCapture, AutoNeutral) then add this territory to the list of territories to auto-assign to the player / neutral.


    Is this what is causing the different than expected outcome? If you own the territory at the beginning of your turn then auto-capture doesn't get triggered? I would expect if there are several auto-capture and auto-neutral factories that the final one in alpha-numeric order would determine ownership of the territory in question.

     

    Possible solution (and adds some additional functionality that I would like to use on my own boards):

    New factory type, AutoRevertOwnership (or something), any AutoCapture or AutoNeutral factories that target the same territory as the AutoRevertOwnership have no affect on the ownership of the target territory.


  16. #16 / 27
    Commander In Chief tom tom is offline now
    WarGear Admin tom
    Rank
    Commander In Chief
    Rank Posn
    #753
    Join Date
    Jun 09
    Location
    Posts
    5652

    Korrun wrote:
    tom wrote:

    Now check to see if the player owns the factory territory, if they don't and the factory is an auto-assign type (AutoCapture, AutoNeutral) then add this territory to the list of territories to auto-assign to the player / neutral.


    Is this what is causing the different than expected outcome? If you own the territory at the beginning of your turn then auto-capture doesn't get triggered? I would expect if there are several auto-capture and auto-neutral factories that the final one in alpha-numeric order would determine ownership of the territory in question.

    No, that condition doesn't apply to AutoCapture territories.

    Is there a board (preferably a simple one) where this doesn't work as expected? I can step through the logic to make sure it's working correctly.


  17. #17 / 27
    Standard Member Korrun
    Rank
    Brigadier General
    Rank Posn
    #74
    Join Date
    Nov 12
    Location
    Posts
    842

    http://www.wargear.net/games/view/429712

    That does appear to be the issue.

    A and B start out owned. C and D start out neutral. 8 factories in this order:

    1) neutralizes A

    2) autocaptures A

    3) autocaptures B

    4) neutralizes B

    5) neutralizes C

    6) autocaptures C

    7) autocaptures D

    8) neutralizes D

    Afterward, A, B and D are neutral and I own C. I would expect to also own A.

    Edited Thu 26th Mar 23:27 [history]

  18. #18 / 27
    Enginerd weathertop
    Rank
    Brigadier General
    Rank Posn
    #65
    Join Date
    Nov 09
    Location
    Posts
    3029

    tom wrote:

    Also this is from an older thread on the continent / factory workflow:

    1. Loop through all continents

    For each continent check to see whether the player owns the continent.

    If the player owns the continent, check to see whether this continent has a factory. If it does, add it to the list of factory bonuses.

    Now check to see if the player owns the factory territory, if they don't and the factory is an auto-assign type (AutoCapture, AutoNeutral) then add this territory to the list of territories to auto-assign to the player / neutral.

    If continent does not have a factory then add the continent bonus to the player's reserves.

     

    2. Loop through list of territories to auto-assign to the player / neutral

    Update ownership of territory

    Check to see if this results in an elimination of a player by capturing their final capital, if so process capital elimination

    Check to see whether this resulted in the player being eliminated

     

    3. Loop through the list of factory bonuses

    Check the bonus will not exceed territory maxes / mins and apply change to board state

    Check for abandonment of territory (if this was a negative factory) and abandon is on

    Check to see if this abandonment resulted in the player being eliminated

    Check to see if this abandonment resulted in a player's last capital being destroyed

     

     

    do we have this (or any other info in this thread) captured on the wiki for factories??

     

    I'm a man.
    But I can change,
    if I have to,
    I guess...

  19. #19 / 27
    Enginerd weathertop
    Rank
    Brigadier General
    Rank Posn
    #65
    Join Date
    Nov 09
    Location
    Posts
    3029

    Kjeld wrote:

    Thanks, tom. I've also added this explanation of how the game engine applies factory effects to the wiki page on factories, so we'll have it available easily for future reference.

    nevermind...:D

    I'm a man.
    But I can change,
    if I have to,
    I guess...

  20. #20 / 27
    Commander In Chief tom tom is offline now
    WarGear Admin tom
    Rank
    Commander In Chief
    Rank Posn
    #753
    Join Date
    Jun 09
    Location
    Posts
    5652

    Korrun wrote:

    http://www.wargear.net/games/view/429712

    That does appear to be the issue.

    A and B start out owned. C and D start out neutral. 8 factories in this order:

    1) neutralizes A

    2) autocaptures A

    3) autocaptures B

    4) neutralizes B

    5) neutralizes C

    6) autocaptures C

    7) autocaptures D

    8) neutralizes D

    Afterward, A, B and D are neutral and I own C. I would expect to also own A.

    Sorry, you are right, that is the issue! The territory ownership check means the AutoCapture doesn't get added to the list.


You need to log in to reply to this thread   Login | Join
 
Pages:   12   (2 in total)