Terasology / DynamicCities

Cities that get fancy!
18 stars 14 forks source link

test: Convert to MTEExtension #94

Closed keturn closed 3 years ago

keturn commented 3 years ago

Fixes errors about tests failing to resolve modules.

Also re-enabled some tests and got them working. I changed enough of the test file that GitHub PR interface doesn't recognize it as a file that moved, but it is making the same assertions.

This PR is also notable because it takes care of the last use of the deprecated ModuleTestingEnvironment superclass in Omega.

To Do

keturn commented 3 years ago

Results improve slightly, at the cost of a much much longer runtime, by using IsolatedMTEExtension.

Which I find puzzling in itself, because the code executed in the tests looks like it should all be read-only operations? So why would they benefit from increased isolation?

keturn commented 3 years ago

Also: The cellIsLoaded tests failing for anything that isn't (0, 0) could be explained by it only loading the one thing at the origin, and it returns false for everything else.

Except there is a failing test saying the cell at (98, -124) is loaded when it shouldn't be?

keturn commented 3 years ago

This led to some MTE work for untangling interactions between test cases: https://github.com/Terasology/ModuleTestingEnvironment/pull/64

also: a lot of the code under test here in RegionEntitesTest changed for JOML in #86. If these tests were disabled (or just ignored) at the time, something might have slipped through then.

keturn commented 3 years ago

MTE tests: Dynamic Cities

keturn commented 3 years ago

MTE tests: Dynamic Cities

keturn commented 3 years ago

I'm approving this assuming that you checked in MetalRenegades, that cities and buildings still show up […]

Cities? We know, after several months of playtesting, that Cities are a myth. Propaganda by the liberal elite to destabilize the traditional way of life by putting stories in the minds of our children, fantasies about the great named Cities and their buildings taller than trees. Hah!


Oh, you mean in single-player, I should still expect to see cities and buildings in single-player?

Well, I have this much:
1

Is that a city?

As for buildings, well,

12:02:12.454 [main] ERROR o.t.engine.core.TerasologyEngine - Uncaught exception, attempting clean game shutdown
java.lang.NullPointerException: null
at org.terasology.dynamicCities.settlements.SettlementEntityManager.growSettlement(SettlementEntityManager.java:531)
at org.terasology.dynamicCities.settlements.SettlementEntityManager.onWorldTimeEvent(SettlementEntityManager.java:168)

https://github.com/Terasology/DynamicCities/blob/3a609aa3b0c3e08d1529e52211ad22afc2d91887/src/main/java/org/terasology/dynamicCities/settlements/SettlementEntityManager.java#L522-L535

keturn commented 3 years ago

Second attempt: didn't get that crash, but didn't get buildings.

Tried on develop for comparison: also has Problems. See thread.

pollend commented 3 years ago

Second attempt: didn't get that crash, but didn't get buildings.

Tried on develop for comparison: also has Problems. See thread.

the code is way to fragile ;/ might have something to do with all the terrain features.

Cervator commented 3 years ago

Can confirm an apparent and distinct lack of buildings - darn termites!

Noticed some logging I don't recall seeing before about broken parcels?

