Check out Omega Chess, our featured variant for September, 2024.


[ Help | Earliest Comments | Latest Comments ]
[ List All Subjects of Discussion | Create New Subject of Discussion ]
[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Single Comment

Jocly. An html-based web platform for playing 2-player abstract stategy games.[All Comments] [Add Comment or Rating]
H. G. Muller wrote on Wed, Jan 17 08:12 AM UTC in reply to François Houdebert from Mon Jan 15 02:40 PM:

I did it slightly differently: the prelude property in the game definition is now an array of objects like the one I proposed, except that I dropped the 'who' property. Each position in the array corrsponds to a turn, so it is already obvious who is on move for each prelude 'stage'.

If the array item is a zero, that turn will be passed; this is for allowing two different selections in a row by the same player, or black starting to make a selection.

I copied most of the code for the prelude model and view files from Metamachy, replacing the hard-coded locations and sizes of the selection panel and buttons by values calculated from the prelude definition. There is one thing I do differently, though: in Metamachy all pieces start on the board in a default location. (It appears this is important for them to show up later). The display function is intercepted to suppress the display of the pieces to displayed, and when a setup is selected, the pieces are first removed, and then placed back in another constellation.

As we want to be able to select from a wider range of pieces than actually has to be placed this same method could not be used anyway. So what I do is not shuffling the pieces, but 'promoting' them by altering their type. As I noticed that Jocly sorts the piece list by increasing value of the piece type (which does not seem to be essential, as on promotion during a game it doesn't resort it, but it could have efficiency ramifications for the AI), I resort the list afterwards. (This required a small change in base-model, to make the sorting available as a separate function.)

So you would typically start with pieces in all locations where you want to place any, it doesn't matter of which type. The prelude then assigns them the types that were selected for the square they are on.

If you would want a square to appear empty before the prelude (as is done in Metamachy) this could be achieved by initially placing a piece there of a type that has an invisible image. Or perhaps better, that shows up like a flat marker (a checker?) with a question mark on it. That way makes it clear which squares you are making the selection for, if there are more empty squares than pieces to place. (As is the case in Metamachy!) I will see if I can make the prelude-view automatically add such a piece to the set that is in use; in the piece-drops sub-model I do provide flat 'pieces' with a number on them, which can be put on the holdings squares to indicate how many pieces of that type you have in hand.

I tested the thing on Timorid, by adding to the game definition:

prelude: [0,{
  panelWidth: 1,
  setups: ["XQX","HQH","XHX","QHQ"],
  squares: { 1:[15,18,20], '-1':[123,126,128] }
}],

with some (nonsense) alternatives for the setup of Ships (X), Queens and Griffons (H). The 0 indicates that white passes his first turn, so that the selection is done by black (and randomly picked if the computer plays black). This give the following selection panel:

A complication is that asymmetric pieces must be defined as separate types for white and black in Jocly. This has always annoyed me, and perhaps we should fix this one day (by assigning every type two graphs, one for white and an (optionally different) one for black. Anyway, for now I solved it by allowing an optional property 'blackOffsets' in the prelude objects, which would be an object that for each relevant piece type optionally specifies how much should be added to the type number when it is black.

I kept the layout principles of the selection panel the same as was used for Metamachy: one icon size between the buttons, and half that between button and edge. This looks a bit spacey when the buttons are only a single icon high, like here. On the other hand, it would offer space to display a text under the button; perhaps I can manage that. (This would require a new optional property in the prelude object, e.g. 'subscripts', and array that contains a string for each setup.) The layout might need a larger margin at the bottom for that, though. (And perhaps there could also be a larger margin at the top, to allow you to display a message there over the full width of the panel, fiven by an optional property 'header'.)