Skip to main content
Post Reopened by CommunityBot
deleted 718 characters in body; edited tags; edited title
Source Link
user1430
user1430

Communicating World State via How can I communicate changes to a 2D tile-based world state in a P2P context?

Suppose you and another client wantedtwo players in a game want to build a city together on a blank tile-based game world simultaneously. via P2P You clickedsimultaneously in a peer-to-peer connected context.

When a player clicks on tiles and changed their 'state' ora tile ID. This changedit changes the respective valuestate (sor tile ID) onof that tile, which is saved into a text file which the renderer was responsible for later reading and interpretingby the worldrenderer.

Here you modify the 2,7,12,17 tiles. For example, in the image below a player has modified some tiles from "empty" (1) to "road" (2):

enter image description here

What would be the algorithm/approach to do this?

From what What method should I imagine so far it would be:


Client 1:

  1. Select Tile 2,7,12,17 ID {01} from event listener.

  2. Modify text file values 2,7,12,17 from {01} to {02}

  3. Send Packets to other client of 2,7,12,17 modifications.

  4. Check Incoming Packets.

  5. Refresh Screen


Client 2:

  1. [no change]

  2. [nothing to modify yet]

  3. [nothing to send]

  4. Receive packet to change 2,7,12,17 from{01} to {02} Append file

  5. Refresh Screen


Is this the Universal approachemploy to transmit these changes to connected peer-to-peer clients? Pardon my knowledge on game design, I was never taught it.

Also would an 2D Array be faster than a text file for storing ID values for the renderer?

Communicating World State via P2P

Suppose you and another client wanted to build a city together on a blank tile-based world simultaneously. via P2P You clicked on tiles and changed their 'state' or tile ID. This changed the respective value(s) on a text file which the renderer was responsible for reading and interpreting the world.

Here you modify the 2,7,12,17 tiles.

enter image description here

What would be the algorithm/approach to do this?

From what I imagine so far it would be:


Client 1:

  1. Select Tile 2,7,12,17 ID {01} from event listener.

  2. Modify text file values 2,7,12,17 from {01} to {02}

  3. Send Packets to other client of 2,7,12,17 modifications.

  4. Check Incoming Packets.

  5. Refresh Screen


Client 2:

  1. [no change]

  2. [nothing to modify yet]

  3. [nothing to send]

  4. Receive packet to change 2,7,12,17 from{01} to {02} Append file

  5. Refresh Screen


Is this the Universal approach? Pardon my knowledge on game design, I was never taught it.

Also would an 2D Array be faster than a text file for storing ID values for the renderer?

How can I communicate changes to a 2D tile-based world state in a P2P context?

Suppose two players in a game want to build a city together on a blank tile-based game world simultaneously in a peer-to-peer connected context.

When a player clicks on a tile it changes the state (or tile ID) of that tile, which is saved into a text file for later reading by the renderer.

For example, in the image below a player has modified some tiles from "empty" (1) to "road" (2):

enter image description here

What method should I employ to transmit these changes to connected peer-to-peer clients?

deleted 198 characters in body; edited title
Source Link

Suppose you and another client wanted to build a city together on a blank tile-based world simultaneously. via P2P You clicked on tiles and changed their 'state' or tile ID. This changed the respective value(s) on a text file which the renderer was responsible. Inorder to read for reading and interpretinterpreting the world.

Here you modify the 2,7,12,17 tiles.

enter image description here

What would be the algorithm/approach for 'real-time' rendering fromto do this?

From what I imagine so far it would be:


Client 1:

  1. Select Tile 2,7,12,17 ID {01} from event listener.

  2. Modify text file values 2,7,12,17 from {01} to {02}

  3. Send Packets to other client of 2,7,12,17 modifications.

  4. Check Incoming Packets.

  5. Refresh Screen


Client 2:

  1. [no change]

  2. [nothing to modify yet]

  3. [nothing to send]

  4. Receive packet to change 2,7,12,17 from{01} to {02} Append file

  5. Refresh Screen


Is this the Universal approach? Pardon my knowledge on game design, I was never taught it.

Also would an 2D Array be faster than a text file that is constantly modifiedfor storing ID values for the renderer?

Suppose you and another client wanted to build a city together on a blank tile-based world simultaneously. via P2P You clicked on tiles and changed their 'state' or tile ID. This changed the respective value(s) on a text file which the renderer was responsible. Inorder to read and interpret the world.

Here you modify the 2,7,12,17 tiles.

enter image description here

What would be the algorithm/approach for 'real-time' rendering from a text file that is constantly modified?

Suppose you and another client wanted to build a city together on a blank tile-based world simultaneously. via P2P You clicked on tiles and changed their 'state' or tile ID. This changed the respective value(s) on a text file which the renderer was responsible for reading and interpreting the world.

Here you modify the 2,7,12,17 tiles.

enter image description here

What would be the algorithm/approach to do this?

From what I imagine so far it would be:


Client 1:

  1. Select Tile 2,7,12,17 ID {01} from event listener.

  2. Modify text file values 2,7,12,17 from {01} to {02}

  3. Send Packets to other client of 2,7,12,17 modifications.

  4. Check Incoming Packets.

  5. Refresh Screen


Client 2:

  1. [no change]

  2. [nothing to modify yet]

  3. [nothing to send]

  4. Receive packet to change 2,7,12,17 from{01} to {02} Append file

  5. Refresh Screen


Is this the Universal approach? Pardon my knowledge on game design, I was never taught it.

Also would an 2D Array be faster than a text file for storing ID values for the renderer?

deleted 198 characters in body; edited title
Source Link

Rendering a Tile Based Game in real time Communicating World State via P2P?

Suppose you and another client wanted to build a city together on a blank tile-based world simultaneously. i.e.via P2P You clicked on tiles and changed their 'state' or tile ID.This would be sent This changed the respective value(s) on a text file which the renderer was responsible. Inorder to read and interpret the other client as wellworld.

Here you modify the 2,7,12,17 tiles.Here you modify the 2,7,12,17 tiles.

enter image description here

HowWhat would the tile IDs be storedthe algorithm/approach for 'real-time' rendering from a text file that is constantly modified?

Would there be two text files open on each client (which the rendering system reads) with filereading/filewriting streams open that the packet interpreter modifies? (so the file will never close)

I apoligize I cant give be more specific as to be honest I don't even know how e.g. Simcity loads the buildings and reads them when opening a game.

Rendering a Tile Based Game in real time P2P?

Suppose you and another client wanted to build a city together on a blank world simultaneously. i.e. P2P You clicked on tiles and changed their 'state'.This would be sent to the other client as well.

Here you modify the 2,7,12,17 tiles.

enter image description here

How would the tile IDs be stored?

Would there be two text files open on each client (which the rendering system reads) with filereading/filewriting streams open that the packet interpreter modifies? (so the file will never close)

I apoligize I cant give be more specific as to be honest I don't even know how e.g. Simcity loads the buildings and reads them when opening a game.

Communicating World State via P2P

Suppose you and another client wanted to build a city together on a blank tile-based world simultaneously. via P2P You clicked on tiles and changed their 'state' or tile ID. This changed the respective value(s) on a text file which the renderer was responsible. Inorder to read and interpret the world.

Here you modify the 2,7,12,17 tiles.

enter image description here

What would be the algorithm/approach for 'real-time' rendering from a text file that is constantly modified?

Post Closed as "Needs details or clarity" by Anko, CommunityBot
Source Link
Loading