@ud-viz/game_node

4.5.1 • Public • Published

@ud-viz/game_node

NPM package version

Game library interpretable in a nodejs environment. Before to start you should read @ud-viz/game_shared and @ud-viz/game_browser.

Overview

@ud-viz/game_node package allows to create a backend SocketService working with socket.io to communicate with clients implement with @ud-viz/game_browser. SocketService takes an array of Object3D and will instanciated a thread for each of them with worker_threads where Object3D is running. Then it handles websocket communication with threads.

flowchart TB
subgraph client_1
ExternalContext_1
end

subgraph client_n
ExternalContext_n
end

subgraph backend
subgraph SocketService
thread_Parent_1
thread_Parent_m
end
subgraph thread_Child_1
Object3D_1
end
subgraph thread_Child_m
Object3D_m
end
end

ExternalContext_1-->|websocket Command|SocketService
ExternalContext_n-->|websocket Command|SocketService
SocketService-->|websocket State|ExternalContext_1
SocketService-->|websocket State|ExternalContext_n

thread_Parent_1-->|message|thread_Child_1
thread_Child_1-->|State|thread_Parent_1
thread_Parent_m-->|message|thread_Child_m
thread_Child_m-->|State|thread_Parent_m

Installation

  • You can install @ud-viz/game_node via npm:
npm install @ud-viz/game_node

 Example

Parent entry

const { SocketService } = require('@ud-viz/game_node');
const { Object3D } = require('@ud-viz/game_shared');

const socketService = new SocketService(httpServer);
socketService.loadGameThreads(
  [new Object3D({ name: 'game_1' }), new Object3D({ name: 'game_2' })],
  './path/to/your/thread/child/entry.js'
);

You can find an implementation here

Child entry

const { thread } = require('@ud-viz/game_node');

const child = new thread.Child();
child.start([scriptsOfYourGames]);

You can find an implementation here

Documentation

Online Documentation

Contributing

Contributions are welcome! Feel free to submit bug reports, feature requests, or pull requests on the GitHub repository. See Contributing.md.

License

This package is licensed under the GNU Lesser General Public License Version 2.1, with copyright attributed to the University of Lyon.

Credits

@ud-viz/game_node is developed and maintained by VCityTeam. See Contributors.md.

Readme

Keywords

none

Package Sidebar

Install

npm i @ud-viz/game_node

Weekly Downloads

75

Version

4.5.1

License

(LGPL-2.1)

Unpacked Size

21.4 kB

Total Files

6

Last publish

Collaborators

  • vcity