15:35:54.794 [Saving-0] INFO  o.t.e.p.internal.SaveTransaction - Save game finished
15:36:00.089 [main] WARN  o.t.engine.core.internal.TimeBase - Delta too great (1094), capping to 1000
15:36:46.281 [main] ERROR o.t.e.e.e.internal.PojoEntityManager - Adding a component (class org.terasology.engine.network.NetworkComponent) over an existing component for entity 23300
15:36:46.299 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@4cce9387 couldn't be completed. Status: NONE
15:36:46.309 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@7be79549 couldn't be completed. Status: NONE
15:36:53.422 [main] INFO  o.t.e.p.i.ReadWriteStorageManager - Auto Saving - Creating game snapshot
15:36:53.423 [main] INFO  o.t.e.p.i.ReadWriteStorageManager - Auto Saving - Snapshot created: Writing phase starts
15:36:54.878 [Saving-0] INFO  o.t.e.p.internal.SaveTransaction - Save game finished
15:37:01.166 [main] WARN  o.t.engine.core.internal.TimeBase - Delta too great (1004), capping to 1000
15:37:05.165 [main] INFO  o.t.e.p.i.ReadWriteStorageManager - Auto Saving - Creating game snapshot
15:37:05.167 [main] INFO  o.t.e.p.i.ReadWriteStorageManager - Auto Saving - Snapshot created: Writing phase starts
15:37:07.380 [Saving-0] INFO  o.t.e.p.internal.SaveTransaction - Save game finished
15:37:21.675 [main] INFO  o.t.e.p.i.ReadWriteStorageManager - Auto Saving - Creating game snapshot
15:37:21.677 [main] INFO  o.t.e.p.i.ReadWriteStorageManager - Auto Saving - Snapshot created: Writing phase starts
15:37:22.151 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@649b9ed couldn't be completed. Status: NONE
15:37:22.151 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@4cce9387 couldn't be completed. Status: NONE
15:37:22.162 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@7ebbda4f couldn't be completed. Status: NONE
15:37:22.162 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@7be79549 couldn't be completed. Status: NONE
15:37:24.184 [Saving-0] INFO  o.t.e.p.internal.SaveTransaction - Save game finished
15:37:27.554 [main] INFO  o.t.e.p.i.ReadWriteStorageManager - Auto Saving - Creating game snapshot
15:37:27.555 [main] INFO  o.t.e.p.i.ReadWriteStorageManager - Auto Saving - Snapshot created: Writing phase starts
15:37:30.346 [Saving-0] INFO  o.t.e.p.internal.SaveTransaction - Save game finished
15:37:32.961 [main] INFO  o.t.e.p.i.ReadWriteStorageManager - Auto Saving - Creating game snapshot
15:37:32.962 [main] INFO  o.t.e.p.i.ReadWriteStorageManager - Auto Saving - Snapshot created: Writing phase starts
15:37:33.787 [Saving-0] INFO  o.t.e.p.internal.SaveTransaction - Save game finished
15:37:37.137 [main] WARN  o.terasology.biomesAPI.BiomeManager - Missing biome information for ( 3.510E+2  2.100E+1  1.183E+3)
15:37:44.864 [main] WARN  o.t.engine.core.internal.TimeBase - Delta too great (1903), capping to 1000
15:37:49.489 [main] WARN  o.t.engine.core.internal.TimeBase - Delta too great (1069), capping to 1000
15:37:59.223 [main] ERROR o.t.e.e.e.internal.PojoEntityManager - Adding a component (class org.terasology.engine.network.NetworkComponent) over an existing component for entity 42586
15:37:59.231 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@649b9ed couldn't be completed. Status: NONE
15:37:59.232 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@4cce9387 couldn't be completed. Status: NONE
15:37:59.232 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@1bc6d1ba couldn't be completed. Status: NONE
15:37:59.246 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@2bcf9031 couldn't be completed. Status: NONE
15:37:59.257 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@7ebbda4f couldn't be completed. Status: NONE
15:37:59.257 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@6666978e couldn't be completed. Status: NONE
15:37:59.257 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@7be79549 couldn't be completed. Status: NONE
15:38:00.033 [main] INFO  o.t.e.p.i.ReadWriteStorageManager - Auto Saving - Creating game snapshot
15:38:00.034 [main] INFO  o.t.e.p.i.ReadWriteStorageManager - Auto Saving - Snapshot created: Writing phase starts
15:38:04.709 [Saving-0] INFO  o.t.e.p.internal.SaveTransaction - Save game finished
15:38:15.173 [main] WARN  o.t.engine.core.internal.TimeBase - Delta too great (1523), capping to 1000
15:38:21.449 [main] INFO  o.t.e.p.i.ReadWriteStorageManager - Auto Saving - Creating game snapshot
15:38:21.451 [main] INFO  o.t.e.p.i.ReadWriteStorageManager - Auto Saving - Snapshot created: Writing phase starts
15:38:21.761 [main] INFO  o.t.engine.logic.console.ConsoleImpl - [CONSOLE] Player86648 (local) entered Kinhestcasou
15:38:24.690 [Saving-0] INFO  o.t.e.p.internal.SaveTransaction - Save game finished
15:38:26.112 [main] WARN  o.t.engine.core.internal.TimeBase - Delta too great (1152), capping to 1000
15:38:32.781 [main] INFO  o.t.engine.logic.console.ConsoleImpl - [CONSOLE] Player86648 (local) left Kinhestcasou
15:38:33.899 [main] INFO  o.t.engine.logic.console.ConsoleImpl - [CONSOLE] Player86648 (local) entered Kinhestcasou
15:38:35.816 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@649b9ed couldn't be completed. Status: NONE
15:38:35.817 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@4cce9387 couldn't be completed. Status: NONE
15:38:35.817 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@643f2816 couldn't be completed. Status: NONE
15:38:35.817 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@1bc6d1ba couldn't be completed. Status: NONE
15:38:35.838 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@4b313414 couldn't be completed. Status: NONE
15:38:35.838 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@2bcf9031 couldn't be completed. Status: NONE
15:38:35.850 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@484f898e couldn't be completed. Status: NONE
15:38:35.850 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@7ebbda4f couldn't be completed. Status: NONE
15:38:35.850 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@6666978e couldn't be completed. Status: NONE
15:38:35.850 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@7be79549 couldn't be completed. Status: NONE
15:38:42.151 [main] WARN  o.t.engine.core.internal.TimeBase - Delta too great (1010), capping to 1000
15:38:52.640 [o.t.e.r.n.l.m.a.AdvancedGameSetupScreen-0] INFO  o.t.e.c.module.ModuleListDownloader - Retrieved 185 entries
15:38:57.322 [main] INFO  o.t.engine.logic.console.ConsoleImpl - [CONSOLE] Ghost mode toggled
15:39:11.796 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@649b9ed couldn't be completed. Status: NONE
15:39:11.797 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@2031e024 couldn't be completed. Status: NONE
15:39:11.797 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@4cce9387 couldn't be completed. Status: NONE
15:39:11.797 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@643f2816 couldn't be completed. Status: NONE
15:39:11.797 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@1bc6d1ba couldn't be completed. Status: NONE
15:39:11.806 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@22d7be07 couldn't be completed. Status: NONE
15:39:11.806 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@4b313414 couldn't be completed. Status: NONE
15:39:11.806 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@2bcf9031 couldn't be completed. Status: NONE
15:39:11.813 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@484f898e couldn't be completed. Status: NONE
15:39:11.813 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@7ebbda4f couldn't be completed. Status: NONE
15:39:11.813 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@704f88f8 couldn't be completed. Status: NONE
15:39:11.813 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@6666978e couldn't be completed. Status: NONE
15:39:11.813 [main] WARN  o.t.d.s.SettlementEntityManager - Parcel org.terasology.dynamicCities.parcels.RoadParcel@7be79549 couldn't be completed. Status: NONE
15:39:21.460 [main] INFO  o.t.e.p.i.ReadWriteStorageManager - Auto Saving - Creating game snapshot
15:39:21.461 [main] INFO  o.t.e.p.i.ReadWriteStorageManager - Auto Saving - Snapshot created: Writing phase starts
15:39:23.477 [Saving-0] INFO  o.t.e.p.internal.SaveTransaction - Save game finished

