{"id":15134422,"url":"https://github.com/dawnarc/puertsgame","last_synced_at":"2025-10-23T11:30:27.815Z","repository":{"id":45610452,"uuid":"430138337","full_name":"dawnarc/PuertsGame","owner":"dawnarc","description":"PuerTS example to demonstrate shooting and RPC in Unreal Engine 4.","archived":false,"fork":false,"pushed_at":"2024-05-01T08:35:16.000Z","size":6006,"stargazers_count":28,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-06T19:17:20.965Z","etag":null,"topics":["debug","example","intellij-idea","rpc","shooting","typescript","ue4","unrealengine4"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dawnarc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-20T15:25:42.000Z","updated_at":"2024-12-16T23:48:16.000Z","dependencies_parsed_at":"2023-01-25T12:45:08.211Z","dependency_job_id":null,"html_url":"https://github.com/dawnarc/PuertsGame","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawnarc%2FPuertsGame","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawnarc%2FPuertsGame/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawnarc%2FPuertsGame/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawnarc%2FPuertsGame/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dawnarc","download_url":"https://codeload.github.com/dawnarc/PuertsGame/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237811515,"owners_count":19370144,"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":["debug","example","intellij-idea","rpc","shooting","typescript","ue4","unrealengine4"],"created_at":"2024-09-26T05:20:36.199Z","updated_at":"2025-10-23T11:30:22.196Z","avatar_url":"https://github.com/dawnarc.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Branches Introduction\n\n+ `main`: the newest content of this example.\n+ `rpc`: implement shooting and `RPC` logic.\n+ `shooting`: implement basic shooting logic only.\n\n# Summary\n\n[PuerTS](https://github.com/Tencent/puerts) is a high performance script system for Unity and Unreal that founded by [chexiongsheng](https://github.com/chexiongsheng).\n\nThis repository is the personal study note referenced to author's tutorial, since there're some issues haven't been mentioned in origin documents.\n\nOfficial tutorial:\n跟我用TypeScript做一个FPS游戏  \nhttps://zhuanlan.zhihu.com/p/346531865\n\nShowcase  \n![screenshoots01](./docs/screenshoots/screenshoot_1.gif)\n\n***\n\n# Setup\n\n+ Install Unreal Engine 4.\n+ Install nodejs: https://nodejs.org/en/download/  \nCheck the option `Automatically install the necessary tools.` at the ending of installation.\n![screenshoots02](./docs/screenshoots/screenshoot_1_2.png)\n+ Clone puerts from https://github.com/Tencent/puerts\n+ Copy directory `puerts/unreal/Puerts/` into this project:`PuertsGame/Plugins/Puerts/`.\n+ Open cmd and address to directory `PuertsGame/Plugins/Puerts/`, execute command:\n    \n        node enable_puerts_module.js\n    \n+ Bulid from visual studio, and start editor, then click plugin button `ud.d.ts`:  \n![screenshoots02](./docs/screenshoots/screenshoot_2.png)\n+ If can't find `TS_BaseGun`, `TS_Player` and `TS_Rifle` in directory `PuertsGame/Blueprints/TypeScript/`, which were generated by `PuerTS`, in editor content browser.  \n![screenshoots03](./docs/screenshoots/screenshoot_3.png)  \nYou need to fire hot compilcation by adding empty line in TypeScript source file.  \n![screenshoots04](./docs/screenshoots/screenshoot_4.png)  \nIf add a blank line and save file, log would output that TypeScript source has been re-compiled:  \n![screenshoots05](./docs/screenshoots/screenshoot_5.png)  \nThen `PuerTS` would auto compile this TypeScript source and auto generate Unreal `.uasset` file under directory `PuertsGame/Blueprints/TypeScript/`.  \n+ Set `GameMode` and `Default Pawn Class` in World Settings panel:  \n![screenshoots05](./docs/screenshoots/screenshoot_5-1.png)  \n\n***\n\n# Debug in IntelliJ IDEA\n\n+ UE4Editor -\u003e Edit -\u003e Project Settings -\u003e Plugins -\u003e Puerts Settings -\u003e Enable `Debug Mode`, and set `Debug Port` as an unoccupied port (`8889` recommended).  \n![screenshoots06](./docs/screenshoots/screenshoot_6.png)\n+ IntelliJ IDEA -\u003e Run -\u003e Edit Configurations  \n![screenshoots07](./docs/screenshoots/screenshoot_7.png)\n+ Add New Configuration -\u003e Attach to Node.js / Chrome  \n![screenshoots08](./docs/screenshoots/screenshoot_8.png)\n+ Set `Port` as the same as UE4Editor settings (`8889`)  \n![screenshoots09](./docs/screenshoots/screenshoot_9.png)\n+ Re-startup UE4Editor at first time.\n+ Debug TypeScript in IntelliJ IDEA:  \n![screenshoots10](./docs/screenshoots/screenshoot_10.png)\n+ Play game in UE4Editor.\n+ Then breakpoints in IntelliJ IDEA would be hit, and you can watch variables values:  \n![screenshoots11](./docs/screenshoots/screenshoot_11.png)\n\n***\n\n# RPC\n\nTo enable RPC, add `\"experimentalDecorators\": true` in `PuertsGame/tsconfig.json`:\n\n    {\n        \"compilerOptions\": {\n            \"target\": \"esnext\",\n            \"module\": \"commonjs\",\n            \"experimentalDecorators\": true,\n            \"jsx\": \"react\",\n            \"sourceMap\": true,\n            \"typeRoots\": [\n                \"Plugins/Puerts/Typing\",\n                \"./node_modules/@types\"\n            ],\n            \"outDir\": \"Content/JavaScript\"\n        },\n        \"include\": [\n            \"TypeScript/**/*\"\n        ]\n    }\n\nOtherwise you would get warning:\n\n    Error D:/PuertsGame/TypeScript/TS_Player.ts (101,5): Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.\n\nOpen `BP_Target`.  \n![screenshoots11](./docs/screenshoots/screenshoot_12.png)\n\nCheck `Replicates` in Detail panels.  \n![screenshoots11](./docs/screenshoots/screenshoot_13.png)\n\nCheck `Replicates` in Detail panels.  \nThen select `CubeMesh` of `BP_Target`, and check `Component Replicates`.  \n![screenshoots11](./docs/screenshoots/screenshoot_14.png)\n![screenshoots11](./docs/screenshoots/screenshoot_15.png)\n\nSelect property `Health` of `BP_Target`, then set Replication as `RepNotify`.  \n![screenshoots11](./docs/screenshoots/screenshoot_16.png)\n\nImplement function `On Rep Health` which was generated by Blueprint.  \n![screenshoots11](./docs/screenshoots/screenshoot_17.png)\n\nRemove node `Update Color` in function `Take Damage`.  \n![screenshoots11](./docs/screenshoots/screenshoot_18.png)\n\nSelect `Net Mode` of `Multiplayer Options` as `Play as Client`.  \n![screenshoots11](./docs/screenshoots/screenshoot_19.png)\n\nNow you can run game with RPC demonstration.\n\n# Package\n\n## Issues 1\n\nProject Settings -\u003e Packaging -\u003e Additional Non-Asset Directories To Copy -\u003e Add directory `JavaScript`.\n\n![screenshoots11](./docs/screenshoots/screenshoot_20.png)\n\nOtherwise, you would get error on startup:\n\n    Puerts: Error: (0x00000228FF6B3BF0) can not find [puerts/first_run.js]\n    Puerts: Error: (0x00000228FF6B3BF0) can not find [puerts/polyfill.js]\n    Puerts: Error: (0x00000228FF6B3BF0) can not find [puerts/log.js]\n    Puerts: Error: (0x00000228FF6B3BF0) can not find [puerts/modular.js]\n    Puerts: Error: (0x00000228FF6B3BF0) can not find [puerts/uelazyload.js]\n    Puerts: Error: (0x00000228FF6B3BF0) can not find [puerts/events.js]\n    Puerts: Error: (0x00000228FF6B3BF0) can not find [puerts/promises.js]\n    Puerts: Error: (0x00000228FF6B3BF0) can not find [puerts/argv.js]\n    Puerts: Error: (0x00000228FF6B3BF0) can not find [puerts/jit_stub.js]\n    Puerts: Error: (0x00000228FF6B3BF0) can not find [puerts/hot_reload.js]\n\n## Issues 2\n\nDon't load object in Constructor since there are some limits in Unreal.\n\n    Constructor() \n    {\n        this.PS_BulletImpact = UE.ParticleSystem.Load(\"/Game/BlockBreaker/ParticleSystems/PS_BulletImpact\");\n    }\nOtherwise, you would get error on startup:\n\n    Assertion failed: AsyncLoadingThread.RecursionNotAllowed.Increment() == 1 [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/CoreUObject/Private/Serialization/AsyncLoading.cpp] [Line: 3992] \n\nAlteration: load object in `ReceiveBeginPlay`:\n\n    ReceiveBeginPlay(): void\n    {\n        this.PS_BulletImpact = UE.ParticleSystem.Load(\"/Game/BlockBreaker/ParticleSystems/PS_BulletImpact\");\n    }\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdawnarc%2Fpuertsgame","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdawnarc%2Fpuertsgame","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdawnarc%2Fpuertsgame/lists"}