All Projects → turn-based → boardgame.io-angular

turn-based / boardgame.io-angular

Licence: MIT license
Angular client for boardgame.io

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
SCSS
7915 projects
HTML
75241 projects

Projects that are alternatives of or similar to boardgame.io-angular

Ngx Daterangepicker Material
Pure Angular 2+ date range picker with material design theme, a demo here:
Stars: ✭ 169 (+225%)
Mutual labels:  angular6
Ng2 Idle
Responding to idle users in Angular (not AngularJS) applications.
Stars: ✭ 240 (+361.54%)
Mutual labels:  angular6
Commander Wars
The aim of this project is to create an Advance Wars Clone with a lot of additions customizations and modding support. For Contact Inforamtion see the wiki page. Take a view on the game.
Stars: ✭ 89 (+71.15%)
Mutual labels:  turn-based
Truly Ui
Truly-UI - Web Angular UI Components for Desktop Applications (Electron, NW, APP JS)
Stars: ✭ 195 (+275%)
Mutual labels:  angular6
Angular5 Seed
Angular5 Seed for Application
Stars: ✭ 222 (+326.92%)
Mutual labels:  angular6
goblins-game-gd
Turn based strategy game made with Godot Engine.
Stars: ✭ 68 (+30.77%)
Mutual labels:  turn-based
Ngx Qrcode
An Angular 9/10 Component Library for Generating QR (Quick Response) Codes
Stars: ✭ 161 (+209.62%)
Mutual labels:  angular6
Boardgame.io
State Management and Multiplayer Networking for Turn-Based Games
Stars: ✭ 8,924 (+17061.54%)
Mutual labels:  turn-based
Ng Select
⭐ Native angular select component
Stars: ✭ 2,781 (+5248.08%)
Mutual labels:  angular6
troll-hunter
Trollhunter is a single-player roguelike game.
Stars: ✭ 28 (-46.15%)
Mutual labels:  turn-based
Angular 6 Registration Login Example
Angular 6 User Registration and Login Example
Stars: ✭ 204 (+292.31%)
Mutual labels:  angular6
Ngx Avatar
Universal avatar component for angular 2+ applications makes it possible to fetch / generate avatar from different sources
Stars: ✭ 210 (+303.85%)
Mutual labels:  angular6
imperialism-remake
Imperialism remake
Stars: ✭ 45 (-13.46%)
Mutual labels:  turn-based
Ng2 Stompjs
Angular 6 and 7 - Stomp service over Websockets
Stars: ✭ 170 (+226.92%)
Mutual labels:  angular6
gophers-and-dragons
Rogue-like game for Go programmers.
Stars: ✭ 42 (-19.23%)
Mutual labels:  turn-based
Sb Admin Bs4 Angular 8
Simple Dashboard Admin App built using Angular 8 and Bootstrap 4
Stars: ✭ 1,931 (+3613.46%)
Mutual labels:  angular6
On-The-Roadside
A turn-based ASCII strategy game.
Stars: ✭ 21 (-59.62%)
Mutual labels:  turn-based
spring-boot-angular-maven-starter
An example of Spring Boot and Angular 6 integration with the help of Maven and Kotlin.
Stars: ✭ 13 (-75%)
Mutual labels:  angular6
Colyseus
⚔ Multiplayer Framework for Node.js
Stars: ✭ 3,817 (+7240.38%)
Mutual labels:  turn-based
signus
Signus: The Artefact Wars. Czech turn-based strategy game similar to Battle Isle series
Stars: ✭ 54 (+3.85%)
Mutual labels:  turn-based

Boardgame.io Angular Client

npm version

Angular client for Boardgame.io.

Checkout the demo application

Current version (>=0.25) was built using Angular 9.

Installation

$ npm install --save boardgame.io-angular [email protected]

Usage

  1. Define your boardgame.io's framework independent Game.
  2. Define your board component that inherits BoardBase - the available properties are described at the Client's documentation under board component:
    @Component({  
      template: 'do something like {{G | json}}',  
    })  
    export class MyBoardComponent extends BoardBase {  
       // unfortunately, 
       // the following boilerplate is currently required:
       constructor(@Inject(OBSERVABLE_BOARD_CONFIG) 
                   observableBoardConfig: Observable<BoardConfig>) {  
         super(observableBoardConfig);  
       }  
     }
  • This board component is loaded dynamaically, so it shouldn't indirectly depend on other parts of your application. In order to define its module dependencies you need to add a module:

    @NgModule({
      declarations: [MyBoardComponent],
      imports: [CommonModule, /* other dependencies */],  
    }) export class StupidButNeededModule {}

    (It would have been nice to be able to just specify imports on the board component; this feature is tracked by Angular issue#33507).

  1. import the module in you main app:

    import { NgModule } from '@angular/core';  
    import { BoardgameIoModule } from 'boardgame.io-angular';  
      
    @NgModule({  
      declarations: [  
        MyBoardComponent  
      ],  
      imports: [  
        // ...  
        BoardgameIoModule, // import for using bio-client  
    ]}) // Angular 9+ does not require entryComponent!
    export class MyModule {}  
  2. Use bioGameConfig attribute directive to setup game scope. It uses the same config as boardgame.io's client factory. Use bio-client component to setup a client instance:

    import { MyGame } from '.';  
    import { MyBoardComponent } from '.';  
     
    @Component({  
      template: `
        <bio-client
          [bioGameConfig]="config" gameID="single">
        </bio-client>`
    })  
    export class MyExampleComponent {
      config = {game: MyGame, board: MyBoardComponent};
    }
  • bioGameConfig can also be used setup a game scope for more than one client (useful for a multiview game and examples):
    <ng-container [bioGameConfig]="config">
      <bio-client gameID="multi" playerID="0"></bio-client>`
      <bio-client gameID="multi" playerID="1"></bio-client>`
    </ng-container>
  • bioGameConfig just assigns a config to a GameScope injectable. You can also directly make a GameScope available to bio-client using the providers property of an available module, a parent component, or a directive.
  1. See the examples.

Development

Running examples in this repository

$ git clone https://github.com/turn-based/boardgame.io-angular.git  
$ cd boardgame.io-angular  
$ npm i  
$ npm run build   
$ npm run start  

For Running the multiplayer examples you'll also need to have the server running running on port 8000:

$ cd server  
$ npm i  
$ npm run start:dev   

This project was generated with Angular CLI version 9 using the follwing commands :

  1. npx @angular/cli@9 new boardgame.io-angular --create-application false --prefix bio --style scss --strict --skip-tests -s -t
  2. cd boardgame.io-angular
  3. npx @angular/cli@9 g application demo --prefix bio --style scss --skip-tests -s -t
  4. npx @angular/cli@9 g library bio-angular --prefix bio
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].