Jump to content

Introducing the Official community mod for 0 A.D. Empires Ascendant


wraitii
 Share

Should these patches be merged in the Community Mod? II  

47 members have voted

  1. 1. Add Centurions: Upgradable at a cost of 100 food 50 metal from rank 3 swordsmen and spearmen. https://gitlab.com/0ad/0ad-community-mod-a26/-/merge_requests/27

    • Yes
      34
    • No
      6
    • Skip / No Opinion
      7
  2. 2. Alexander - Remove Territory Bonus Aura, add Attack, Speed, and Attack de-buff Auras https://gitlab.com/0ad/0ad-community-mod-a26/-/merge_requests/26

    • Yes
      26
    • No
      9
    • Skip / No Opinion
      12
  3. 3. Unit specific upgrades: 23 new upgrades found in stable/barracks for different soldier types. Tier 1 available in town phase, tier 2 available in city phase. https://gitlab.com/0ad/0ad-community-mod-a26/-/merge_requests/25

    • Yes
      25
    • No
      18
    • Skip / No Opinion
      4
  4. 4. Add a civ bonus for seleucids: Farms -25% resource cost, -75% build time. https://gitlab.com/0ad/0ad-community-mod-a26/-/merge_requests/24

    • Yes
      34
    • No
      7
    • Skip / No Opinion
      6
  5. 5. Cav speed -1 m/s for all cavalry https://gitlab.com/0ad/0ad-community-mod-a26/-/merge_requests/23

    • Yes
      15
    • No
      22
    • Skip / No Opinion
      10
  6. 6. Cavalry health adjustments https://gitlab.com/0ad/0ad-community-mod-a26/-/merge_requests/22

    • Yes
      19
    • No
      15
    • Skip / No Opinion
      13
  7. 7. Crush (re)balance: decreased crush armor for all units, clubmen/macemen get a small hack attack. https://gitlab.com/0ad/0ad-community-mod-a26/-/merge_requests/20

    • Yes
      21
    • No
      16
    • Skip / No Opinion
      10
  8. 8. Spearcav +15% acceleration. https://gitlab.com/0ad/0ad-community-mod-a26/-/merge_requests/19

    • Yes
      33
    • No
      4
    • Skip / No Opinion
      10
  9. 9. Pikemen decreased armor, increased damage: 8hack,7pierce armor; 6 pierce 3 hack damage. https://gitlab.com/0ad/0ad-community-mod-a26/-/merge_requests/18

    • Yes
      18
    • No
      18
    • Skip / No Opinion
      11
  10. 10. Rome camp allowed in p2, rams train in p3 as normal, decreased health and cost. https://gitlab.com/0ad/0ad-community-mod-a26/-/merge_requests/17

    • Yes
      36
    • No
      6
    • Skip / No Opinion
      5
  11. 11. Crossbow nerf: +400 ms prepare time. https://gitlab.com/0ad/0ad-community-mod-a26/-/merge_requests/15

    • Yes
      13
    • No
      18
    • Skip / No Opinion
      16
  12. 12. adjust javelineer and pikemen roles, rework crush armor https://gitlab.com/0ad/0ad-community-mod-a26/-/merge_requests/14

    • Yes
      12
    • No
      22
    • Skip / No Opinion
      13


Recommended Posts

If IsFinished() is called more than once on a foundation that is at buildprogress of 1.0 then obstructing entities can be destroyed more than once. Unexpected results may occur.

I added some logging statements and confirmed that entities are getting destroyed more than once.

I think that the solution is to clear entsToDestroy after the entities in it are destroyed.

I've attached a patch that demonstrates this.

0ad-community-mod-02611-maybefixed.patch

  • Like 1
Link to comment
Share on other sites

Another possibly unwanted behavior that I notice is that obstructing entities that would normally be destroyed at the moment that the foundation is created will instead be delayed and only destroyed after the building is finished. I wonder if this could disrupt pathfinding when units are standing on the foundation at the time that construction is intended to begin.

A solution to this problem would be to only delay destruction of obstructing entities if the structure to be built is a wall and the obstructing entities are trees.

  • Like 1
Link to comment
Share on other sites

18 minutes ago, Norse_Harold said:

If IsFinished() is called more than once on a foundation that is at buildprogress of 1.0 then obstructing entities can be destroyed more than once. Unexpected results may occur.

I added some logging statements and confirmed that entities are getting destroyed more than once.

I think that the solution is to clear entsToDestroy after the entities in it are destroyed.

I've attached a patch that demonstrates this.

0ad-community-mod-02611-maybefixed.patch 698 B · 0 downloads

it would be interesting if this fixes the problem. Many of the problems have occurred when building over no entities, ie just building a farmstead when expected.

Link to comment
Share on other sites

48 minutes ago, real_tabasco_sauce said:

it would be interesting if this fixes the problem. Many of the problems have occurred when building over no entities, ie just building a farmstead when expected.

In my testing, I was seemingly building over no entities, but I think that there are less visible or invisible entities that are being automatically deleted when buildings are constructed there.

