Menu

#646 Fix game loading issues

Release 0.9
closed
None
resolved
Game Logic
0.9dev
bug
minor
2018-01-05
2017-12-31
Sahits GmbH
No

There are two known issues and more might be hidden:

Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
    at ch.sahits.game.openpatrician.model.product.AmountablePrice.remove(AmountablePrice.java:88)
    at ch.sahits.game.openpatrician.model.impl.WareHolding.move(WareHolding.java:102)
    at ch.sahits.game.openpatrician.model.city.impl.City.move(City.java:448)
    at ch.sahits.game.openpatrician.clientserverinterface.service.CityProductionAndConsumptionService.consumeWares(CityProductionAndConsumptionService.java:99)
    at ch.sahits.game.openpatrician.engine.land.city.CityEngine.consumeWares(CityEngine.java:166)
    at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
    at com.sun.glass.ui.gtk.GtkApplication.lambda$null$48(GtkApplication.java:139)
    at java.lang.Thread.run(Thread.java:748)

It seems like the jxThreadExecutor is not initialized on the object when unserializing.

java.lang.NullPointerException: null
    at ch.sahits.game.openpatrician.engine.player.ProductionConsumptionKnowledge.updateKnowledge(ProductionConsumptionKnowledge.java:80) ~[classes/:?]
    at ch.sahits.game.openpatrician.engine.AIPlayerEngine.handleTradeStrategyStart(AIPlayerEngine.java:233) ~[classes/:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_151]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_151]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_151]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_151]
    at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-18.0.jar:?]
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-18.0.jar:?]
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) [guava-18.0.jar:?]
    at com.google.common.eventbus.AsyncEventBus.access$001(AsyncEventBus.java:34) [guava-18.0.jar:?]
    at com.google.common.eventbus.AsyncEventBus$1.run(AsyncEventBus.java:117) [guava-18.0.jar:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_151]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_151]

Production knoledge and consumption are not initialized. This might be similar to the one above.

Discussion

  • Sahits GmbH

    Sahits GmbH - 2018-01-01

    Prototypes are not stored as such, even though they are marked as storable protoypes:

    2018-01-01 08:54:17,706 [JavaFX Application Thread] DEBUG ch.sahits.game.openpatrician.utilities.service.LoadAndSaveService - Add singleton beans: [ch.sahits.game.openpatrician.clientserverinterface.model.PathInterpolatorMap,
    ch.sahits.game.openpatrician.utilities.service.LUIDProvider,
    ch.sahits.game.openpatrician.model.AIPlayerList,
    ch.sahits.game.openpatrician.model.Date,
    ch.sahits.game.openpatrician.model.PlayerList,
    ch.sahits.game.openpatrician.model.building.TradingOfficeList,
    ch.sahits.game.openpatrician.model.city.CityProductionStorage,
    ch.sahits.game.openpatrician.model.city.LoanerList,
    ch.sahits.game.openpatrician.model.city.Shipyards,
    ch.sahits.game.openpatrician.model.city.cityhall.AldermanCandidateList,
    ch.sahits.game.openpatrician.model.city.cityhall.AldermanTaskPlayerMap,
    ch.sahits.game.openpatrician.model.city.cityhall.CityHallList,
    ch.sahits.game.openpatrician.model.city.cityhall.impl.AldermanOffice,
    ch.sahits.game.openpatrician.model.city.guild.GuildList,
    ch.sahits.game.openpatrician.model.city.guild.GuildSettings,
    ch.sahits.game.openpatrician.model.city.guild.impl.MediterreanSeaMap,
    ch.sahits.game.openpatrician.model.city.impl.CitiesState,
    ch.sahits.game.openpatrician.model.city.impl.CityRegistry,
    ch.sahits.game.openpatrician.model.collection.CityChurchRegistry,
    ch.sahits.game.openpatrician.model.collection.CityTavernRegistry,
    ch.sahits.game.openpatrician.model.map.impl.GameMap,
    ch.sahits.game.openpatrician.model.people.impl.CaptainsState,
    ch.sahits.game.openpatrician.model.people.impl.SeaPiratesState,
    ch.sahits.game.openpatrician.model.sea.BlockadeState,
    ch.sahits.game.openpatrician.model.sea.TravellingVessels,
    ch.sahits.game.openpatrician.model.server.MapLocationDetectionModel,
    ch.sahits.game.openpatrician.model.weapon.ArmoryRegistry,
    ch.sahits.game.openpatrician.engine.event.AIPlayerEngineState,
    ch.sahits.game.openpatrician.engine.event.EventEngineState,
    ch.sahits.game.openpatrician.engine.sea.LocationTracker,
    ch.sahits.game.openpatrician.engine.sea.model.PirateActivity,
    ch.sahits.game.openpatrician.javafx.model.DisplayMessages,
    ch.sahits.game.openpatrician.model.event.TimedUpdatableTaskList,
    ch.sahits.game.openpatrician.model.city.PopulationConsume]
    2018-01-01 08:54:17,733 [JavaFX Application Thread] DEBUG ch.sahits.game.openpatrician.utilities.service.LoadAndSaveService - Add prototype beans: [ch.sahits.game.openpatrician.model.city.impl.CityWall: 25,
    ch.sahits.game.openpatrician.model.city.ProductionStorage: 25,
    ch.sahits.game.openpatrician.model.city.impl.CityState: 25,
    ch.sahits.game.openpatrician.model.city.impl.PopulationUpdateStats: 25,
    ch.sahits.game.openpatrician.model.city.impl.TavernState: 25]
    
     
  • Sahits GmbH

    Sahits GmbH - 2018-01-01

    There are several prototypes missing, i.e. City, AIPlayer, HumanPlayer, ...

     
  • Sahits GmbH

    Sahits GmbH - 2018-01-02

    [r4425]: Defer real type from object instead of annotation, Introduce new collection type annotation wor WeakReferenceList matrix, make RandomNameLoader serializable. This fixes the big issues (so far)

     

    Related

    Commit: [r4425]

  • Sahits GmbH

    Sahits GmbH - 2018-01-04

    [r4426] solved most of the exceptions when loading. The second exception still remains. The event bus is only triggered when the restoring is finished. Further more there are a huge amount of warnings from the pathing, after the graph is initialized:

    2018-01-03 11:46:55,692 [pool-2-thread-4] DEBUG ch.sahits.game.openpatrician.engine.sea.AStarGraphProvider - Created graph taking 7706ms
    ...
    2018-01-03 11:47:00,565 [pool-2-thread-3] DEBUG ch.sahits.game.openpatrician.engine.sea.AStarGraphProvider - Created graph taking 7267ms
    ...
    2018-01-03 11:47:00,593 [pool-8-thread-1] WARN  ch.sahits.game.openpatrician.engine.sea.model.NodeData - Destination not available
    
     

    Related

    Commit: [r4426]

  • Sahits GmbH

    Sahits GmbH - 2018-01-04

    The beans on ProductionConsumptionKnowledge are never rewired after loading.

     
  • Sahits GmbH

    Sahits GmbH - 2018-01-04

    Maybe it would be simpler to store prototype beans that need serialization at creation time in a WeakReference list.

     
  • Sahits GmbH

    Sahits GmbH - 2018-01-05
    • status: new --> closed
    • assigned_to: Sahits GmbH
    • Resolution: open --> resolved
     
  • Sahits GmbH

    Sahits GmbH - 2018-01-05

    [r4427] Cache serializable prototype beans

     

    Related

    Commit: [r4427]


Log in to post a comment.

MongoDB Logo MongoDB