Skip to content

fractalbach/fractalnet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FractalNet

Build Status GoDoc Go Report Card

Message Examples

Location of WebSocket:

/ws

Notes:

  • The name of the field does matter.
  • The order of the fields does not matter.

Chat

{
    "EventType": "Chat",
    "EventBody": "Hello World!",
}    

Drop Bomb 💣 onto a Square (for the Game of War)

Note: The "Value" field must be either 1 or 2. It corresponds to Player 1 or Player 2. Without entering that field, the message might be ignored.

{
    "EventType": "LaBomba",
    "Value": 1,
    "Location": 
    {
        "X": 0,
        "Y": 47,
    }
}    

Update to the Next Generation (Life Update)

{
    "EventType": "LifeUpdate",
}

Directly Change a Square (Life Change)

Currently, the Grid is 48 x 48. So the Location coordinates x and y are in the range of [0, 47].

Values match with different kinds of squares (can depend on the game). For example, in "The Game of War":

  • 0: neutral (empty)
  • 1: player 1
  • 2: player 2
  • 3: fire
  • 4: fading fire / fallout zone
  • 5: '''
  • 6: '''
{
    "EventType": "LifeChange",
    "Value": 1,
    "Location": 
    {
        "X": 0,
        "Y": 47,
    }
}    

Directly Change Multiple Squares

When you want many changes to be made within the same game tick:

{
    "EventType": "ChangeMany",
    "Changes": 
    [
        {
            "Value": 1,
            "Location": 
            {
                "X": 1,
                "Y": 10
            }
        },
        {
            "Value": 2,
            "Location": 
            {
                "X": 2,
                "Y": 20
            }
        }
    ]
}   

Reset & Randomize Game Board

Fresh Game

A simple Reset of the game board, where every square becomes either player 1 or player 2.

{
    "EventType": "FreshGame"
}    

Randomize Placements

The "Integer" Field is optional. It is the number of squares to that will be placed on the board after the reset. For example, if you set the "integer" field to 1: Then 1 square will be created at a random location on the game board, and will be randomly given to either player 1 or player 2.

{
    "EventType": "LifeRandomize",
    "Integer": 500,
}