Checked two city spots, then also 0, 0, 0 as some past bugs have sent buildings back there, but nope, nothing. So maybe something is keep parcels from forming correctly? Otherwise the new MR worlds are gorgeous :-)

keturn commented 3 years ago

Example to compare to: Earlier used seed ​iTKAXPCM7KkMFnBj and found a city at (-530, 12, -70) that looked like this:

At least half a dozen buildings of several kinds, widely spaced.

keturn commented 3 years ago

Okay, now that #107 is merged (thank you Niruandaleth for the review) we have a properly failing test in this branch!

and I've confirmed that if I re-add the -1s in RegionEntityManager, it makes some warnings that come up during the placeParcel test go away. Worryingly, it doesn't make it pass.

I still want to track down where the setter for that is and figure out an interface that lets us avoid re-doing the math in different places.

keturn commented 3 years ago

The location that getNearest is trying to match is set by RegionEntityProvider: https://github.com/Terasology/DynamicCities/blob/8bd4203393a9860ea766816a985eaa3fe24eaf82/src/main/java/org/terasology/dynamicCities/region/RegionEntityProvider.java#L64-L65 (It makes entities with an UnregisteredRegionComponent, and the RegionEntityManager system has an OnActivatedComponent handler that receives those and invokes add() with them.)

My notes so far:

keturn commented 3 years ago

Next steps?

keturn commented 3 years ago

We had a discussion about Dynamic Cities in today's meeting, and it went sprawling as these things do, but I think the the parts that are relevant for next steps here are:

keturn commented 3 years ago

I've set aside my quest to track down the origin of the -1 and reverted my change to getNearest so that the placeParcel test passes again.

I started a new MR world with the known seed and did find a city with two buildings there.

I'd offer a screenshot, but the screenshot pushed the RAM usage over the edge and it crashed.

jdrueckert commented 3 years ago

Have a screenshot :palms_up_together: Terasology-211102195103-2560x1395