cyberia 3.2.5 → 3.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/engine-cyberia.cd.yml +8 -2
- package/.github/workflows/npmpkg.ci.yml +1 -0
- package/.github/workflows/pwa-microservices-template-test.ci.yml +1 -1
- package/.github/workflows/release.cd.yml +2 -2
- package/.vscode/extensions.json +9 -9
- package/.vscode/settings.json +20 -4
- package/CHANGELOG.md +563 -1
- package/CLI-HELP.md +130 -34
- package/Dockerfile +0 -4
- package/README.md +194 -607
- package/bin/build.js +42 -12
- package/bin/build.template.js +187 -0
- package/bin/cyberia.js +1367 -281
- package/bin/deploy.js +582 -3
- package/bin/index.js +1367 -281
- package/bump.config.js +26 -0
- package/conf.js +195 -111
- package/deployment.yaml +6 -222
- package/hardhat/package-lock.json +118 -149
- package/hardhat/package.json +5 -4
- package/jsconfig.json +1 -1
- package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +2 -2
- package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +2 -2
- package/manifests/deployment/dd-cyberia-development/deployment.yaml +6 -222
- package/manifests/deployment/dd-cyberia-development/proxy.yaml +10 -118
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -6
- package/manifests/deployment/dd-test-development/deployment.yaml +138 -66
- package/manifests/deployment/dd-test-development/proxy.yaml +41 -5
- package/manifests/kind-config-dev.yaml +8 -0
- package/manifests/lxd/lxd-admin-profile.yaml +12 -3
- package/manifests/mongodb/pv-pvc.yaml +44 -8
- package/manifests/mongodb/statefulset.yaml +55 -68
- package/manifests/mongodb-4.4/headless-service.yaml +10 -0
- package/manifests/mongodb-4.4/kustomization.yaml +3 -1
- package/manifests/mongodb-4.4/mongodb-nodeport.yaml +17 -0
- package/manifests/mongodb-4.4/pv-pvc.yaml +10 -14
- package/manifests/mongodb-4.4/statefulset.yaml +79 -0
- package/manifests/mongodb-4.4/storage-class.yaml +9 -0
- package/manifests/valkey/statefulset.yaml +1 -1
- package/manifests/valkey/valkey-nodeport.yaml +17 -0
- package/package.json +45 -24
- package/proxy.yaml +10 -118
- package/scripts/ipxe-setup.sh +52 -49
- package/scripts/k3s-node-setup.sh +83 -48
- package/scripts/lxd-vm-setup.sh +193 -8
- package/scripts/maas-nat-firewalld.sh +145 -0
- package/scripts/nat-iptables.sh +103 -18
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.controller.js +18 -18
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.model.js +7 -14
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.router.js +38 -33
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.service.js +91 -36
- package/src/api/core/core.controller.js +10 -10
- package/src/api/core/core.router.js +19 -14
- package/src/api/core/core.service.js +15 -15
- package/src/api/crypto/crypto.controller.js +8 -8
- package/src/api/crypto/crypto.router.js +18 -12
- package/src/api/crypto/crypto.service.js +11 -11
- package/src/api/cyberia-action/cyberia-action.controller.js +74 -0
- package/src/api/cyberia-action/cyberia-action.model.js +87 -0
- package/src/api/cyberia-action/cyberia-action.router.js +31 -0
- package/src/api/cyberia-action/cyberia-action.service.js +42 -0
- package/src/api/cyberia-client-hints/cyberia-client-hints.controller.js +74 -0
- package/src/api/cyberia-client-hints/cyberia-client-hints.model.js +99 -0
- package/src/api/cyberia-client-hints/cyberia-client-hints.router.js +98 -0
- package/src/api/cyberia-client-hints/cyberia-client-hints.service.js +152 -0
- package/src/api/cyberia-dialogue/cyberia-dialogue.controller.js +13 -13
- package/src/api/cyberia-dialogue/cyberia-dialogue.model.js +11 -11
- package/src/api/cyberia-dialogue/cyberia-dialogue.router.js +25 -20
- package/src/api/cyberia-dialogue/cyberia-dialogue.service.js +22 -22
- package/src/api/cyberia-entity/cyberia-entity.controller.js +10 -10
- package/src/api/cyberia-entity/cyberia-entity.router.js +22 -18
- package/src/api/cyberia-entity/cyberia-entity.service.js +15 -15
- package/src/api/cyberia-instance/cyberia-fallback-world.js +83 -198
- package/src/api/cyberia-instance/cyberia-instance.controller.js +14 -14
- package/src/api/cyberia-instance/cyberia-instance.model.js +3 -0
- package/src/api/cyberia-instance/cyberia-instance.router.js +57 -52
- package/src/api/cyberia-instance/cyberia-instance.service.js +32 -67
- package/src/api/cyberia-instance/cyberia-portal-connector.js +20 -246
- package/src/api/cyberia-instance/cyberia-world-generator.js +505 -0
- package/src/api/cyberia-instance-conf/cyberia-instance-conf.controller.js +10 -10
- package/src/api/cyberia-instance-conf/cyberia-instance-conf.model.js +18 -49
- package/src/api/cyberia-instance-conf/cyberia-instance-conf.router.js +22 -18
- package/src/api/cyberia-instance-conf/cyberia-instance-conf.service.js +19 -15
- package/src/api/cyberia-map/cyberia-map.controller.js +10 -10
- package/src/api/cyberia-map/cyberia-map.router.js +35 -30
- package/src/api/cyberia-map/cyberia-map.service.js +17 -17
- package/src/api/cyberia-quest/cyberia-quest.controller.js +74 -0
- package/src/api/cyberia-quest/cyberia-quest.model.js +67 -0
- package/src/api/cyberia-quest/cyberia-quest.router.js +31 -0
- package/src/api/cyberia-quest/cyberia-quest.service.js +42 -0
- package/src/api/cyberia-quest-progress/cyberia-quest-progress.controller.js +74 -0
- package/src/api/cyberia-quest-progress/cyberia-quest-progress.model.js +49 -0
- package/src/api/cyberia-quest-progress/cyberia-quest-progress.router.js +31 -0
- package/src/api/cyberia-quest-progress/cyberia-quest-progress.service.js +42 -0
- package/src/api/cyberia-server-defaults/cyberia-server-defaults.js +451 -0
- package/src/api/default/default.controller.js +10 -10
- package/src/api/default/default.router.js +22 -18
- package/src/api/default/default.service.js +15 -15
- package/src/api/document/document.controller.js +12 -12
- package/src/api/document/document.model.js +10 -16
- package/src/api/document/document.router.js +28 -23
- package/src/api/document/document.service.js +100 -23
- package/src/api/file/file.controller.js +8 -8
- package/src/api/file/file.model.js +10 -10
- package/src/api/file/file.router.js +19 -13
- package/src/api/file/file.service.js +45 -43
- package/src/api/instance/instance.controller.js +10 -10
- package/src/api/instance/instance.model.js +4 -10
- package/src/api/instance/instance.router.js +29 -24
- package/src/api/instance/instance.service.js +16 -16
- package/src/api/ipfs/ipfs.controller.js +12 -12
- package/src/api/ipfs/ipfs.model.js +4 -13
- package/src/api/ipfs/ipfs.router.js +21 -16
- package/src/api/ipfs/ipfs.service.js +22 -36
- package/src/api/object-layer/object-layer.controller.js +12 -12
- package/src/api/object-layer/object-layer.model.js +4 -17
- package/src/api/object-layer/object-layer.router.js +512 -507
- package/src/api/object-layer/object-layer.service.js +29 -26
- package/src/api/object-layer-render-frames/object-layer-render-frames.controller.js +10 -10
- package/src/api/object-layer-render-frames/object-layer-render-frames.model.js +6 -16
- package/src/api/object-layer-render-frames/object-layer-render-frames.router.js +22 -18
- package/src/api/object-layer-render-frames/object-layer-render-frames.service.js +19 -15
- package/src/api/test/test.controller.js +8 -8
- package/src/api/test/test.router.js +17 -12
- package/src/api/test/test.service.js +8 -8
- package/src/api/types.js +24 -0
- package/src/api/user/guest.service.js +100 -0
- package/src/api/user/user.controller.js +6 -6
- package/src/api/user/user.model.js +8 -13
- package/src/api/user/user.router.js +297 -288
- package/src/api/user/user.service.js +103 -55
- package/src/cli/baremetal.js +132 -101
- package/src/cli/cluster.js +732 -217
- package/src/cli/db.js +106 -62
- package/src/cli/deploy.js +260 -149
- package/src/cli/fs.js +90 -9
- package/src/cli/image.js +43 -1
- package/src/cli/index.js +106 -16
- package/src/cli/ipfs.js +4 -6
- package/src/cli/kubectl.js +4 -1
- package/src/cli/lxd.js +1099 -223
- package/src/cli/monitor.js +9 -3
- package/src/cli/release.js +336 -86
- package/src/cli/repository.js +136 -53
- package/src/cli/run.js +599 -76
- package/src/cli/secrets.js +11 -2
- package/src/cli/ssh.js +1 -1
- package/src/cli/static.js +43 -115
- package/src/cli/test.js +9 -3
- package/src/client/Cryptokoyn.index.js +18 -21
- package/src/client/CyberiaPortal.index.js +19 -23
- package/src/client/Default.index.js +30 -36
- package/src/client/Itemledger.index.js +20 -26
- package/src/client/Underpost.index.js +19 -23
- package/src/client/components/core/404.js +4 -4
- package/src/client/components/core/500.js +4 -4
- package/src/client/components/core/Account.js +73 -60
- package/src/client/components/core/AgGrid.js +23 -33
- package/src/client/components/core/Alert.js +12 -13
- package/src/client/components/core/AppStore.js +1 -1
- package/src/client/components/core/Auth.js +40 -37
- package/src/client/components/core/Badge.js +7 -13
- package/src/client/components/core/BtnIcon.js +15 -17
- package/src/client/components/core/CalendarCore.js +42 -63
- package/src/client/components/core/Chat.js +13 -15
- package/src/client/components/core/ClientEvents.js +163 -0
- package/src/client/components/core/ColorPaletteElement.js +309 -0
- package/src/client/components/core/Content.js +17 -14
- package/src/client/components/core/Css.js +15 -71
- package/src/client/components/core/CssCore.js +12 -16
- package/src/client/components/core/D3Chart.js +4 -4
- package/src/client/components/core/Docs.js +64 -91
- package/src/client/components/core/DropDown.js +69 -91
- package/src/client/components/core/EventBus.js +96 -0
- package/src/client/components/core/EventsUI.js +14 -17
- package/src/client/components/core/FileExplorer.js +96 -228
- package/src/client/components/core/FullScreen.js +47 -75
- package/src/client/components/core/Input.js +24 -69
- package/src/client/components/core/Keyboard.js +25 -18
- package/src/client/components/core/KeyboardAvoidance.js +145 -0
- package/src/client/components/core/LoadingAnimation.js +25 -31
- package/src/client/components/core/LogIn.js +41 -41
- package/src/client/components/core/LogOut.js +23 -14
- package/src/client/components/core/Modal.js +544 -219
- package/src/client/components/core/NotificationManager.js +14 -18
- package/src/client/components/core/Panel.js +54 -50
- package/src/client/components/core/PanelForm.js +81 -177
- package/src/client/components/core/Polyhedron.js +110 -214
- package/src/client/components/core/PublicProfile.js +39 -32
- package/src/client/components/core/Recover.js +48 -44
- package/src/client/components/core/Responsive.js +88 -32
- package/src/client/components/core/RichText.js +9 -18
- package/src/client/components/core/Router.js +24 -3
- package/src/client/components/core/SearchBox.js +37 -37
- package/src/client/components/core/SignUp.js +39 -30
- package/src/client/components/core/SocketIo.js +31 -2
- package/src/client/components/core/SocketIoHandler.js +6 -6
- package/src/client/components/core/ToggleSwitch.js +8 -20
- package/src/client/components/core/ToolTip.js +5 -17
- package/src/client/components/core/Translate.js +56 -59
- package/src/client/components/core/Validator.js +26 -16
- package/src/client/components/core/Wallet.js +15 -26
- package/src/client/components/core/Worker.js +211 -276
- package/src/client/components/core/windowGetDimensions.js +7 -7
- package/src/client/components/cryptokoyn/{MenuCryptokoyn.js → AppShellCryptokoyn.js} +57 -57
- package/src/client/components/cryptokoyn/CssCryptokoyn.js +15 -15
- package/src/client/components/cryptokoyn/LogInCryptokoyn.js +6 -4
- package/src/client/components/cryptokoyn/LogOutCryptokoyn.js +6 -4
- package/src/client/components/cryptokoyn/RouterCryptokoyn.js +37 -0
- package/src/client/components/cryptokoyn/SettingsCryptokoyn.js +4 -4
- package/src/client/components/cryptokoyn/SignUpCryptokoyn.js +6 -4
- package/src/client/components/cyberia/InstanceEngineCyberia.js +141 -60
- package/src/client/components/cyberia/MapEngineCyberia.js +691 -214
- package/src/client/components/cyberia/ObjectLayerEngine.js +19 -0
- package/src/client/components/cyberia/ObjectLayerEngineModal.js +1204 -94
- package/src/client/components/cyberia/ObjectLayerEngineViewer.js +196 -298
- package/src/client/components/cyberia/SharedDefaultsCyberia.js +330 -0
- package/src/client/components/cyberia-portal/{MenuCyberiaPortal.js → AppShellCyberiaPortal.js} +102 -102
- package/src/client/components/cyberia-portal/CssCyberiaPortal.js +15 -15
- package/src/client/components/cyberia-portal/LogInCyberiaPortal.js +6 -4
- package/src/client/components/cyberia-portal/LogOutCyberiaPortal.js +6 -4
- package/src/client/components/cyberia-portal/MainBodyCyberiaPortal.js +4 -4
- package/src/client/components/cyberia-portal/RouterCyberiaPortal.js +60 -0
- package/src/client/components/cyberia-portal/SettingsCyberiaPortal.js +4 -4
- package/src/client/components/cyberia-portal/SignUpCyberiaPortal.js +6 -4
- package/src/client/components/cyberia-portal/TranslateCyberiaPortal.js +4 -4
- package/src/client/components/default/{MenuDefault.js → AppShellDefault.js} +87 -87
- package/src/client/components/default/CssDefault.js +12 -12
- package/src/client/components/default/LogInDefault.js +6 -4
- package/src/client/components/default/LogOutDefault.js +6 -4
- package/src/client/components/default/RouterDefault.js +47 -0
- package/src/client/components/default/SettingsDefault.js +4 -4
- package/src/client/components/default/SignUpDefault.js +6 -4
- package/src/client/components/default/TranslateDefault.js +3 -3
- package/src/client/components/itemledger/{MenuItemledger.js → AppShellItemledger.js} +57 -57
- package/src/client/components/itemledger/CssItemledger.js +15 -15
- package/src/client/components/itemledger/LogInItemledger.js +6 -4
- package/src/client/components/itemledger/LogOutItemledger.js +6 -4
- package/src/client/components/itemledger/RouterItemledger.js +38 -0
- package/src/client/components/itemledger/SettingsItemledger.js +4 -4
- package/src/client/components/itemledger/SignUpItemledger.js +6 -4
- package/src/client/components/itemledger/TranslateItemledger.js +3 -3
- package/src/client/components/underpost/{MenuUnderpost.js → AppShellUnderpost.js} +88 -88
- package/src/client/components/underpost/CssUnderpost.js +14 -14
- package/src/client/components/underpost/CyberpunkBloggerUnderpost.js +4 -4
- package/src/client/components/underpost/DocumentSearchProvider.js +1 -1
- package/src/client/components/underpost/LabGalleryUnderpost.js +12 -15
- package/src/client/components/underpost/LogInUnderpost.js +6 -4
- package/src/client/components/underpost/LogOutUnderpost.js +6 -4
- package/src/client/components/underpost/RouterUnderpost.js +45 -0
- package/src/client/components/underpost/SettingsUnderpost.js +4 -4
- package/src/client/components/underpost/SignUpUnderpost.js +6 -4
- package/src/client/components/underpost/TranslateUnderpost.js +4 -4
- package/src/client/public/cyberia-docs/ACTION-SYSTEM.md +235 -0
- package/src/client/public/cyberia-docs/ARCHITECTURE.md +83 -0
- package/src/client/public/cyberia-docs/CYBERIA-CLI.md +204 -0
- package/src/client/public/cyberia-docs/CYBERIA-CLIENT.md +291 -0
- package/src/client/public/cyberia-docs/CYBERIA-SERVER.md +278 -0
- package/src/client/public/cyberia-docs/CYBERIA.md +259 -0
- package/src/client/public/cyberia-docs/ENTITY-PROFILE.md +241 -0
- package/src/client/public/cyberia-docs/HARDHAT-MODULE.md +300 -0
- package/src/client/public/cyberia-docs/OFF-CHAIN-ECONOMY.md +279 -0
- package/src/client/public/cyberia-docs/QUEST-SYSTEM.md +206 -0
- package/src/client/public/cyberia-docs/ROADMAP.md +240 -0
- package/src/client/public/cyberia-docs/UNDERPOST-PLATFORM.md +106 -0
- package/src/client/public/cyberia-docs/WHITE-PAPER.md +732 -0
- package/src/client/services/atlas-sprite-sheet/atlas-sprite-sheet.service.js +14 -20
- package/src/client/services/core/core.service.js +17 -49
- package/src/client/services/crypto/crypto.service.js +8 -13
- package/src/client/services/cyberia-action/cyberia-action.service.js +99 -0
- package/src/client/services/cyberia-client-hints/cyberia-client-hints.service.js +99 -0
- package/src/client/services/cyberia-dialogue/cyberia-dialogue.service.js +10 -16
- package/src/client/services/cyberia-entity/cyberia-entity.management.js +5 -5
- package/src/client/services/cyberia-entity/cyberia-entity.service.js +10 -16
- package/src/client/services/cyberia-instance/cyberia-instance.management.js +6 -6
- package/src/client/services/cyberia-instance/cyberia-instance.service.js +12 -18
- package/src/client/services/cyberia-instance-conf/cyberia-instance-conf.service.js +10 -16
- package/src/client/services/cyberia-map/cyberia-map.management.js +6 -6
- package/src/client/services/cyberia-map/cyberia-map.service.js +12 -18
- package/src/client/services/cyberia-quest/cyberia-quest.service.js +99 -0
- package/src/client/services/cyberia-quest-progress/cyberia-quest-progress.service.js +99 -0
- package/src/client/services/default/default.management.js +159 -267
- package/src/client/services/default/default.service.js +10 -16
- package/src/client/services/document/document.service.js +14 -19
- package/src/client/services/file/file.service.js +8 -13
- package/src/client/services/instance/instance.management.js +5 -5
- package/src/client/services/instance/instance.service.js +10 -15
- package/src/client/services/ipfs/ipfs.service.js +12 -18
- package/src/client/services/object-layer/object-layer.management.js +12 -12
- package/src/client/services/object-layer/object-layer.service.js +20 -26
- package/src/client/services/object-layer-render-frames/object-layer-render-frames.service.js +10 -16
- package/src/client/services/test/test.service.js +8 -13
- package/src/client/services/user/guest.service.js +86 -0
- package/src/client/services/user/user.management.js +5 -5
- package/src/client/services/user/user.service.js +14 -20
- package/src/client/ssr/body/404.js +3 -3
- package/src/client/ssr/body/500.js +3 -3
- package/src/client/ssr/body/CacheControl.js +5 -2
- package/src/client/ssr/body/DefaultSplashScreen.js +19 -12
- package/src/client/ssr/body/UnderpostDefaultSplashScreen.js +13 -6
- package/src/client/ssr/head/PwaItemledger.js +197 -60
- package/src/client/ssr/mailer/DefaultRecoverEmail.js +19 -20
- package/src/client/ssr/mailer/DefaultVerifyEmail.js +15 -16
- package/src/client/ssr/views/CyberiaServerMetrics.js +982 -0
- package/src/client/ssr/{offline → views}/Maintenance.js +12 -11
- package/src/client/ssr/{offline → views}/NoNetworkConnection.js +3 -3
- package/src/client/ssr/{pages → views}/Test.js +2 -2
- package/src/client/sw/core.sw.js +274 -0
- package/src/db/DataBaseProvider.js +115 -15
- package/src/db/mariadb/MariaDB.js +2 -1
- package/src/db/mongo/MongoBootstrap.js +657 -0
- package/src/db/mongo/MongooseDB.js +129 -21
- package/src/grpc/cyberia/grpc-server.js +185 -105
- package/src/index.js +1 -1
- package/src/runtime/cyberia-client/Dockerfile +101 -0
- package/src/runtime/cyberia-client/Dockerfile.dev +82 -0
- package/src/runtime/cyberia-server/Dockerfile +62 -0
- package/src/runtime/cyberia-server/Dockerfile.dev +71 -0
- package/src/runtime/express/Dockerfile +4 -4
- package/src/runtime/express/Express.js +2 -2
- package/src/runtime/lampp/Dockerfile +8 -7
- package/src/runtime/wp/Dockerfile +11 -17
- package/src/runtime/wp/Wp.js +8 -5
- package/src/server/atlas-sprite-sheet-generator.js +4 -2
- package/src/server/auth.js +2 -2
- package/src/server/client-build-docs.js +46 -47
- package/src/server/client-build.js +371 -132
- package/src/server/client-formatted.js +47 -16
- package/src/server/conf.js +91 -87
- package/src/server/data-query.js +32 -20
- package/src/server/dns.js +22 -0
- package/src/server/ipfs-client.js +232 -91
- package/src/server/object-layer.js +1 -6
- package/src/server/process.js +192 -45
- package/src/server/proxy.js +9 -2
- package/src/server/runtime.js +1 -1
- package/src/server/semantic-layer-generator-floor.js +11 -51
- package/src/server/semantic-layer-generator-resource.js +259 -0
- package/src/server/semantic-layer-generator-skin.js +41 -171
- package/src/server/semantic-layer-generator.js +122 -14
- package/src/server/shape-generator.js +108 -0
- package/src/server/start.js +34 -8
- package/src/server/valkey.js +143 -235
- package/src/ws/IoInterface.js +16 -16
- package/src/ws/core/channels/core.ws.chat.js +11 -11
- package/src/ws/core/channels/core.ws.mailer.js +29 -29
- package/src/ws/core/channels/core.ws.stream.js +19 -19
- package/src/ws/core/core.ws.connection.js +8 -8
- package/src/ws/core/core.ws.server.js +6 -5
- package/src/ws/default/channels/default.ws.main.js +10 -10
- package/src/ws/default/default.ws.connection.js +4 -4
- package/src/ws/default/default.ws.server.js +4 -3
- package/tsconfig.docs.json +15 -0
- package/typedoc.dd-cyberia.json +29 -0
- package/typedoc.json +29 -0
- package/WHITE-PAPER.md +0 -1540
- package/bin/file.js +0 -196
- package/bin/vs.js +0 -74
- package/bin/zed.js +0 -84
- package/hardhat/README.md +0 -531
- package/hardhat/WHITE-PAPER.md +0 -1540
- package/jsdoc.dd-cyberia.json +0 -68
- package/jsdoc.json +0 -68
- package/src/api/cyberia-instance-conf/cyberia-instance-conf.defaults.js +0 -413
- package/src/api/object-layer/README.md +0 -672
- package/src/client/components/core/ColorPalette.js +0 -5267
- package/src/client/components/core/JoyStick.js +0 -80
- package/src/client/components/cryptokoyn/RoutesCryptokoyn.js +0 -39
- package/src/client/components/cyberia-portal/CommonCyberiaPortal.js +0 -223
- package/src/client/components/cyberia-portal/RoutesCyberiaPortal.js +0 -62
- package/src/client/components/cyberia-portal/ServerCyberiaPortal.js +0 -136
- package/src/client/components/default/RoutesDefault.js +0 -49
- package/src/client/components/itemledger/RoutesItemledger.js +0 -40
- package/src/client/components/underpost/RoutesUnderpost.js +0 -47
- package/src/client/ssr/email/DefaultRecoverEmail.js +0 -21
- package/src/client/ssr/email/DefaultVerifyEmail.js +0 -17
- package/src/client/ssr/pages/CyberiaServerMetrics.js +0 -461
- package/src/client/sw/default.sw.js +0 -127
- package/src/client/sw/template.sw.js +0 -84
- package/src/grpc/cyberia/OFF_CHAIN_ECONOMY.md +0 -305
- package/src/grpc/cyberia/README.md +0 -326
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://www.cyberiaonline.com/assets/splash/apple-touch-icon-precomposed.png" alt="CYBERIA online"/>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<div align="center">
|
|
6
|
+
|
|
7
|
+
<h1>cyberia client</h1>
|
|
8
|
+
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
**Path:** `cyberia-client/` · **Language:** C11/GNU11 → WebAssembly (Emscripten) · **Role:** presentation runtime for Cyberia
|
|
12
|
+
|
|
13
|
+
`cyberia-client` is the rendering and interactive runtime for the Cyberia MMO extension on Underpost Platform. It captures input, predicts the local player, reconciles against authoritative snapshots, interpolates remote entities, and renders the world. It owns the render policy locally.
|
|
14
|
+
|
|
15
|
+
It is **not** a world-simulation authority. The authoritative simulation runs on `cyberia-server`. Persistent content and asset metadata come from `engine-cyberia` via REST.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Operating model
|
|
20
|
+
|
|
21
|
+
Three independent processes, non-overlapping roles. The ecosystem is playable only when all three are running and healthy at the same time.
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
engine-cyberia cyberia-server cyberia-client
|
|
25
|
+
content authority simulation authority presentation runtime
|
|
26
|
+
^ REST | WebSocket binary
|
|
27
|
+
| atlases, asset | snapshots (server -> client)
|
|
28
|
+
| metadata, optional | input cmds (client -> server)
|
|
29
|
+
| client hints v
|
|
30
|
+
`---------------- Browser tab: prediction, reconciliation, interpolation, render
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
- Each service owns its own monitor and reconnector.
|
|
34
|
+
- The client reconnects to `cyberia-server` over WebSocket and fetches content from `engine-cyberia` over REST.
|
|
35
|
+
- If any of the three services is unhealthy, the game moves to standby until all three recover.
|
|
36
|
+
|
|
37
|
+
The client speaks two transports:
|
|
38
|
+
|
|
39
|
+
- **WebSocket binary** to `cyberia-server` for snapshots and input commands
|
|
40
|
+
- **REST** to `engine-cyberia` for atlas frames, asset blobs, and optional client-hints overrides
|
|
41
|
+
|
|
42
|
+
Asset distribution flows through Underpost Platform's static and PWA pipeline.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Render loop
|
|
47
|
+
|
|
48
|
+
The render loop runs at vsync. Tick simulation is decoupled from render frames via a fixed-timestep accumulator. Step ordering inside one render frame:
|
|
49
|
+
|
|
50
|
+
1. **Optional client hints poll** — advance the asynchronous hints fetch state machine.
|
|
51
|
+
2. **Input capture** — drain raw OS events.
|
|
52
|
+
3. **Input dispatch** — UI hit-test → build typed input command (`kind`, `clientTick`, `sequence`, payload) → apply to prediction → send on the wire.
|
|
53
|
+
4. **Reconciliation** — apply latest snapshot's `lastAcked`: drop acknowledged input commands from the replay buffer; rewind predicted self to authoritative position; replay unacked input commands.
|
|
54
|
+
5. **Fixed-timestep prediction** — while accumulator ≥ `tickDuration`, advance prediction one tick.
|
|
55
|
+
6. **Interpolation** — compute remote-entity view positions at `renderTick = serverTickEstimate − INTERP_TICKS`.
|
|
56
|
+
7. **Render** — read view models; never mutate world state.
|
|
57
|
+
|
|
58
|
+
Render frame rate is independent of simulation tick rate. The fixed-timestep accumulator ensures the predicted simulation advances at the authoritative `tickRate` regardless of FPS.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Module map
|
|
63
|
+
|
|
64
|
+
Directional dependency: from outermost (UI / render) inward toward `domain/`. Nothing in `domain/` imports outward.
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
src/
|
|
68
|
+
domain/
|
|
69
|
+
tick.h tick rate constants, monotonic types
|
|
70
|
+
presentation_runtime.{c,h} sole owner of presentation: async fetch of
|
|
71
|
+
/api/cyberia-client-hints/:CYBERIA_CLIENT_HINTS_CODE,
|
|
72
|
+
palette/status-icon/camera accessors, tiny
|
|
73
|
+
inline bootstrap fallback
|
|
74
|
+
input/
|
|
75
|
+
input_command.{c,h} typed InputCommand factory; sequence allocation
|
|
76
|
+
prediction/
|
|
77
|
+
prediction.{c,h} predicted self position; replay buffer; reconcile
|
|
78
|
+
interpolation/
|
|
79
|
+
interpolation.{c,h} remote entity view positions at renderTick
|
|
80
|
+
network/
|
|
81
|
+
session.{c,h} last server tick, last acked sequence, tick estimate
|
|
82
|
+
client.{c,h} WebSocket lifecycle + binary I/O
|
|
83
|
+
socket.{c,h} Emscripten WebSocket bridge
|
|
84
|
+
ui/ modals, HUD, inventory bar, FCT, nameplates
|
|
85
|
+
game_state.{c,h} world state mirror (gameplay subset only)
|
|
86
|
+
binary_aoi_decoder.{c,h} server snapshot parser
|
|
87
|
+
game_render.{c,h}, render.{c,h} render pipeline
|
|
88
|
+
main.c entry point + render loop
|
|
89
|
+
js/services.{js,c,h} REST fetch bridge (atlas, ui-icons, client-hints)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
| Owner | Owns | Reads | Writes |
|
|
93
|
+
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
94
|
+
| `domain/presentation_runtime` | the entire presentation surface (palette, entity colour keys, status icons, camera, cell, interpolation). Inline bootstrap fallback while the fetch is in flight. | JSON response from `/api/cyberia-client-hints` | own table + one-shot hydration of `g_game_state.cell_size`, `.interpolation_ms`, `.camera.zoom` |
|
|
95
|
+
| `input/input_command` | typed InputCommand factory | session for tick + sequence | — |
|
|
96
|
+
| `prediction/` | predicted self position, input replay buffer | snapshot self + session ack | predicted self |
|
|
97
|
+
| `interpolation/` | remote entity `interp_pos` | snapshot history | remote `interp_pos` only |
|
|
98
|
+
| `network/session` | last server tick, last acked sequence | snapshot header | session singletons |
|
|
99
|
+
| `binary_aoi_decoder` | wire parser | binary frames | `game_state` + session + prediction (via callback) |
|
|
100
|
+
| `game_state` | gameplay world mirror | — | — |
|
|
101
|
+
| `render/`, `ui/` | rendering | view models | screen |
|
|
102
|
+
|
|
103
|
+
`game_state` holds only the gameplay subset of world state (entities, positions, life, AOI, equipment, frozen flag, coins). It does not carry palette state, status-icon visuals, or any other presentation field.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Presentation ownership
|
|
108
|
+
|
|
109
|
+
The client owns its render policy. The authoritative server holds no presentation state.
|
|
110
|
+
|
|
111
|
+
Three layers, strictly inward-dependent:
|
|
112
|
+
|
|
113
|
+
1. **`domain/presentation_runtime.{c,h}`** — sole owner of every presentation value. Fires a single asynchronous GET against `/api/cyberia-client-hints/:CYBERIA_CLIENT_HINTS_CODE` at startup, polled once per render frame. When the response settles, parses palette, entity colour keys, status-icon visuals, and camera/cell tunings into a process-local table and writes a one-shot hydration into `g_game_state` (cell_size, interpolation_ms, camera.zoom). The C client carries NO compile-time palette or status table — only a tiny inline neutral-grey bootstrap so the splash screen has something to draw while the fetch is in flight. The canonical schema for the response lives at engine-cyberia's `src/client/components/cyberia/SharedDefaultsCyberia.js`.
|
|
114
|
+
2. **Renderers** — call `presentation_runtime_palette("KEY")`, `presentation_runtime_status_icon(u8)`, `presentation_runtime_status_border(u8)`, `presentation_runtime_entity_fallback_color(entity_type)` at each use site.
|
|
115
|
+
|
|
116
|
+
What lives in this layer:
|
|
117
|
+
|
|
118
|
+
- Named palette (colors).
|
|
119
|
+
- Per-entity-type fallback color keys.
|
|
120
|
+
- Status-icon visual table (icon stem + border color per numeric ID).
|
|
121
|
+
- Camera smoothing / zoom defaults.
|
|
122
|
+
- Interpolation window.
|
|
123
|
+
- Dev-overlay flag.
|
|
124
|
+
- Viewport screen factors.
|
|
125
|
+
|
|
126
|
+
What does **not** travel on the WebSocket init or AOI streams:
|
|
127
|
+
|
|
128
|
+
- Palette.
|
|
129
|
+
- Camera knobs.
|
|
130
|
+
- Dev-overlay flag.
|
|
131
|
+
- Interpolation window.
|
|
132
|
+
- Status-icon visuals.
|
|
133
|
+
- Per-entity-type color keys.
|
|
134
|
+
|
|
135
|
+
The numeric status-icon u8 still rides on the AOI wire — that is the protocol-level half. The icon stem and border color are presentation and are resolved entirely on the client.
|
|
136
|
+
|
|
137
|
+
### Optional client hints
|
|
138
|
+
|
|
139
|
+
`GET /api/cyberia-client-hints/:instanceCode` (engine-cyberia REST, **not** cyberia-server) returns a JSON document mirroring the structure of the compile-time defaults. The client is required to function with no successful call to this endpoint:
|
|
140
|
+
|
|
141
|
+
- 200 with `{ palette, entityColorKeys, statusIcons, cameraSmoothing, cameraZoom, defaultWidthScreenFactor, defaultHeightScreenFactor, interpolationMs, devUi }` — overrides applied on top of defaults.
|
|
142
|
+
- 404 if the instance has no overrides — defaults are used.
|
|
143
|
+
- Network error — defaults are used.
|
|
144
|
+
|
|
145
|
+
No authentication; presentation hints are not secret. The Go authoritative server never calls this endpoint.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Tick-aware components
|
|
150
|
+
|
|
151
|
+
### Session
|
|
152
|
+
|
|
153
|
+
`network/session.{c,h}` tracks per-connection tick state:
|
|
154
|
+
|
|
155
|
+
- `last_server_tick` — highest snapshot tick observed.
|
|
156
|
+
- `last_acked_input_sequence` — highest sequence the server has applied for this client; echoed in every snapshot header.
|
|
157
|
+
- `next_input_sequence` — monotonic counter for outgoing input commands.
|
|
158
|
+
- `server_tick_estimate` — extrapolation of last server tick by elapsed wall time, used to stamp outgoing input commands and to compute `renderTick`.
|
|
159
|
+
|
|
160
|
+
### Prediction
|
|
161
|
+
|
|
162
|
+
`prediction/prediction.{c,h}` owns the predicted self position. It is the only writer of the predicted state. Internally it tracks **two** positions: the discrete per-tick `predicted_pos` (where the simulation says the player is) and the continuous render-frame `display_pos` (what the renderer reads). The renderer never sees the discrete value.
|
|
163
|
+
|
|
164
|
+
- `prediction_apply(cmd)` — optimistic local apply of an input command + push onto replay buffer.
|
|
165
|
+
- `prediction_step(dt)` — fixed-timestep advance, called by the accumulator. Mutates `predicted_pos` only.
|
|
166
|
+
- `prediction_reconcile()` — on snapshot arrival: drop acknowledged inputs, rewind self to authoritative position, replay unacked inputs. Mutates `predicted_pos` only.
|
|
167
|
+
- `prediction_display_step(frame_dt)` — per-render-frame exponential lerp of `display_pos` toward `predicted_pos`. This is the layer that absorbs reconcile snaps and sim-tick stepping so the visible main player moves continuously.
|
|
168
|
+
- `prediction_self_position()` — render-time accessor; returns the smoothed `display_pos`.
|
|
169
|
+
|
|
170
|
+
### Interpolation
|
|
171
|
+
|
|
172
|
+
`interpolation/interpolation.{c,h}` owns remote-entity render-time positions. It is the only writer of remote `interp_pos`. It never touches the local player (prediction owns that). Sampling happens at `renderTick = serverTickEstimate − INTERP_TICKS`.
|
|
173
|
+
|
|
174
|
+
### Input command pipeline
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
mouse / touch / keyboard
|
|
178
|
+
│
|
|
179
|
+
▼
|
|
180
|
+
input/input_capture
|
|
181
|
+
│
|
|
182
|
+
▼
|
|
183
|
+
UI hit-test cascade ──► modal/inventory/HUD consumed?
|
|
184
|
+
│ no
|
|
185
|
+
▼
|
|
186
|
+
input_command_build_* stamps client_tick + sequence
|
|
187
|
+
│
|
|
188
|
+
▼
|
|
189
|
+
prediction_apply optimistic local apply
|
|
190
|
+
│
|
|
191
|
+
▼
|
|
192
|
+
uplink send WebSocket binary frame
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
`InputCommand.Sequence` is allocated by `session_next_input_sequence`. Monotonic, never reused. The server echoes the highest applied sequence in every snapshot header; the prediction module drops acked commands from its replay buffer on reconciliation.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Binary AOI snapshot format
|
|
200
|
+
|
|
201
|
+
The client decodes server-pushed AOI frames. Header (little-endian, 11 bytes for `0x01`/`0x03`):
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
[0] u8 msgType 0x01 aoi_update | 0x03 full_aoi
|
|
205
|
+
[1..4] u32 tick simulation tick at which the snapshot was produced
|
|
206
|
+
[5..8] u32 lastAcked highest InputCommand.Sequence applied for this client
|
|
207
|
+
[9..10] u16 entityCount entity blocks that follow
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
After parsing the header, the decoder invokes `session_on_snapshot(tick, lastAcked)` and then `prediction_reconcile()` so the predicted self stays consistent with the just-arrived authoritative state.
|
|
211
|
+
|
|
212
|
+
Other message types — init data (0x02), FCT (0x04), ItemFCT (0x05) — carry their own headers and are not part of the per-tick replication stream.
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## REST fetches (engine-cyberia)
|
|
217
|
+
|
|
218
|
+
The client speaks REST directly to engine-cyberia for content. None of these calls go through cyberia-server.
|
|
219
|
+
|
|
220
|
+
| Endpoint | Purpose |
|
|
221
|
+
| ------------------------------------------------ | ------------------------------------ |
|
|
222
|
+
| `GET /api/atlas-sprite-sheet/metadata/:itemKey` | Frame layout JSON for a sprite atlas |
|
|
223
|
+
| `GET /api/atlas-sprite-sheet/blob/:itemKey` | Atlas PNG |
|
|
224
|
+
| `GET /api/object-layer/:itemId` | ObjectLayer JSON metadata |
|
|
225
|
+
| `GET /api/cyberia-dialogue/code/default-:itemId` | Dialogue lines for an NPC |
|
|
226
|
+
| `GET /assets/ui-icons/:iconId.png` | Status-bar icons |
|
|
227
|
+
| `GET /api/cyberia-client-hints/:instanceCode` | Optional presentation overrides |
|
|
228
|
+
|
|
229
|
+
All requests are CORS-simple GETs (no preflight) and cacheable. None require credentials.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Build and run
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
cd cyberia-client
|
|
237
|
+
|
|
238
|
+
# Development build
|
|
239
|
+
make -f Web.mk clean && make -f Web.mk web
|
|
240
|
+
|
|
241
|
+
# Release build
|
|
242
|
+
make -f Web.mk clean && make -f Web.mk web BUILD_MODE=RELEASE
|
|
243
|
+
|
|
244
|
+
# Build + serve on dev port :8082
|
|
245
|
+
make -f Web.mk serve-development
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
The build is part of the Underpost Platform static + PWA pipeline; production deploys go through `underpost client` and `underpost deploy`.
|
|
249
|
+
|
|
250
|
+
### Output
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
bin/
|
|
254
|
+
index.html — Emscripten HTML container (from shell.html template)
|
|
255
|
+
index.wasm — Compiled WebAssembly module
|
|
256
|
+
index.js — Emscripten JS glue
|
|
257
|
+
index.data — Preloaded data bundle
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Compile-time configuration
|
|
263
|
+
|
|
264
|
+
`src/config.h`:
|
|
265
|
+
|
|
266
|
+
| Constant | Default | Description |
|
|
267
|
+
| --------------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
268
|
+
| `WS_URL` | `wss://server.cyberiaonline.com/ws` | WebSocket endpoint of cyberia-server |
|
|
269
|
+
| `API_BASE_URL` | `https://www.cyberiaonline.com` | engine-cyberia REST base URL |
|
|
270
|
+
| `CYBERIA_CLIENT_HINTS_CODE` | `cyberia-main` | Lookup key for the optional client-hints fetch (presentation override key — never an instance/server identifier) |
|
|
271
|
+
| `HTTP_TIMEOUT_SECONDS` | `10` | HTTP request timeout |
|
|
272
|
+
| `MAX_TEXTURE_CACHE_SIZE` | `512` | Atlas texture LRU cap |
|
|
273
|
+
| `MAX_LAYER_CACHE_SIZE` | `256` | ObjectLayer metadata LRU cap |
|
|
274
|
+
| `MAX_ATLAS_CACHE_SIZE` | `256` | Atlas metadata LRU cap |
|
|
275
|
+
| `DEFAULT_FRAME_DURATION_MS` | `100` | Default animation frame duration |
|
|
276
|
+
| `ENABLE_DEV_UI` | `false` | Force dev overlay regardless of presentation hints |
|
|
277
|
+
| `APP_VERSION` | `"1.0.0"` | Application version string |
|
|
278
|
+
|
|
279
|
+
For local development, point `WS_URL` and `API_BASE_URL` at `localhost` before rebuilding.
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Persistent storage
|
|
284
|
+
|
|
285
|
+
`serial.c` uses Emscripten's IDBFS (IndexedDB File System) at `/persistent/` for:
|
|
286
|
+
|
|
287
|
+
- Player authentication token (EIP-712 signature).
|
|
288
|
+
- Local game settings (audio volume, key bindings).
|
|
289
|
+
- Cached ObjectLayer metadata (session warm-up cache).
|
|
290
|
+
|
|
291
|
+
No game state is persisted client-side; the authoritative server is the source of truth.
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://www.cyberiaonline.com/assets/splash/apple-touch-icon-precomposed.png" alt="CYBERIA online"/>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<div align="center">
|
|
6
|
+
|
|
7
|
+
<h1>cyberia server</h1>
|
|
8
|
+
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
**Path:** `cyberia-server/` · **Language:** Go · **Role:** authoritative simulation runtime for Cyberia
|
|
12
|
+
|
|
13
|
+
`cyberia-server` is the authoritative simulation runtime for the Cyberia MMO extension on Underpost Platform. It owns world state, advances a fixed-rate tick, drains typed input commands from connected clients, and dispatches AOI-filtered snapshots on a separately-paced replication tick.
|
|
14
|
+
|
|
15
|
+
It is **not** the content authority. World content is loaded from `engine-cyberia` over gRPC. It is **not** the render-policy authority. Presentation is owned by `cyberia-client`.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Operating model
|
|
20
|
+
|
|
21
|
+
Three independent processes, non-overlapping roles. The ecosystem is playable only when all three are running and healthy at the same time.
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
engine-cyberia (Node.js) cyberia-server (Go) cyberia-client (C/WASM)
|
|
25
|
+
content authority authoritative simulation presentation runtime
|
|
26
|
+
gRPC + REST tick + AOI + snapshots render + prediction
|
|
27
|
+
|
|
28
|
+
└── gRPC GetFullInstance ──► └── WebSocket binary ──►
|
|
29
|
+
world config snapshots -> / input <-
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- Each service is supervised independently and owns its own monitor and reconnector.
|
|
33
|
+
- `cyberia-server` loads world configuration from `engine-cyberia` and does not fabricate a world.
|
|
34
|
+
- If any one of the three services is unhealthy, the game moves to standby until all three recover.
|
|
35
|
+
|
|
36
|
+
The server speaks two protocols:
|
|
37
|
+
|
|
38
|
+
- **gRPC inbound** to consume world configuration from `engine-cyberia`
|
|
39
|
+
- **WebSocket binary** to deliver snapshots and accept typed input commands
|
|
40
|
+
|
|
41
|
+
There is no per-tick traffic between `cyberia-server` and `engine-cyberia`, and no presentation authority in the Go runtime.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Tick model
|
|
46
|
+
|
|
47
|
+
The tick is the universal coordinate of the simulation.
|
|
48
|
+
|
|
49
|
+
| Concept | Default | Notes |
|
|
50
|
+
| ----------------- | --------------- | ------------------------------------------------------------------------------------------------------- |
|
|
51
|
+
| **tick** | `uint32` | Monotonic, advanced once per simulation step. Resets only on world rebuild. |
|
|
52
|
+
| **tick rate** | `30` Hz | Simulation Hz. Loaded from world configuration. **The string `fps` is not used to describe this rate.** |
|
|
53
|
+
| **snapshot rate** | `20` Hz | AOI replication Hz. Decoupled from tick rate so bandwidth scales independently of simulation fidelity. |
|
|
54
|
+
| **tick duration** | `1 / tick_rate` | The dt used by every simulation phase. |
|
|
55
|
+
| **current tick** | `uint32` | The simulation step about to run (or just produced). Stamped into every outgoing snapshot. |
|
|
56
|
+
|
|
57
|
+
Two independent tickers:
|
|
58
|
+
|
|
59
|
+
| Ticker | Rate | Responsibility |
|
|
60
|
+
| ----------- | ----------------- | ------------------------------------------------------------ |
|
|
61
|
+
| simulation | `tickRate` Hz | advance world by exactly one tick; run phases in fixed order |
|
|
62
|
+
| replication | `snapshotRate` Hz | per-player AOI filter + encode + dispatch |
|
|
63
|
+
|
|
64
|
+
Movement integration is `dt`-based: `step = speed * tickDuration.Seconds()`. Frame-count integration is not used anywhere on the server.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Simulation phases
|
|
69
|
+
|
|
70
|
+
Inside one simulation tick, the phases run in a fixed order. Phases are the **only** functions allowed to mutate world state.
|
|
71
|
+
|
|
72
|
+
1. **`phaseInput`** — drain each player's `InputQueue`; dispatch typed input commands to gameplay handlers.
|
|
73
|
+
2. **`phaseLifecycle`** — respawn timers, despawn expirations.
|
|
74
|
+
3. **`phaseSkills`** — skill projectile collisions.
|
|
75
|
+
4. **`phaseAI`** — bot behaviour decisions.
|
|
76
|
+
5. **`phaseMovement`** — integrate positions using `tickDuration`.
|
|
77
|
+
6. **`phasePortals`** — portal entry and teleport.
|
|
78
|
+
|
|
79
|
+
Separately, on the replication ticker:
|
|
80
|
+
|
|
81
|
+
7. **`phaseReplication`** — per player: compute AOI rectangle, build snapshot, dispatch via the player's WebSocket write channel.
|
|
82
|
+
|
|
83
|
+
Phases never read presentation data. Phases consume world configuration (gameplay rules) and the per-player input queue.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Input command pipeline
|
|
88
|
+
|
|
89
|
+
Client input is typed end-to-end. There is no JSON intermediate on the binary path. The simulation tick is the only consumer of input commands.
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
WS frame (binary) → decode → typed InputCommand{kind, clientTick, sequence, payload}
|
|
93
|
+
│
|
|
94
|
+
▼
|
|
95
|
+
dispatchInputCommand
|
|
96
|
+
│
|
|
97
|
+
▼
|
|
98
|
+
PlayerState.InputQueue (per-player, bounded ring)
|
|
99
|
+
│
|
|
100
|
+
▼
|
|
101
|
+
phaseInput (under world mutex, once per simulation tick)
|
|
102
|
+
│
|
|
103
|
+
▼
|
|
104
|
+
phase_input_handlers.go — typed dispatch per InputKind
|
|
105
|
+
│
|
|
106
|
+
▼
|
|
107
|
+
authoritative world state
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
| Property | Detail |
|
|
111
|
+
| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
112
|
+
| One queue per player | drained exactly once per simulation tick |
|
|
113
|
+
| One typed handler per `InputKind` | each handler runs under the world mutex held by `phaseInput` |
|
|
114
|
+
| One source of truth | `phase_input_handlers.go` is the only file that translates an input command into world state |
|
|
115
|
+
| Sequence numbering | `InputCommand.Sequence` is monotonic per client; the server tracks the highest applied sequence per player in `PlayerState.LastAckedInputSequence` |
|
|
116
|
+
|
|
117
|
+
A second uplink path, `handleJSONUplink`, parses text-framed JSON uplinks into the same typed `InputCommand` and routes them through the same per-tick queue. No synchronous game-state mutation runs on the WebSocket read goroutine.
|
|
118
|
+
|
|
119
|
+
### Input kinds
|
|
120
|
+
|
|
121
|
+
| Kind | Wire byte | Effect |
|
|
122
|
+
| ---------------- | --------- | ------------------------------------------------------------------------------- |
|
|
123
|
+
| `PlayerAction` | `0x11` | TAP — movement intent + skill trigger |
|
|
124
|
+
| `ItemActivation` | `0x12` | Equip/unequip an ObjectLayer item; validated against equipment rules |
|
|
125
|
+
| `FreezeStart` | `0x13` | Enter FrozenInteractionState (blocks movement/damage; rest of world unaffected) |
|
|
126
|
+
| `FreezeEnd` | `0x14` | Exit FrozenInteractionState |
|
|
127
|
+
| `Chat` | `0x15` | Pure relay; no game-state mutation |
|
|
128
|
+
| `GetItemsIDs` | `0x16` | Skill-item-id lookup; produces a response frame |
|
|
129
|
+
| `Handshake` | `0x10` | Connection establishment; no gameplay effect |
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## AOI replication
|
|
134
|
+
|
|
135
|
+
The AOI system filters world state per-player so each client receives only what its character can perceive.
|
|
136
|
+
|
|
137
|
+
Per player:
|
|
138
|
+
|
|
139
|
+
- AOI is a rectangle centered on the player position with size determined by `aoiRadius` from world configuration.
|
|
140
|
+
- On each replication tick, the server iterates the player's map, includes any entity whose bounding rectangle overlaps the AOI, and emits a snapshot.
|
|
141
|
+
|
|
142
|
+
### Snapshot header (binary, little-endian)
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
[0] u8 msgType 0x01 = aoi_update, 0x03 = full_aoi
|
|
146
|
+
[1..4] u32 tick simulation tick at which the snapshot was produced
|
|
147
|
+
[5..8] u32 lastAcked highest InputCommand.Sequence applied for this player
|
|
148
|
+
[9..10] u16 entityCount entity blocks that follow
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The `tick` and `lastAcked` fields are how the client reconciles its predicted self with authoritative state. The client drops input commands with `sequence ≤ lastAcked` from its replay buffer, then rewinds and replays the rest.
|
|
152
|
+
|
|
153
|
+
Other message types (init data, FCT) carry their own headers and are not part of the per-tick replication stream.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## World configuration
|
|
158
|
+
|
|
159
|
+
World configuration is loaded once at boot from engine-cyberia via gRPC `GetFullInstance(instanceCode)`. The simulation consumes the following from it:
|
|
160
|
+
|
|
161
|
+
| Field | Used for |
|
|
162
|
+
| -------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
|
|
163
|
+
| `cellSize` | grid math |
|
|
164
|
+
| `tickRate` | simulation Hz |
|
|
165
|
+
| `aoiRadius` | per-player AOI rectangle size |
|
|
166
|
+
| `entityBaseSpeed`, `entityBaseMaxLife`, `entityBaseActionCooldownMs` | base stats |
|
|
167
|
+
| `economyRules` | Fountain & Sink coin economy |
|
|
168
|
+
| `skillRules` | projectile / doppelganger spawn rates and lifetimes |
|
|
169
|
+
| `equipmentRules` | item activation constraints (one-per-type, requireSkin, activeItemTypes) |
|
|
170
|
+
| `entityDefaults[*]` | per-entity-type gameplay defaults: live/dead/drop item IDs, default object layers |
|
|
171
|
+
|
|
172
|
+
World configuration is gameplay-only. Presentation fields (palette, status-icon visuals, camera knobs, dev-overlay flag, interpolation window, screen factors) are not part of this contract. Presentation metadata ownership is described in the next section.
|
|
173
|
+
|
|
174
|
+
Hot reload of ObjectLayers is supported via periodic `GetObjectLayerManifest` calls; world topology and gameplay rules are reloaded only on server restart.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Presentation metadata ownership
|
|
179
|
+
|
|
180
|
+
`cyberia-server` holds **no** presentation state. There is no field on the server for:
|
|
181
|
+
|
|
182
|
+
- palette
|
|
183
|
+
- status-icon iconId or border color
|
|
184
|
+
- camera smoothing or camera zoom
|
|
185
|
+
- dev-overlay flag
|
|
186
|
+
- screen-factor overrides
|
|
187
|
+
- interpolation window
|
|
188
|
+
|
|
189
|
+
These live in the client runtime's compile-time defaults. Per-instance presentation overrides are served by engine-cyberia at `GET /api/cyberia-client-hints/:instanceCode` and consumed directly by the client. The Go process never calls that endpoint.
|
|
190
|
+
|
|
191
|
+
### `sim_palette.go`
|
|
192
|
+
|
|
193
|
+
A small internal RGBA table inside `sim_palette.go` exists solely to fill the optional per-entity color bytes on the AOI wire for portals, skill projectiles, and freshly spawned players. The table is:
|
|
194
|
+
|
|
195
|
+
- compile-time constant
|
|
196
|
+
- not loaded from any contract (gRPC, REST, proto, env)
|
|
197
|
+
- read only at world-build and one-shot spawn paths
|
|
198
|
+
- never consulted during any per-tick simulation phase
|
|
199
|
+
|
|
200
|
+
The client treats those wire bytes as a hint and resolves the actual fallback color from its own palette by entity type.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Source layout
|
|
205
|
+
|
|
206
|
+
Paths are relative to `cyberia-server/`. Gameplay logic lives under `src/`; the gRPC client and world builder under `src/grpcclient/`; the chi-based REST router under `api/`.
|
|
207
|
+
|
|
208
|
+
| File | Responsibility |
|
|
209
|
+
| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
210
|
+
| `main.go` | Entry point — loads `.env`, dials engine-cyberia gRPC, mounts WS and `/api` router, starts listener |
|
|
211
|
+
| `src/tick.go` | `Tick`, `InputSequence` types and tick rate constants |
|
|
212
|
+
| `src/server.go` | `GameServer` struct, simulation+replication tickers, `ApplyInstanceConfig`, world mutator orchestration |
|
|
213
|
+
| `src/types.go` | Core data structures (`PlayerState`, `BotState`, `MapState`, `ObjectLayerState`, etc.) |
|
|
214
|
+
| `src/simulation_phases.go` | Phase entry points called from the tick loop |
|
|
215
|
+
| `src/phase_input_handlers.go` | Typed dispatch per `InputKind`; the only translator from input commands to world state |
|
|
216
|
+
| `src/input_command.go` | `InputCommand` struct, `InputKind` constants, per-player queue helper |
|
|
217
|
+
| `src/aoi_binary.go` | Binary AOI snapshot encoder; message type constants |
|
|
218
|
+
| `src/object_layer.go` | ObjectLayer Go types mirroring MongoDB schema |
|
|
219
|
+
| `src/instance_loader.go` | World reconstruction from gRPC payload |
|
|
220
|
+
| `src/collision.go` | Grid collision, portal transitions, death handling |
|
|
221
|
+
| `src/pathfinding.go` | A\* pathfinding for bot and player navigation |
|
|
222
|
+
| `src/skill.go`, `src/skill_dispatcher.go`, `src/skill_projectile.go`, `src/skill_doppelganger.go` | Skill registry and per-skill handlers |
|
|
223
|
+
| `src/economy.go` | Fountain & Sink coin economy |
|
|
224
|
+
| `src/life_regen.go` | HP regeneration |
|
|
225
|
+
| `src/ai.go` | Bot AI |
|
|
226
|
+
| `src/stats.go` | Active stat aggregation, sum-stats limit enforcement |
|
|
227
|
+
| `src/entity_status.go` | Entity Status Indicator (ESI) numeric IDs |
|
|
228
|
+
| `src/frozen_state.go` | FrozenInteractionState |
|
|
229
|
+
| `src/handlers.go` | WebSocket lifecycle, binary uplink decoder, JSON-uplink back-compat adapter |
|
|
230
|
+
| `src/sim_palette.go` | Internal RGBA fill for AOI wire bytes (not a contract) |
|
|
231
|
+
| `src/grpcclient/` | gRPC client + world builder for engine-cyberia |
|
|
232
|
+
| `api/router.go`, `api/metrics.go` | chi router; `/api/v1/*` endpoints |
|
|
233
|
+
| `proto/cyberia.proto` | gRPC service contract shared with engine-cyberia |
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## REST surface
|
|
238
|
+
|
|
239
|
+
`/api/v1/*` is the operational surface; it is independent of the WebSocket gameplay protocol.
|
|
240
|
+
|
|
241
|
+
| Endpoint | Method | Description |
|
|
242
|
+
| --------------------------- | ------ | ----------------------------------------- |
|
|
243
|
+
| `/api/v1/health` | GET | Simple health check |
|
|
244
|
+
| `/api/v1/metrics` | GET | Complete server metrics snapshot |
|
|
245
|
+
| `/api/v1/metrics/health` | GET | Detailed health with entity/player counts |
|
|
246
|
+
| `/api/v1/metrics/entities` | GET | Entity-type breakdown |
|
|
247
|
+
| `/api/v1/metrics/websocket` | GET | Active connections, message rates |
|
|
248
|
+
| `/api/v1/metrics/workload` | GET | Per-map entity workload |
|
|
249
|
+
|
|
250
|
+
All content data (ObjectLayer metadata, asset blobs, optional client hints) is served directly by engine-cyberia REST. `cyberia-server` does not proxy content.
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Environment
|
|
255
|
+
|
|
256
|
+
| Variable | Default | Description |
|
|
257
|
+
| --------------------------------- | ----------------- | -------------------------------------------------- |
|
|
258
|
+
| `ENGINE_GRPC_ADDRESS` | `localhost:50051` | engine-cyberia gRPC address (**required**) |
|
|
259
|
+
| `INSTANCE_CODE` | `default` | Instance code to load on startup |
|
|
260
|
+
| `ENGINE_API_BASE_URL` | _(empty)_ | engine-cyberia REST base URL; forwarded to clients |
|
|
261
|
+
| `ENGINE_GRPC_RELOAD_INTERVAL_SEC` | _(disabled)_ | ObjectLayer hot-reload polling interval |
|
|
262
|
+
| `SERVER_PORT` | `8081` | WebSocket + HTTP listen port |
|
|
263
|
+
| `STATIC_DIR` | `./public` | Directory for static WASM client files |
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Build and run
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
cd cyberia-server
|
|
271
|
+
|
|
272
|
+
# Development
|
|
273
|
+
go run main.go
|
|
274
|
+
|
|
275
|
+
# Production binary
|
|
276
|
+
go build -o cyberia-server .
|
|
277
|
+
./cyberia-server
|
|
278
|
+
```
|