Open andrewd18 opened 2 weeks ago
@andrewd18 I promised JSON, but only sort of delivered. Check out the stop-event branch. When a card is stopped or unstopped, it will send a game event of type "SERIALIZED_GAME_STATE". The XML will have an attribute "serializedGameState" that is the serialized game state in JSON form.
If there's a long-term goal here that's shorter-term than the diff engine goal, it'd be to convert all the game events to pure JSON format. But we should either wait for more comprehensive testing on that, and/or work on it together.
Do you think this is a decent approach for now? If so, do you want to take that branch and build in the needed client methods to handle the SERIALIZED_GAME_STATE event?
No concerns about the approach for now.
I am, however, unable to move forward on adding GUI for the stop-event branch because when I attempt a mission on this branch, I get this error:
14:46:17.191 [nioEventLoopGroup-3-10] ERROR com.gempukku.stccg.game.CardGameMediator - Error processing game decision
java.lang.NullPointerException: Cannot invoke "com.gempukku.stccg.cards.AttemptingUnit.getAttemptingPersonnel()" because "this._attemptingUnit" is null
at com.gempukku.stccg.actions.missionattempt.AttemptMissionAction.nextAction(AttemptMissionAction.java:53) ~[web.jar:?]
at com.gempukku.stccg.processes.TurnProcedure.executeNextSubaction(TurnProcedure.java:67) ~[web.jar:?]
at com.gempukku.stccg.processes.TurnProcedure.carryOutPendingActionsUntilDecisionNeeded(TurnProcedure.java:38) ~[web.jar:?]
at com.gempukku.stccg.game.DefaultGame.carryOutPendingActionsUntilDecisionNeeded(DefaultGame.java:212) ~[web.jar:?]
at com.gempukku.stccg.game.CardGameMediator.playerAnsweredNew(CardGameMediator.java:233) ~[web.jar:?]
at com.gempukku.stccg.async.handler.GameRequestHandler.updateGameState(GameRequestHandler.java:91) ~[web.jar:?]
at com.gempukku.stccg.async.handler.GameRequestHandler.handleRequest(GameRequestHandler.java:64) ~[web.jar:?]
at com.gempukku.stccg.async.handler.RootUriRequestHandler.handleRequest(RootUriRequestHandler.java:74) ~[web.jar:?]
at com.gempukku.stccg.async.GempukkuHttpRequestHandler.channelRead0(GempukkuHttpRequestHandler.java:82) ~[web.jar:?]
at com.gempukku.stccg.async.GempukkuHttpRequestHandler.channelRead0(GempukkuHttpRequestHandler.java:1) ~[web.jar:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99) ~[web.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[web.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[web.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[web.jar:?]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) ~[web.jar:?]
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[web.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) ~[web.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[web.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[web.jar:?]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) ~[web.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[web.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[web.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[web.jar:?]
at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) ~[web.jar:?]
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346) ~[web.jar:?]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318) ~[web.jar:?]
at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) ~[web.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) ~[web.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[web.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[web.jar:?]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1357) ~[web.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) ~[web.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[web.jar:?]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:868) ~[web.jar:?]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) ~[web.jar:?]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) ~[web.jar:?]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) ~[web.jar:?]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) ~[web.jar:?]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) ~[web.jar:?]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[web.jar:?]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[web.jar:?]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[web.jar:?]
at java.lang.Thread.run(Thread.java:1583) [?:?]
@andrewd18 - Thanks for catching this! Fixed.
We need some way to indicate that a card or set of cards is stopped.
Some proposed ideas: