Ludii Forum
gif features and instruction features - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Suggestions (https://ludii.games/forums/forumdisplay.php?fid=10)
+--- Forum: Ludii Features / Services (https://ludii.games/forums/forumdisplay.php?fid=11)
+--- Thread: gif features and instruction features (/showthread.php?tid=712)



gif features and instruction features - dale walton - 09-16-2021

I tried the gif feature on the game menu (not yet described in the documentation)

Despite the message "Gif images taken" I could find no new files on my PC (Ubuntu) Where are they being saved to?

Failed to load module "canberra-gtk-module"
Exception in thread "Timer-2" java.lang.NullPointerException
at app.display.screenCapture.ScreenCapture$2.run(ScreenCapture.java:141)
at java.base/java.util.TimerThread.mainLoop(Timer.java:556)
at java.base/java.util.TimerThread.run(Timer.java:506)
Exception in thread "Timer-3" java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
at java.base/java.util.Objects.checkIndex(Objects.java:372)
at java.base/java.util.ArrayList.get(ArrayList.java:459)
at app.display.screenCapture.ScreenCapture$3.run(ScreenCapture.java:169)
at java.base/java.util.TimerThread.mainLoop(Timer.java:556)
at java.base/java.util.TimerThread.run(Timer.java:506)
Gif images taken.
Exception in thread "Timer-5" java.lang.NullPointerException
at app.display.screenCapture.ScreenCapture$2.run(ScreenCapture.java:141)
at java.base/java.util.TimerThread.mainLoop(Timer.java:556)
at java.base/java.util.TimerThread.run(Timer.java:506)
Gif images taken.
Exception in thread "Timer-6" java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
at java.base/java.util.Objects.checkIndex(Objects.java:372)
at java.base/java.util.ArrayList.get(ArrayList.java:459)
at app.display.screenCapture.ScreenCapture$3.run(ScreenCapture.java:169)
at java.base/java.util.TimerThread.mainLoop(Timer.java:556)
at java.base/java.util.TimerThread.run(Timer.java:506)
Failed to load module "canberra-gtk-module"
Exception in thread "Timer-2" java.lang.NullPointerException

I also tried the new Instruction generation feature.  This looks very interesting. unlike gif generation a window opened showing a game in progress. attached is a picture of my screen.  In the end, however there were no files saved to my PC. And the player ended up in the state of the gif view, which when dragged open further had no tabs for status, moves, turns ... - Even after reloading the game using the recent tab and/or the load game tab. The following errors occurred when reloading.
Quitting and restaring solved that issue.

Process complete.
dale@dale-system-pro:~/Ludii$ Failed to load module "canberra-gtk-module"
Failed: command not found
dale@dale-system-pro:~/Ludii$ Exception in thread "Timer-2" java.lang.NullPointerException
Exception: command not found
--------------------------------------------------

For the instruction generation everything looked OK

The monitor messages indicated successful completion:

Trials Generated.
..........
Moves Recorded.

Total of 8 condensed moves found.
Total of 2 ending moves found.
------------------------
Move 1/8
Taking Before Screenshot
Taking Gif Animation
Gif images taken.
Taking After Screenshot
Gif images saved.
------------------------
Move 2/8
Gif animation completed.
Taking Before Screenshot
Taking Gif Animation
Gif images taken.
Taking After Screenshot
Gif images saved.
------------------------
Move 3/8
Gif animation completed.
Taking Before Screenshot
Taking Gif Animation
Gif images taken.
Taking After Screenshot
Gif images saved.
------------------------
Move 4/8
Gif animation completed.
Taking Before Screenshot
Taking Gif Animation
Gif images taken.
Taking After Screenshot
Gif images saved.Process complete.
dale@dale-system-pro:~/Ludii$ Failed to load module "canberra-gtk-module"
Failed: command not found
dale@dale-system-pro:~/Ludii$ Exception in thread "Timer-2" java.lang.NullPointerException
Exception: command not found

------------------------
Move 5/8
Gif animation completed.
Taking Before Screenshot
Taking Gif Animation
Gif images taken.
Taking After Screenshot
Gif images saved.
------------------------
Move 6/8
Gif animation completed.
Taking Before Screenshot
Taking Gif Animation
Gif images taken.
Taking After Screenshot
Gif images saved.
------------------------
Move 7/8
Gif animation completed.
Taking Before Screenshot
Taking Gif Animation
Gif images taken.
Taking After Screenshot
Gif images saved.
------------------------
Move 8/8
Gif animation completed.
Taking Before Screenshot
Taking Gif Animation
Gif images taken.
Taking After Screenshot
Gif images saved.
------------------------
Move image generation complete.
Gif animation completed.
------------------------
End 1/2
Taking Before Screenshot
Taking Gif Animation
Gif images taken.
Taking After Screenshot
Gif images saved.
------------------------
End 2/2
Gif animation completed.
Taking Before Screenshot
Taking Gif Animation
Gif images taken.
Taking After Screenshot
Gif images saved.
------------------------
Ending image generation complete.
Gif animation completed.
------------------------
Generating html file.
Process complete.


RE: gif features and instruction features - MatthewStephenson - 09-16-2021

Hi Dale,

Apologies, this functionality is still in-progress and wasn't meant to be included in the last release...
Once it is complete I will add some instructions on its use in the release notes.

Cheers,
Matthew


RE: gif features and instruction features - dale walton - 09-19-2021

Looks like a nice functionality! - hope it come out soon....


RE: gif features and instruction features - MatthewStephenson - 09-20-2021

Hi Dale,

We just released a new .jar which officially contains this functionality (in beta form). Details on this new feature are provided below:

The "Game GIF" menu options will ask you for a desired number of frames, after which this many frames will be recorded of the Ludii app display, and combined into a single gif image.
This option is useful for recording an animation of a specific move.

The "Game Manual Generation (Beta)" menu option under the developer settings will attempt to automatically generate a manual for the loaded game. The application should not be moved or minimised during this process, and will be completed once the message "Process complete" is printed in the terminal (we recommend running Ludii from the terminal in order to see this). Manual generation combines many different aspects, including english translation of the game rules, strategy explanation, move visualisation, etc. For more details on this, we have released a preprint paper describing the process (https://ludii.games/manuals/Automatic%20Generation%20of%20Board%20Game%20Manuals.pdf). Please note that this work is still very much in-progress, and the english translations are not expected to be perfect. The final output is stored in a folder called "game_manuals", as an "output.html" file.


RE: gif features and instruction features - dale walton - 09-22-2021

Hi, I had a chance to try it.  It does surprisingly well, but for my games, far from understandable.

For this particular game:
A ludeme for "not crossing a connection <defined by a knight's move>  <between friendly "Balls"> " would help some.  Being able to define the "I" pieces as "Connections between friendly pieces", and/or having the description generator realize that they do not affect the rules of play logically (in this game)

and/or allowing named connection types to be a kind of dynamic container name for pairs of sites with a logical condition, so that I could define "knight connections" with some logic related to the contents and distance and direction between any two sites, and then refer to those matching connections in the game script by the defined name.  eg to define groups, enclosure, blocked crossings and so on related to the set of them

or allowing connections (if not part of the play rules) to be part of the meta data, for example adding a dynamic ludeme to graphics:
(show connection  from:... to:...  if:(expression based on both (from) and (to) that causes the connection to be shown if true) ...  image:... fillColour:....  edgeColour:... rotation:... scale:...)

For games in general:
I would also like to suggest that you add an option to  (define) to include the text to use to replace the details of the define in the generated rules.

If the text does not exist, you generate in the way you have done.  If it does exist, you substitute that wording for the detailed text, and later add a statement starting with that define wording to state what it means and put the details there.  If you see that script writers invent descriptions that are obvious in meaning, they could omit the description in the define, or you could decide a new ludeme is needed for it. 


Here is a generated description of how player 2 should move in the game I was testing:
Move: Add Ball of the moving player to the set of empty cells then if can move leap a piece to Player at to is the mover, not Ball of the moving player is in the intersection of the number of sites within 1 spaces of to includeOrigin: false and the number of sites within 1 spaces of the to location of the last move includeOrigin: false and 2 is greater than the number of null in the region the intersection of the number of sites within 1 spaces of to includeOrigin: false and the number of sites within 1 spaces of the to location of the last move includeOrigin: false, for all values in the results of applying site 0 of region the difference between all Edges that are incident of Cell site 0 of region the intersection of the number of sites within 1 spaces of to includeOrigin: false and the number of sites within 1 spaces of the to location of the last move includeOrigin: false and the difference between all Edges that are incident of Cell site 0 of region the intersection of the number of sites within 1 spaces of to includeOrigin: false and the number of sites within 1 spaces of the to location of the last move includeOrigin: false and all Edges that are incident of Cell site 1 of region the intersection of the number of sites within 1 spaces of to includeOrigin: false and the number of sites within 1 spaces of the to location of the last move includeOrigin: false from the to location of the last move to the to sites of leap a piece to Player at to is the mover, not Ball of the moving player is in the intersection of the number of sites within 1 spaces of to includeOrigin: false and the number of sites within 1 spaces of the to location of the last move includeOrigin: false and 2 is greater than the number of null in the region the intersection of the number of sites within 1 spaces of to includeOrigin: false and the number of sites within 1 spaces of the to location of the last move includeOrigin: false add I of the moving player then set the state of the Edge state variable "ToEdge" to add the following values: [1,if site 0 of region all Cells that are incident of Edge state variable "ToEdge" is equal to the Cell 1 steps ahead of site 1 of region all Cells that are incident of Edge state variable "ToEdge" in the direction east or site 0 of region all Cells that are incident of Edge state variable "ToEdge" is equal to the Cell 1 steps ahead of site 1 of region all Cells that are incident of Edge state variable "ToEdge" in the direction west then 0 otherwise 2] and if can move leap a piece to Player at to is the mover, not Ball of the moving player is in the intersection of the number of sites within 1 spaces of to includeOrigin: false and the number of sites within 1 spaces of the to location of the last move includeOrigin: false and 2 is greater than the number of null in the region the intersection of the number of sites within 1 spaces of to includeOrigin: false and the number of sites within 1 spaces of the to location of the last move includeOrigin: false, for all values in the results of applying site 0 of region the difference between all Edges that are incident of Cell site 0 of region the intersection of the number of sites within 1 spaces of to includeOrigin: false and the number of sites within 1 spaces of the to location of the last move includeOrigin: false and the difference between all Edges that are incident of Cell site 0 of region the intersection of the number of sites within 1 spaces of to includeOrigin: false and the number of sites within 1 spaces of the to location of the last move includeOrigin: false and all Edges that are incident of Cell site 1 of region the intersection of the number of sites within 1 spaces of to includeOrigin: false and the number of sites within 1 spaces of the to location of the last move includeOrigin: false from the to location of the last move to the to sites of leap a piece to Player at to is the mover, not Ball of the moving player is in the intersection of the number of sites within 1 spaces of to includeOrigin: false and the number of sites within 1 spaces of the to location of the last move includeOrigin: false and 2 is greater than the number of null in the region the intersection of the number of sites within 1 spaces of to includeOrigin: false and the number of sites within 1 spaces of the to location of the last move includeOrigin: false add I of the moving player then set the state of the Edge state variable "ToEdge" to add the following values: [2,if site 0 of region all Cells that are incident of Edge state variable "ToEdge" is equal to the Cell 1 steps ahead of site 1 of region all Cells that are incident of Edge state variable "ToEdge" in the direction east or site 0 of region all Cells that are incident of Edge state variable "ToEdge" is equal to the Cell 1 steps ahead of site 1 of region all Cells that are incident of Edge state variable "ToEdge" in the direction west then 0 otherwise 2] and Each turn, where the site is within the number of sites within 1 spaces of the to location of the last move includeOrigin: false, Player at current site is the mover, remove pieces at site 0 of region the difference between all Edges that are incident of Cell current site and the difference between all Edges that are incident of Cell current site and all Edges that are incident of Cell thefor the to location of the last move and Each turn, where the site is within all Edges that are incident of Cell the to location of the last move, current moving player is equal to Player at current site, remove pieces at current site and moves with priority: for all values in if 0 is equal to the number of sites in the intersection of Marked: the union of the corner sites of the board and the centre sites of the board for Neutral and the set of empty cells or 1000000000 is equal to the number of Adjacent step orthogonal from Cell current value to the intersection of Marked: the union of the corner sites of the board and the centre sites of the board for Neutral and the set of empty cells, trigger Enmeshed for Player the next player and set the state of the Cell current value to 1, if 0 is equal to the number of sites in the intersection of Marked: the union of the corner sites of the board and the centre sites of the board for Neutral and the set of empty cells or 1000000000 is equal to the number of Adjacent step orthogonal from Cell the to location of the last move to the intersection of Marked: the union of the corner sites of the board and the centre sites of the board for Neutral and the set of empty cells, trigger Enmeshed for Player the moving player and set the state of the Cell the to location of the last move to 1 and for all values in if 0 is equal to the number of sites in the intersection of Marked: the union of the corner sites of the board and the centre sites of the board for Neutral and the set of empty cells or 1000000000 is equal to the number of Adjacent step orthogonal from Cell current value to the intersection of Marked: the union of the corner sites of the board and the centre sites of the board for Neutral and the set of empty cells, set the state of the Cell current value to 1


RE: gif features and instruction features - MatthewStephenson - 09-22-2021

Hi Dale,

Thanks for your feedback.



Quote:I would also like to suggest that you add an option to  (define) to include the text to use to replace the details of the define in the generated rules.


We did plan to include this functionality, however there are some technical issues that we need to address first so I cannot say when this will be added.

Cheers,
Matthew


RE: gif features and instruction features - dale walton - 09-28-2021

Good to know. As it is a general solution, it makes sense that there could be obstacles to implementation.

------------------------
What about the other more specific suggestion that the graphics metadata be capable of automatically generating connection graphics between designated conditional pairs of sites, without having to define pieces for the purpose, just a line width or a graphic to use. eg show connection <image> for <move> . such as (step or leap {{ ... }} if:(= (who at:(from)) (who at:(to)))) -- Are there other games that would benefit from such visual elements, where connectivity is separately defined?

Or instead, should their be a ludeme about blocked knight's movement where the connectors become the most efficient way to describe the blocked connectivity, and thus play a real role in the game definition?

In my game I imagine generated rules should read something like:

"The game ends if the mover's "Ball" piece is blocked by the next player's "Ball" pieces and knight's connections from stepping orthogonally to an empty marked region or if the next player's "Ball" piece is blocked by the mover's "Ball" pieces and knight's connections from stepping orthogonally to an empty "Marked" region."

Or:

"A player's Ball piece is "Enmeshed" if it is blocked by the Enemy Ball pieces or by knight's leap connections between the Enemy Ball pieces, from stepping to an empty "Marked" region. The game ends if the Mover's Ball or Next Player's Ball is "Enmeshed." The score is the count of a player's "Enmeshed" Ball pieces times -1. The player with the higher score wins, If the score is the same, the mover loses."

But the ludemes to describe the game logic in this simple way don't yet exist.


RE: gif features and instruction features - Eric Piette - 09-28-2021

Hi,

I can just answer the ludeme part of your comment.
I do not think such a ludeme would be useful, but I am maybe wrong... Can you give a list of games using that mechanism? Or show us a close mechanism in other games?

Concerning the graphics metadata part, I am letting Matthew answer it.

Regards,
Eric