Quote (kasey21 @ 17 Oct 2018 01:44)
Ah. I said making a console program which makes it sound like Linux. I guess I should have phrased it as a CLI program? I am programming in windows.
I assumed as much...
Quote (Muted @ 17 Oct 2018 01:03)
IIRC: 25h x 80w is the default size from Windows 95+.
Technically: system(const char*)
is from the C-library, so... I guess I should simply accept that (despite it being horrible in many ways); but do not allow me to discourage you with that.
There are quite a few ways you could output the game state ("images") to the screen and update it per-move. Although you're quite limited (without a fun imagination).
I'm assuming, based on your statements: You're wanting to draw some sort of grid (and I do not remember how large in terms of X * Y cells exist on a standard Battleship board).
I would suggest that you create quite a few objects to handle this:
"sprites" - Anything displayable (a water tile? a water tile that was hit (missed shot)? a ship piece? a ship piece that was hit?)
"ships" (composed of array(s) of sprites)
The networking part should equally be simple to handle for "PvP" as you said; you only need to share (UDP?) the desired X/Y coordinate that was attacked.
Player 1 'attacks' coordinate: [0, 0]
Player 2 receives message -> "attack at 0, 0"
If player 2's ship was hit: Player 2 responds with a message -> "hit ship at 0, 0" (if it was a killing blow: send another message or send the data all in one message)
If player 2's ship was not hit: You can default with a timeout or waste bandwith and have player 2 reply that "no ship was hit."
The same logic applies when player 2's turn is active.
The real fun begins when you have 8 players all playing against each other at once! Simultaneous moves (to speed up game-time). Similar to Civilization IV's style. This post was edited by Muted on Oct 17 2018 12:54am