In the game I'm writing I want the state of the board to be updated for each player after each turn, but I don't understand how to pass info between computer's or how to connect them. Hear is the code thanks. …

Thumbs up +1

I'm not really a fan of posts that just toss a link and a vague question out there, but I'll do my best.

Without even reading the code, can you give a bit more info? What language is this coded in? What kind of game is this?
Some general principals you might want to be aware of:
Usually, this sort of thing requires a server - a central machine that all players connect over the internet to. The server accepts data from each player and sends responses to everyone. If you have 3 players and a 2 dimensional grid that players can "walk" around, when one player moves, in the simplest case that player's game client tells the server in what direction it moved, and the server will send that along to all other players. This assumes that all players know where each other are on this hypothetical grid.
The server is the authority on game state (if this is a board game, where the pieces are, what players have pieces, etc). So to advance the game, it follows that game clients must report what the actual player does (chooses a card, moves a piece, fires a gun, whatever). The server then (in the simplest case) updates it's internal state of the game and might or might not send messages to game clients reflecting such changes.
Clients will of course need to react to this after updating their state; updating the interface,  playing sounds, speaking messages are all normal things it might do.
As for "how", you use network sockets. Your language (if it isn't just a basic scripting language), almost certainly has a socket API, or can call out to one.
Decide on a protocol, code your server, update your client so that it can update it's internal state from the server.
In your game, your client should open a connection to the server (embed the IP / domain or accept user input for it) and begin sending and accepting game state messages and reacting as necessary.
If you want more specific advice, be more specific about your question(s).

Thumbs up +2

3 (edited by rpgtank 2017-04-19 02:39:10)

This game is written in bgt. It is a computer version of mankala. The game is played by 2 people. Each person has a row of 8 holes in front of them with 4 stones in each hole. Their are also 2 holes at either end of the board. A player is either on the bottom or top row and can view the other row, but cannot pick up stones from it. Each time a player picks up stones from hole 6, for example, the stones in that will be put in holes 5 and lower, with the goal of getting a stone in the far left hole if the player is on the bottom row. If the player is on the top row, the situation is reversed. If either player's stones go beyond the far left or right holes, for example, they are at hole 2 and pick up 4 stones, 1 stone will go in the other player's row. After each turn, I wont the board to be refreshed for each player. I've copied and ran the code from the examples from the network chapter of the bgt manual, running the server example on 1 computer and the client example on another, opened port 10000 on both, since that is what the example uses, and I still couldn't get the computers to connect. What am I doing wrong?

Thumbs up

You will want to use the network object. If you want the game to support an arbitrary number of players, or allow people to connect to anyone who happens to be online, you'll need a server. If it's more of a 1-4 player game, you could get away with letting players connect to each other privately, without need for a server (similar to how Top Speed 3 handles multiplayer). The end result is much the same, except that processing handled by the server is handled by the clients (or one "host" client, since that model tends to reduce state conflicts).
The network object is a little cumbersome to remember, so I recommend keeping the bgt manual on hand for reference. It's not that complicated, but there are a few things to be aware of. For example, BGT is not multithreaded, so any substantial pauses in the updating of the network object will result in a disconnect. That means you cannot use multiplayer with the alert, input_box, or question functions, and if you use a dynamic_menu, you'll need to use the callback feature to keep the connection active.
But the actual communication between clients is handled by messages, sent through a network_event object. So, all you need to do is send messages telling the peers when a change has occurred, and do ordinary string checks to tell what the change is.

This is not the most effective example, but I like to separate input into two layers: the outer most layer poles for keyboard, mouse, joystick, or network events. The event handlers convert the key, button, movement, or network message into a constant, which is sent to the inner layer. The inner layer then determines what action corresponds to the event constant, and invokes the appropriate methods\functions. This is not enough for a game where precise timing is essential, and it is not enough to handle cases where the players get out of sync, but it makes input more moduler, which makes adding extra input methods much easier.

Thumbs up