VASSAL 4 model description

Thus spake bdgza:

I see Actions are again called by keycodes, like in the VASSAL 3 module.
Will it be possible to call Actions from a Script by name, rather than
by keycode? Can you have an Action attached to a game object that is not
listed in the contextual menu?

Keycodes are optional.

I was not intending to force all Actions to appear in context menus, so
in the implementation we would either have a special kind of hkey which
excludes them, or not have the hkey double as the Action name.


J.

Thus spake bdgza:

Will it be possible to call Actions from a Script by name, rather than
by keycode?

I intend for the scripts attached to actions be be callable by name. I’d
been thinking of Actions as the data manifestation of something the user
can do in a View. The “doing” goes with the attached script, not the
Action. Maybe this makes “Action” a poor choice of name.


J.

Joel,

Could you gove some examples of what a Hierachical Key will look like. I can see several problems with your proposal, including bdgza’s concerns, that might become clearer if I know what a hierachical key looks like.

Think about the case 2 different ‘Actions’ without keycodes that are to be triggered at the same time by the same user event. What will the hierachical keys look like? What binds them together? The NamedKeyStrokes I did for 3.2 are essentiall an ‘Activation Id’ that other ‘Actions’ (ie. traits) can look for and act on

I am also unsure about your scheme to index ‘by property’. What you seem to be saying is to index the property values of each possible property, so there would be one index for each possible Vassal property. You would need a database query optimizer to use that to help with a search for something like ‘CurrentMap ~= Veghel* and Strength < 5 and Will >= 12 and (hp == 2 or hp == 3)’

Thus spake swampwallaby:

Joel,

Could you gove some examples of what a Hierachical Key will look like. I
can see several problems with your proposal, including bdgza’s concerns,
that might become clearer if I know what a hierachical key looks like.

I was expecting that an item appearing as Foo > Bar > Baz in a contex
menu would have a key that reflected that, something like ‘/Foo/Bar/Baz’,
or, maybe the levels represented as a list, to avoid having to parse the
string each time.

On reflection, its not necessary that this key serve as both as a name
and a menu location. Those could be separated if it would be problematic
to have them together.

Think about the case 2 different ‘Actions’ without keycodes that are to
be triggered at the same time by the same user event. What will the
hierachical keys look like? What binds them together? The
NamedKeyStrokes I did for 3.2 are essentiall an ‘Activation Id’ that
other ‘Actions’ (ie. traits) can look for and act on

I suspect that I’ve misunderstood what you’re saying for this one.

What the hkeys look like would depend on where and in what menu the
associated Actions were to appear in.

It should never be the case that two Actions are triggered at the same
time, because the user can’t input two separate key events simultaneously
on one keyboard or select two menu items simultaneously.

I am also unsure about your scheme to index ‘by property’. What you seem
to be saying is to index the property values of each possible property,
so there would be one index for each possible Vassal property. You would
need a database query optimizer to use that to help with a search for
something like ‘CurrentMap ~= Veghel* and Strength < 5 and Will >= 12
and (hp == 2 or hp == 3)’

What I’m proposing w/r/t indices is that when a particular search is
done for the first time, we cache the result and install change
listeners to keep that cached result current. I don’t see why that would
require a query optimizer. Running the same query a second time should
result in returning the cached list, not doing another search.

Following your example: this would involve adding a change listener
which looks at the values of the four properties in your query, to be
added after the first time the search is done. Subsequently, whenever
any of these properties change, the change listener would add or remove
pieces from the cached index as appropriate.

I suspect that this is better than keeping sorted per-property lists for
every property—doing that would put us in need of a query optimizer of
some sort, as there’s no obvious way to retrieve lists of pieces which
satisfy complex queries there—because it will have us keeping indices
only for the exact queries which are actually used.


J.

After reading the above the following things came into my mind. They may be off-topic or currently irrelevant, but I’ll just list them here. Ignore them at will. ;)

