jrv
Forum Guru
How is it different from a VASSAL extension and/or module?
JR
JR
I have been exploring how to add a new counter type to vasl, and I saw that the bsh "plugin" creates a CommandEncoder, which is part of what I think I need to do. I have been working on an extension but now I wonder if a plugin might be the right packaging instead. I have been inserting the new counter into the buildFile by hand but now I think I need a PieceDefiner so it can participate in the editing process, and I see that is what the bsh plugin registers too.Context?
I've been trying to teach myself this as well in an effort to provide counter support to VASL. If you have the time, would you share what works for you?I have been exploring how to add a new counter type to vasl, and I saw that the bsh "plugin" creates a CommandEncoder, which is part of what I think I need to do. I have been working on an extension but now I wonder if a plugin might be the right packaging instead. I have been inserting the new counter into the buildFile by hand but now I think I need a PieceDefiner so it can participate in the editing process, and I see that is what the bsh plugin registers too.
JR
I am trying to create a decorator that behaves like a state machine, that is that it can have transitions to other states in an arbitrary graph and is not limited to a linear structure. VASSAL has the embellishment decorator built in, which is used in layers to show images of the counter in various states. That code only understands a linear array of transitions. For instance the 4-5-8 ELRs to a 4-4-7 ELRs to a 4-2-6, but once it reaches conscript by game rule it should battle-harden to 5-2-7. This is not implemented, partly because the embellishment decorator only can return to a 4-4-7, i.e. it can only go back/forward through the array. Instead battle-hardening is disabled for this counter once the 4-2-6 state is reached. I found that very confusing when I first encountered it. [As an aside this might be implemented today using counter substitution; I have not tested this, however.]I've been trying to teach myself this as well in an effort to provide counter support to VASL. If you have the time, would you share what works for you?
I am guessing by "nested prototype" you actually mean "nested Decorator", i.e. classes that extend Decorator. As best I understand the code, prototypes are themselves stacks of Decorators that can be inserted as a group into another stack.All of this is strung together through a set of nested prototype definitions making it nearly impossible for mere mortals to comprehend. In short, our counters are no longer maintainable, as witnessed by the ever-increasing set of bugs.
I had not considered the problem of passing state when I suggested the "replace with" idea. You are right that only works with the current code if the counter will transition to a known state, e.g. vehicle in whatever state -> wreck. Although it might be possible to transmit state with the "replace counter" functionality it seems to me that this would increase the complexity of an already complex stack of counter decorators, making reasoning about the effects of other code changes more difficult. But perhaps it is the only way forward.If you're looking for an improved ASL counter, the state you want to store is probably not what counter it is, but what attributes it has (flipped, heroic, berserk, etc).
IMO, Replace With Other is the best way to BH/ELR/etc in VASSAL so someway to pass metadata between counters would be da bomb.
You're replacing the complex stack of counter decorators with this internal metadata structure, if it's even possible. At least that's the design I would try for. There aren't really THAT many states to track (I think) in terms of ASL ones. Not sure how/if you could pass rotation and labels, etc.it seems to me that this would increase the complexity of an already complex stack of counter decorators, making reasoning about the effects of other code changes more difficult. But perhaps it is the only way forward.
VASSAL allows you to create "prototypes" that are collections of piece traits (i.e.decorators). If you edit the VASL module you can see them here:I am guessing by "nested prototype" you actually mean "nested Decorator", i.e. classes that extend Decorator. As best I understand the code, prototypes are themselves stacks of Decorators that can be inserted as a group into another stack.
JR