Closed huiwang closed 7 years ago
I'm fine with both designs. I like the first one because it handles the turns and logs for me, but this can also be done easily by duplicating a short sample like your second code.
I'm wondering if things like implementing referees and offline arenas would have a stronger impact on our design.
@tyrcho I managed to run offline arenas with brutal test and it has no impacts on the design.
@huiwang excellent news ! I'll try and have a look when possible, but I'm travelling most of August so no promises :)
GameLoop was originally designed as a rule-tme-all control strcture for all kinds of games. Thanks to the strong contract, we can always model a game with IO, State/Action, and Bot layer. This allows us to have well-defined traits.
However, the strong contract becomes a limitation in cases where we have to adapt the game modeling to meet the contract. The adaptation is often ugly. For example, in the wondev contest, in addtion to the static context, we must also include historical information in the state to clear the fog of war. Consequently, the state object aggregates many information of different nature.
Instead, we should drop such kind of control strucutres and let the develop choose one best for the specific game. Take the wondev example again, I have a control strucutre as follows
This way, I have a state object which is quite consistent(no mixing of different kind of infomration). It is still debuggable and benchmarkable. The complexity on the accumulator is reduced dramatically thanks to some mutable vars. What might please @tyrcho is that we don't have to implement anymore the IO, State, Bot in the retricted way (extending predefined traits).