{"id":15386644,"url":"https://github.com/pixelscommander/telekinesis-js","last_synced_at":"2025-04-15T20:09:31.769Z","repository":{"id":146587639,"uuid":"10888131","full_name":"PixelsCommander/Telekinesis-JS","owner":"PixelsCommander","description":"JavaScript multiplayer game engine. Using Node.JS for server and any graphic library for client-side.","archived":false,"fork":false,"pushed_at":"2013-06-24T00:09:14.000Z","size":6012,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-15T20:09:23.871Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PixelsCommander.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-06-23T16:47:28.000Z","updated_at":"2024-05-07T02:19:20.000Z","dependencies_parsed_at":"2023-03-24T08:47:17.326Z","dependency_job_id":null,"html_url":"https://github.com/PixelsCommander/Telekinesis-JS","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PixelsCommander%2FTelekinesis-JS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PixelsCommander%2FTelekinesis-JS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PixelsCommander%2FTelekinesis-JS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PixelsCommander%2FTelekinesis-JS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PixelsCommander","download_url":"https://codeload.github.com/PixelsCommander/Telekinesis-JS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249145302,"owners_count":21219966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T14:50:02.217Z","updated_at":"2025-04-15T20:09:31.749Z","avatar_url":"https://github.com/PixelsCommander.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Image](../../blob/master/assets/telekinesislogo.png?raw=true)\n\nJavaScript multiplayer game engine. \nUses Node.JS for server and any graphic library for client-side.\n\nWhy Telekinesis?\n----------------\nIt`s easy way to build \u003cb\u003estructured\u003c/b\u003e and well \u003cb\u003esynchronized\u003c/b\u003e client-server games.\nBTW racing example uses only 20 lines of networking code.\n\nGetting started\n===============\nClient scene initialization\n--------------------------------------\n    //Creating new Telekinesis client\n    var tsClient = new tsjs.Client('localhost', 3000);\n    \n    //Setting handlers on object added or removed, this can serve graphic - engine specific logic\n    tsClient.scene.onAddEntities = MyGraphicEngineAddObject;\n    tsClient.scene.onRemoveEntities = MyGraphicEngineRemoveObject;\n    \nPlayer action invokation\n------------------------\nThis is code to execute on key pressed:\n    \n    this.networkClient.emitAction(this.networkClient.playerId, 'moveKeyDown');\n    \nThis will notify server and other players about action.\n\nGame server\n-----------\n4 lines of code needed on server side:\n\n    var tsjs = require('../../../dist/tsserver');\n    var server = tsjs.Server.createServer('3000');\n    server.gameClasses['Car'] = require('../universal/car').Car;\n    server.playerClass = 'Car';\n\nBuilding game objects classes\n--------------------------------------\n- All game classes that contains game logic have to be universal for server and client;-\n- When player invokes action by pressing a button or moving mouse - action sends to server and then to other players;-\n- Actions applicable to objects are described in game objects as array of functions called {actions};-\n- Names of properties that have to be synchronized during adding objet to scene have to be enumerated as array of strings called {enumerable};-\n- Names of propeties that needs synchronization have to be enumerated as strings in array called {sync}.-\n\nExample class represents game player:\n\n    var Car = function(){\n      this.x = 0;\n      this.y = 0;\n      this.speed = 0;\n    }\n\n    Car.prototype[actions] = [\n      moveKeyDown: function(){\n      this.speed = 10;\n    },\n      moveKeyUp: function(){\n        this.speed = 0;\n      }\n    ];\n\n    Car.prototype.enumerable = ['x', 'y', 'speed'];\n    Car.prototype.sync = ['x', 'y'];\n    \nScene updating\n--------------\nScene updates with executing \u003cb\u003eupdate\u003c/b\u003e method of every it`s object. For our example it can be:\n\n    Car.prototype.update = function(){\n        this.x += this.speed;\n    }\n    \nYou can continue with launching and exploring racing example.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpixelscommander%2Ftelekinesis-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpixelscommander%2Ftelekinesis-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpixelscommander%2Ftelekinesis-js/lists"}