Ludii Forum
piece Reflect not working - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Problems (https://ludii.games/forums/forumdisplay.php?fid=5)
+--- Forum: Game Problems (https://ludii.games/forums/forumdisplay.php?fid=17)
+--- Thread: piece Reflect not working (/showthread.php?tid=566)



piece Reflect not working - slimy_asparagus - 05-15-2021

Code:
       (piece Rename piece:"General" "rook")
        (piece Reflect P2 "General" vertical:true)
I have noticed that this code is not working in Spartan chess in 1.1.17.
It is working in 1.1.16.


RE: piece Reflect not working - MatthewStephenson - 05-17-2021

Hi,

Unfortunately we had to remove the reflect functionality due to technical issues, apologies it should have been mentioned in the release notes.

You can still rotate the pieces, but if you need an SVG reflected let us know which ones and we can try to include a separate reflected version of the image.

Cheers,
Matthew


RE: piece Reflect not working - slimy_asparagus - 05-17-2021

The 1.1.17 code that would need changing is as follows:



Code:
        (piece Rename piece:"Hoplite" "pawn")
        (piece Reflect P2 "Hoplite" vertical:true)

        (piece Rename piece:"General" "rook")
        (piece Reflect P2 "General" vertical:true)
        (piece Rename piece:"Warlord" "bishop")
        (piece Reflect P2 "Warlord" vertical:true)
The warlord is a combined knight-bishop but there is already an SVG like that.

The general is like a combined king-rook, if you wanted to create an SVG that reflected that.

A hoplite could be something more thematic.

However personally I would prefer them as I had them. That would also mean that the text rules would not need updating.

I searched the 1.1.17 jar file for "piece Reflect" and I found:

Code:
Ludii-1.1.17/lud/board/war/chess/Spartan Chess.lud
Ludii-1.1.17/lud/board/war/shogi/Minishogi.lud
Ludii-1.1.17/lud/board/war/shogi/Tobi Shogi.lud
Ludii-1.1.17/lud/board/war/shogi/Tai Shogi.lud
Ludii-1.1.17/lud/board/war/shogi/Dice Shogi.lud
Ludii-1.1.17/lud/board/war/shogi/Taikyoku Shogi.lud
Ludii-1.1.17/lud/board/war/shogi/Shogi.lud
Ludii-1.1.17/lud/board/war/shogi/Kyoto Shogi.lud
Ludii-1.1.17/lud/board/war/shogi/Hasami Shogi.lud
Ludii-1.1.17/lud/math/hand/Chopsticks.lud
Ludii-1.1.17/lud/math/hand/Morra.lud
Ludii-1.1.17/lud/puzzle/planning/Shogi Puzzle.lud
Ludii-1.1.17/lud/experimental/Goats Wintering.lud
Ludii-1.1.17/help/EditorHelp.txt



RE: piece Reflect not working - MatthewStephenson - 05-18-2021

Hi,

All of our games (should) have been updated to remove the reflect code in our latest release (1.1.19).

For spartan Chess if you want a piece to be facing downwards rather than upwards you can rotate it by 180 degrees instead of reflecting it vertically (piece Rotate P2 "General" degrees:180).

If there are any pieces that you need reflected horizontally, please be explicit exactly what their svg names are in Ludii (v1.1.19), you can use the View->View SVG menu option to see all image names, and I will try to add reflected versions of these.

Cheers,
Matthew


RE: piece Reflect not working - xenos1984 - 05-18-2021

(05-17-2021, 08:22 AM)MatthewStephenson Wrote: Unfortunately we had to remove the reflect functionality due to technical issues, apologies it should have been mentioned in the release notes.

Would you mind elaborating what kind of issues? I'm just asking for curiosity - it's a bit puzzling how rotating can be done, but reflecting cannot.


RE: piece Reflect not working - cambolbro - 05-18-2021

Hi,

Our image generation code has undergone some changes in preparation for the upcoming Ludii web player and reflection was one of the casualties.

We've written our own SVG rendering code that reads the *.svg file for each piece, manipulates the colours according to its owner, then renders the shapes to a BufferedImage image suitable for all platforms. Any transforms have to be applied during the render; rotation is not a problem but having to reflect a rotated image during rendering, while juggling between coordinate systems, became too much of a headache (note that we don't support SVG transforms, any transformation has to be manually applied). It's doable but will require our SVG rendering code to be reorganised to avoid some ugly and repetitive code.

In the meantime, we've opted for the simpler solution of disallowing reflection and just using duplicate reflected copies of *.svg images as needed. Just let us know which images you'd like reflected and we'll add them.

Regards,
Cameron


RE: piece Reflect not working - xenos1984 - 05-18-2021

Thanks, Cameron, for the detailed explanation! That indeed helped me understanding. In fact, I don't have a particular use case at the moment, but I'll keep it in mind.


RE: piece Reflect not working - slimy_asparagus - 05-21-2021

I attach a version of Spartan Chess with the fix. I would suggest that this should have been done for all uses of (piece Reflect ), but I don't know those other games.


RE: piece Reflect not working - Eric Piette - 05-25-2021

Ok I updated the file. You did not rotate the king pieces, is it normal?


RE: piece Reflect not working - slimy_asparagus - 05-25-2021

(05-25-2021, 06:47 AM)Eric Piette Wrote: Ok I updated the file. You did not rotate the king pieces, is it normal?
The rules for the Kings are almost identical. They move the same. The differences all resolve around the fact that Black has 2 Kings rather than 1. As such I think it is best to use the same symbol for them. They even have the same name.

In contrast the rotated rooks, bishops and pawns all represent different pieces with different names.