Please also note that I do not know inner workings of the current VASSAL engine, so these points may have been answered by earlier design.

  • Actions with scripts. A good idea, but I think there can be two kinds of Actions / scripts. The ones that are launched via the UI by the user (like context menu actions) and the ones that react to the model change without the aid of the user (scripts attached to the model by the current module?). These two kinds of actions may have different places in MVC.

  • Is there just one script attached to an action or can there be many? Is it possible to change/swap the script entry on runtime? Each script should also have an undo equivalent to be able to undo moves if necessary (Command design patter should be useful).

  • The actual module design affects a great deal of the core Model design. How the modules are added to the system? As plug-ins? If as plugins then each plugin could provide its own additional menus etc. However,

  • Currently the available modules vary from card games to dice games to strategy games or even RPGs(?). That is a wide variety of games. All having different types of data and core functionalities. How does the Model take care of all of this variance? How does a module add functionality to the model? Or is the model just a common data repository ? If the Model is expandable, how is it done? Does it, for example, wrap around an “engine” that provides a common interface for all game types? There could be a base engine that would be inherited by card game engine, board game engine etc. that could in turn be expanded by the module developer. The module would the pass the proper engine object to the Model upon initialization…

  • Animation is one of my personal PITA. Should the game be able to show actions in animated manner (including the ability to see what the other user is pointing at the moment etc.)). If animation is included then it probably will affect the model in some way.

Sorry if this was off topic or just plain silly.

Thus spake rami:

After reading the above the following things came into my mind. They may
be off-topic or currently irrelevant, but I’ll just list them here.
Ignore them at will. :wink:

Please also note that I do not know inner workings of the current VASSAL
engine, so these points may have been answered by earlier design.

  • Actions with scripts. A good idea, but I think there can be two kinds
    of Actions / scripts. The ones that are launched via the UI by the user
    (like context menu actions) and the ones that react to the model change
    without the aid of the user (scripts attached to the model by the
    current module?). These two kinds of actions may have different places
    in MVC.

The latter kind of script—the kind not directly triggered by the user—
are either attached to property change listeners or called from other
scripts.

  • Is there just one script attached to an action or can there be many?

I was thinking “one”, but I don’t have a compelling reason for that.

Is it possible to change/swap the script entry on runtime?

It should be, yes.

Each script
should also have an undo equivalent to be able to undo moves if
necessary (Command design patter should be useful).

Yes. Would be neat if that could be generated automatically.

  • The actual module design affects a great deal of the core Model
    design. How the modules are added to the system? As plug-ins? If as
    plugins then each plugin could provide its own additional menus etc.
    However,

  • Currently the available modules vary from card games to dice games to
    strategy games or even RPGs(?). That is a wide variety of games. All
    having different types of data and core functionalities. How does the
    Model take care of all of this variance?

Every game object in a physical game is logically just a bundle of
properties. The model stores those. The functionality comes from the
scripts and Actions.

  • Animation is one of my personal PITA. Should the game be able to show
    actions in animated manner (including the ability to see what the other
    user is pointing at the moment etc.)). If animation is included then it
    probably will affect the model in some way.

I don’t see how this would affect the Model. Things like animations and
the position of the cursor are in the domain of the GUI View. (I would
very much like to make it possible to see the other player’s cursor,
though.)

Sorry if this was off topic or just plain silly.

These are all good and useful questions.


J.

I would think that to show the opponents cursor or not should be at least a property attached to player sides (to switch it on/off for games), so that Observers for example don’t show their cursor, and certain games can always hide the cursor.

Thus spake bdgza:

“uckelman” wrote:

(I would
very much like to make it possible to see the other player’s cursor,
though.)

I would think that to show the opponents cursor or not should be at
least a property attached to player sides (to switch it on/off for
games), so that Observers for example don’t show their cursor, and
certain games can always hide the cursor.

Yes, but it should be a property of a View, not a propery of anything
in the Modle.


J.

Won’t game modules have any say on the / way to influence views?

Thus spake bdgza:

Yes, but it should be a property of a View, not a propery of anything
in the Modle.

Won’t game modules have any say on the / way to influence views?