Also, I see your proposed changes in the fix_crash branch to re-add `return false` in Commit in Foundation.js. This is good. I think that it will correctly prevent building placement if there is an obstructing entity that is not caught by BuildRestrictions.js:CheckPlacement, such as an entity that moves into the area between the time that CheckPlacement() is called and Commit() is called. An example would be another structure being placed there in that time. This is a guess, though. I don't know whether there is actually a race condition there. Edit: Actually, I think that the purpose of the call to GetEntitiesBlockingConstruction() is to check whether there are units blocking construction and order them to move out of the way.

I think that a correct solution would involve all three changes

  • apply my patch to clear entsToDestroy after the entities in it are destroyed
  • re-add return false on line 275 of Foundation.js, in Commit(), if there are obstructing entities. However, if the building to construct is a wall and the obstructing entities are only trees then do not return false in that case
  • in Commit at line 259, immediately destroy all obstructing entities that would be destroyed on construction except trees. If the entity to be built is a wall then queue trees for later destruction

Some of the code would seem to be redundant. Is there a way to move the wall/tree code block into a separate function so that it can be used by CheckPlacement() and Commit()?

Edited by Norse_Harold
Link to comment
Share on other sites

2 minutes ago, Norse_Harold said:

In my testing, I was seemingly building over no entities, but I think that there are less visible or invisible entities that are being automatically deleted when buildings are constructed there.

Also, I see your proposed changes in the fix_crash branch to re-add `return false` in Commit in Foundation.js. This is good.

I think that a correct solution would involve all three changes

  • apply my patch to clear entsToDestroy after the entities in it are destroyed
  • re-add return false in Commit if there are obstructing entities
  • immediately destroy all obstructing entities that would be destroyed on construction except trees. If the entity to be built is a wall then queue trees for later destruction

Well restoring return false was problematic as it would result in endless construction when building a wall segment on top of a tree.

That being said, I was unable to cause the crashing after this change in 2 multiplayer games.

Link to comment
Share on other sites

1 minute ago, real_tabasco_sauce said:

@Norse_Harold what were your steps to try and reproduce the crash?

I mimiced the Romans player in PhiliptheSwaggerless's replay. I was not able to reproduce the crash. But I only intended to cause multiple destroy calls per entity, and I was successful in that.

To see that, use the attached Foundation.js file which enables logging. Then build lots of structures and watch the logs for multiple occurrences of "destroying entity #", where # is the same number for each occurrence. It may help to build structures with lots of units and on top of grass actors.

Foundation.js

  • Thanks 1
Link to comment
Share on other sites

3 minutes ago, Norse_Harold said:

I mimiced the Romans player in PhiliptheSwaggerless's replay. I was not able to reproduce the crash. But I only intended to cause multiple destroy calls per entity, and I was successful in that.

To see that, use the attached Foundation.js file which enables logging. Then build lots of structures and watch the logs for multiple occurrences of "destroying entity #", where # is the same number for each occurrence. It may help to build structures with lots of units and on top of grass actors.

Foundation.js 14.55 kB · 0 downloads

Were you in multiplayer? The crashes only seem to happen in multiplayer with a player opponent or spectator.

Link to comment
Share on other sites

Just now, real_tabasco_sauce said:

Were you in multiplayer? The crashes only seem to happen in multiplayer with a player opponent or spectator.

I was not in multiplayer, but if my theory is correct that excessive destroy calls on the same entity are the cause of the crash then it's a useful line of investigation.

  • Like 1
Link to comment
Share on other sites

community-testing-5.zip

these changes add @Norse_Harold's above suggestion to prevent entities from being deleted more than once, and includes the changes to only return false; if the building is not a wall or palisade.

This prevented any crashes until we started building walls. We did a game where we only placed walls on completely bare ground, completely avoiding trees and decorative entities, and the crash still occurred.

Edited by real_tabasco_sauce
Link to comment
Share on other sites

1 hour ago, real_tabasco_sauce said:

This prevented any crashes until we started building walls. We did a game where we only placed walls on completely bare ground, completely avoiding trees and decorative entities, and the crash still occurred.

Good idea to run that test. That's interesting that the crash still occurred. I advise separating the walls delete trees mod from the rest of community-mod for further testing, so that a binary search algorithm can be applied where the search space is cut in half with each iteration.

If the problem is then found to be correlated with the walls delete trees mod then here are some things to consider.

  • Normally (invisible or less visible) obstructions would be destroyed before the foundation is committed instead of after it's finished.
  • Maybe isFinished isn't called after every structure is completely constructed. In that case, obstructing entities aren't destroyed.
  • Units blocking construction might conflict with or be locked into the structure if return false isn't present on line 275 of Foundation.js.
Edited by Norse_Harold
Link to comment
Share on other sites

recently, I tried another conditional return, only when totalBuildRate was NaN. This didn't help, because totalBuildRate presumably becomes NaN after commit().

			if (isNaN(this.totalBuilderRate)) {
				warn("Value of builder rate is NaN");
				return false;
			}

I wonder if there is something we can check instead of totalBuildRate that will return false when we want it to.

Maybe EntstoDestroy being empty or something else?

Edited by real_tabasco_sauce
Link to comment
Share on other sites

  • Stan` changed the title to Introducing the Official community mod for 0 A.D. Empires Ascendant

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...