Ludii Forum
Problems implementing Battleship - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Questions (https://ludii.games/forums/forumdisplay.php?fid=13)
+--- Forum: About the Ludii Grammar (https://ludii.games/forums/forumdisplay.php?fid=15)
+--- Thread: Problems implementing Battleship (/showthread.php?tid=394)

Pages: 1 2 3 4


RE: Problems implementing Battleship - slimy_asparagus - 03-04-2021

Eric,

The remember/forget idea works well and of course frees up state for something else.

I have hit a minor problem. I can't really make out the P1 pieces when they are in the hand. In order to address this I am trying to change P1 Colours. It's not working but I find I can't change the colour of P2 either. I have changed player colours on other projects so I am not really clearly what is going on.

I attach a .lud file.


RE: Problems implementing Battleship - MatthewStephenson - 03-04-2021

Hi,

I was just able to change the colour of player 1's pieces in the metadata, can you attach a screenshot of what you see?

Also you might need to go to the Colour tab in the preferences and click the button "Reset to Defaults"

Cheers,
Matthew


RE: Problems implementing Battleship - slimy_asparagus - 03-04-2021

(03-04-2021, 12:23 PM)MatthewStephenson Wrote: Hi,

I was just able to change the colour of player 1's pieces in the metadata, can you attach a screenshot of what you see?

Also you might need to go to the Colour tab in the preferences and click the button "Reset to Defaults"

Cheers,
Matthew


Matthew,

Thanks that works. Now I think about I have seen that trick before.


RE: Problems implementing Battleship - slimy_asparagus - 03-05-2021

(02-22-2021, 02:36 PM)Eric Piette Wrote: Talking about your description, I am not sure about why you are using waves pieces. That should be just something to do in the graphics and the waves pieces do not seem necessary for that game.


Okay I am ready to return to this issue. The basic mechanics of the game are in place and I just need to make sure I am conveying enough information to the users (without relying on "show legal moves" and "show last move" which I am doing at the moment).

For the home area, the player needs to know what the opponent hit (water or ship) and where. It does not affect game play but it is part of the experience: seeing how close they came, knowing how much you have left etc.

For the attack area, the player needs to know what he hit (water, ship, size of ship) and where. This does affect game play.

So I am proposing to use the waves svg for a miss and the rubble svg for a hit. This convention should work in both attack and defence areas so they are set up as sites are revealed.

If we really hold to the principle that I should not have Waves pieces, then I need a graphical meta-data way of saying place a waves symbol on an empty site if that site has such and such a state. I think it would be simpler to have a Shared Waves piece and simply place one in the event of a miss, but it does not matter to me.

To achieve the rubble I am trying to do the following

Code:
        (piece Rename piece:"Carrier" "square" state:0)
        (piece Rename piece:"Battleship" "square" state:0)
        (piece Rename piece:"Destroyer" "square" state:0)
        (piece Rename piece:"Submarine" "square" state:0)
        (piece Rename piece:"PatrolBoat" "square" state:0)
        (piece Rename piece:"Carrier" "rubble" state:("Hit"))
        (piece Rename piece:"Battleship" "rubble" state:("Hit"))
        (piece Rename piece:"Destroyer" "rubble" state:("Hit"))
        (piece Rename piece:"Submarine" "rubble" state:("Hit"))
        (piece Rename piece:"PatrolBoat" "rubble" state:("Hit"))
However this gives one of those "The game could not be compiled, but no specific error was identified" errors. In fact any attempt to make (piece Rename ) dependent on state does this. I have added a .lud file.


RE: Problems implementing Battleship - slimy_asparagus - 03-09-2021

Just bumping this on hope of some more progress. Thanks.


RE: Problems implementing Battleship - MatthewStephenson - 03-10-2021

Hi,

Quote:If we really hold to the principle that I should not have Waves pieces, then I need a graphical meta-data way of saying place a waves symbol on an empty site if that site has such and such a state. I think it would be simpler to have a Shared Waves piece and simply place one in the event of a miss, but it does not matter to me.

I'm not sure exactly what you discussed with Eric. but you can specify a dynamic region inside a metadata line, for example, the following would add a wave symbol to all empty sites

(show Symbol "water" (sites Empty))

NOTE. This actually doesn't work with v1.1.16, due to a bug in show Symbol, so in the meantime you can use the following code to colour the region as a substitute to check that it works how you want. 

(region Colour (sites Empty) (colour 150 150 150))

You can replace it with the correct line in the next release.

You will also need to add this line to your metadata (board RedrawAfterMove). To let the app know that the board needs to be redrawn each move, as you are using a dynamic region in its creation.


Quote:However this gives one of those "The game could not be compiled, but no specific error was identified" errors. In fact any attempt to make (piece Rename ) dependent on state does this. I have added a .lud file.

You need to place the state: parameter before the rename String, eg.

(piece Rename piece:"Carrier" state:0 "square")


Cheers,
Matthew


RE: Problems implementing Battleship - slimy_asparagus - 03-10-2021

Matthew,

Thanks. You are of course correct that I missed the detail of the ordering in the grammar.

I'll have to wait for the next release to get a convincing view on the other issue, as the work around didn't do exactly what I expected.

Nicholas


EDIT: I think I spotted what was wrong. What I need is
Code:
(region Colour (difference (sites Empty) (sites Hidden)) (colour 150 150 150))


However this is giving me a non-specific compile error. I attach a  .lud file.


RE: Problems implementing Battleship - MatthewStephenson - 03-11-2021

Hi,

For (sites Hidden), you need to specify which player.

e.g. (sites Hidden to:Mover)

Cheers,
Matthew


RE: Problems implementing Battleship - slimy_asparagus - 04-27-2021

I really have to put Battleships on hold whilst I have this issue: https://ludii.games/forums/showthread.php?tid=554&pid=2543#pid2543 . This is a shame because it was pretty close.


RE: Problems implementing Battleship - slimy_asparagus - 04-30-2021

(04-27-2021, 02:29 PM)slimy_asparagus Wrote: I really have to put Battleships on hold whilst I have this issue: https://ludii.games/forums/showthread.php?tid=554&pid=2543#pid2543 . This is a shame because it was pretty close.

Okay now that I have worked out I can start making progress by restarting Ludii, we're in business.

So the advice discussed previously worked. 

I do however have a new issue. The ships, as they are being moved, appear to be too wide and look wrong. I can't send a picture because I can't take a picture without releasing the piece when it changes.
 
I attach the .lud.