My typo above is confusing. It should be “Model”, not to be read as
“module”. Does that clear up what I’m saying?


J.

phew! :laughing:

So Model in this case is just a repository for handling data with various properties and the actual game module offers (somehow) the game logic in form of scripts? It was bit confusing for me at first as I have always put the engine part in the Model so that the application control is in one single place.

Sorry, I can’t say what I was after with that one. :confused:

In VASSAL, when playing FtF, the other player is the master with the model and the other player is a slave? Or does both have their own models that are kept in sync? Or (very unlikely) is the model completely separated and shared between the clients on the server side?


Rami

Thus spake rami:

So Model in this case is just a repository for handling data with
various properties and the actual game module offers (somehow) the game
logic in form of scripts? It was bit confusing for me at first as I have
always put the engine part in the Model so that the application control
is in one single place.

My reason for wanting this separation is to keep the purely
presentational aspects of games from being entangled with the logical
ones.

In VASSAL, when playing FtF, the other player is the master with the
model and the other player is a slave? Or does both have their own
models that are kept in sync? Or (very unlikely) is the model completely
separated and shared between the clients on the server side?

We could do any of those by having Views which supported the right
operations (such as querying a remote Model). I was supposing that each
user would have a Model locally, though, as rendering in the standard
GUI View will need to retrive quite a bit of information from the Model.


J.

It would be best to keep syncing the model between all players, as the current VASSAL does. If the host crashes everyone else still has the complete gamestate (to save or continue after the crashed player recovered). What perhaps could be improved upon is the implementation – detection of sync-loss or network failure. It’s rare, but it has happened that games have lost sync. Quicker notification of and more information about loss of network connection with other players and/or the VASSAL server would be nice.

If I understand Joel’s thinking, we will be looking at a model where any players PC can become a server. Sort of like online multi-player games where one player sets up as a server and everyone else connects to him. The Central Vassal server would then become more of a ‘tracker’ that lists what player servers are running (and marked as public) and what games are being played. Since every Vassal instance can potentially be a server, then if the current server goes down, the other Vassal instances should be able to negotiate with each other and ‘choose’ a new server.

Re: Properties. Some properties (Thinking Calculated Properties from 3.2) will be un-cachable. It will not be possible to create listeners on all items that may affect theire value. Apart from this, I have no problems with Property caches/indexes in general as long as the Listeners are got right.

Re: Actions. From the sound of it, you are suggesting that all actions will be implemented by writing code/scripts?

I don’t quite understand how you intend to implement the variety of behavior we have now. I suspect a lot of the basic traits could be folded into one mega-structure (eg. delete/clone/mark when moved) etc. How will other behaviors be added to a counter and how will they interact with each other. While the Decorator pattern has drawbacks, it provides and extremely rich set of interactions (eg. a rotatatable counter with a seperately rotating turret, all with a label that does not rotate).

Presumably one of the properties the model of a counter will have to provide is an image that represents the current view of the counter? This image may be different on different clients, depending on counter ownership etc.

Thus spake Brent Easton:

If I understand Joel’s thinking, we will be looking at a model where any
players PC can become a server. Sort of like online multi-player games
where one player sets up as a server and everyone else connects to him.
The Central Vassal server would then become more of a ‘tracker’ that
lists what player servers are running (and marked as public) and what
games are being played. Since every Vassal instance can potentially be a
server, then if the current server goes down, the other Vassal instances
should be able to negotiate with each other and ‘choose’ a new server.

Good summary. This is the idea.


J.

Thus spake Brent Easton:

Re: Properties. Some properties (Thinking Calculated Properties from
3.2) will be un-cachable. It will not be possible to create listeners on
all items that may affect theire value.i

I don’t see it. Can you remind me of how Calculated Properties work
again?


J.

A Calculated Property is a mathematical expression using the values of other properties, some of which may be dynamically generated

Here’s an example:

Strength + Will + GetProperty(“Power”+Level)

The resulting value is the total of the Strength property plus the Will Property plus one of the Multiple PowerX properties, depending on the current value of the Level property.