Giter Club home page Giter Club logo

9c-launcher's Introduction

Nine Chronicles Launcher

Discord Planetarium-Dev Discord Invite Wiki for more in-depth information.

Overview

Electron-based multi-platform game launcher to run Nine Chronicles.

Installation

First, install all dependencies required for development.

yarn

After, run the following command.

yarn codegen
yarn dev

Development

The basic frontend has webpack-hot-reload, which automatically reflects code changes. Developing the renderer process does not require electron relaunch. However, when there's a change in the main process, electron relaunch is required.

Build

yarn
yarn codegen
yarn build  # development build
yarn build-prod  # production build

Packaging

Note This section hasn't been used in production and it's likely outdated.

# generate/sign a new APV with the given private key and pack
APV_SIGN_KEY=... yarn pack-all
# generate/sign a specific APV with the given private key and pack
APV_SIGN_KEY=... APV_NO=1234 yarn pack-all
# pack with the given APV
APV=... yarn pack-all
# pack without APV (for reusing the APV of the latest release)
yarn pack-all

Packaging requires the following environment variables. If both the APV and APV_SIGN_KEY are ommited, APV(App Protocol Version) signing will not take place.

Replacing config.json content after packaging

Note This section hasn't been used in production and it's likely outdated.

For replacing the configuration content of config.json in the already packed Windows.zip or macOS.tar.gz, it's convenient to use the scripts/extract-config.sh and scripts/replace-config.sh scripts.

# extract config.json content from package (supports Windows.zip and macOS.tar.gz)
scripts/extract-config.sh path/Windows.zip > config.json
# replace config.json content in package (supports Windows.zip and macOS.tar.gz)
scripts/replace-config.sh path/Windows.zip < config.json

Packaging with electron-builder

Note that building with electron-builder is experimental.

# Windows (nsis)
# macOS (dmg, zip)
yarn pack-all:electron-builder

Log Path

Logs are saved in the following paths:

- on macOS: ~/Library/Logs/Nine Chronicles/{process type}.log
- on Windows: %USERPROFILE%\AppData\Roaming\Nine Chronicles\logs\{process type}.log

Visual Studio Code Extensions

Install the following extensions in the Visual Studio Code extensions page(Windows: ⇧⌃X, macOS: ⇧⌘X):

9c-launcher's People

Contributors

akamig avatar akiacode avatar area363 avatar atralupus avatar basixkor avatar boscohyun avatar cirnov avatar dahlia avatar dependabot[bot] avatar earlbread avatar greymistcube avatar ipdae avatar koremp avatar limebell avatar longfin avatar maxswjeon avatar moreal avatar mu-hun avatar nagavenkatasaim avatar namyujeong avatar planet-submodule-updater avatar prajwalborkar avatar riemannulus avatar rohjs avatar sky1045 avatar sonohoshi avatar unengine avatar upa-r-upa avatar youngkiu avatar ysjk2003 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

9c-launcher's Issues

로그인 후 /run-standalone 호출 시 제네시스 블록 에러

현재 master 브랜치에서 로그인후 /run-standalone이 호출되면 아래와 같은 Exception 로그와 함께 500를 반환합니다. 현재 사용하고 있는 제네시스 블록(genesis-block-9c-beta-2)가 planetarium/nekoyume-untiy:master 가 호환되지 않는 것 같습니다.

System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.Collections.Immutable.ImmutableDictionary`2.get_Item(TKey key)
   at Nekoyume.Action.InitializeStates.LoadPlainValueInternal(IImmutableDictionary`2 plainValue) in /Users/moreal/github/planetarium/nekoyume-unity/nekoyume/Assets/_Scripts/Lib9c/Action/InitializeStates.cs:line 84
   at Nekoyume.Action.GameAction.LoadPlainValue(IValue plainValue) in /Users/moreal/github/planetarium/nekoyume-unity/nekoyume/Assets/_Scripts/Lib9c/Action/GameAction.cs:line 35
   at Libplanet.Action.PolymorphicAction`1.LoadPlainValue(Dictionary plainValue)
   at Libplanet.Action.PolymorphicAction`1.LoadPlainValue(IValue plainValue)
   at Libplanet.Tx.Transaction`1.ToAction(IValue value)
   at System.Linq.Enumerable.SelectArrayIterator`2.ToArray()
   at System.Collections.Immutable.ImmutableExtensions.FallbackWrapper`1.get_Count()
   at System.Collections.Immutable.ImmutableList`1.CreateRange(IEnumerable`1 items)
   at System.Collections.Immutable.ImmutableList`1.AddRange(IEnumerable`1 items)
   at System.Collections.Immutable.ImmutableList.ToImmutableList[TSource](IEnumerable`1 source)
   at Libplanet.Tx.Transaction`1..ctor(RawTransaction rawTx)
   at Libplanet.Tx.Transaction`1..ctor(Dictionary dict)
   at Libplanet.Tx.Transaction`1.Deserialize(Byte[] bytes)
   at Libplanet.Blocks.Block`1.<>c.<.ctor>b__2_0(ImmutableArray`1 tx)
   at System.Linq.Enumerable.SelectArrayIterator`2.ToList()
   at Libplanet.Blocks.Block`1..ctor(RawBlock rb)
   at Libplanet.Blocks.Block`1..ctor(Dictionary dict)
   at Libplanet.Blocks.Block`1.Deserialize(Byte[] bytes)
   at Libplanet.Standalone.Hosting.LibplanetNodeService`1.LoadGenesisBlock(LibplanetNodeServiceProperties`1 properties) in /Users/moreal/github/planetarium/nekoyume-unity/Libplanet.Standalone/Hosting/LibplanetNodeService.cs:line 186
   at Libplanet.Standalone.Hosting.LibplanetNodeService`1..ctor(LibplanetNodeServiceProperties`1 properties, IBlockPolicy`1 blockPolicy, Func`5 minerLoopAction, Progress`1 preloadProgress, Boolean ignoreBootstrapFailure) in /Users/moreal/github/planetarium/nekoyume-unity/Libplanet.Standalone/Hosting/LibplanetNodeService.cs:line 59
   at NineChronicles.Standalone.NineChroniclesNodeService..ctor(LibplanetNodeServiceProperties`1 properties, Nullable`1 rpcNodeServiceProperties, Progress`1 preloadProgress, Boolean ignoreBootstrapFailure) in /Users/moreal/github/planetarium/nekoyume-unity/NineChronicles.Standalone/NineChroniclesNodeService.cs:line 85
   at NineChronicles.Standalone.StandaloneServices.RunHeadlessAsync(NineChroniclesNodeServiceProperties properties, IHostBuilder hostBuilder, StandaloneContext standaloneContext, CancellationToken cancellationToken) in /Users/moreal/github/planetarium/nekoyume-unity/NineChronicles.Standalone/StandaloneServices.cs:line 27
   at NineChronicles.Standalone.Controllers.GraphQLController.RunStandAlone(ServiceBindingProperties properties) in /Users/moreal/github/planetarium/nekoyume-unity/NineChronicles.Standalone/Controllers/GraphQLController.cs:line 73
export const standaloneProperties: StandaloneProperties = {
    AppProtocolVersion: "22/019101FEec7ed4f918D396827E1277DEda1e20D4/MEUCIQDiV8dGOGQkujYQGic8Un44ZcU0wkxVpphnl6VQrIRRcwIgM75NixNvPnrUXFM5YW+uaRqdBhS2JNpTEgd5bDT.Lpw=/ZHUxNjpXaW5kb3dzQmluYXJ5VXJsdTUyOmh0dHBzOi8vZG93bmxvYWQubmluZS1jaHJvbmljbGVzLmNvbS92MjIvV2luZG93cy56aXB1MTQ6bWFjT1NCaW5hcnlVcmx1NTM6aHR0cHM6Ly9kb3dubG9hZC5uaW5lLWNocm9uaWNsZXMuY29tL3YyMi9tYWNPUy50YXIuZ3p1OTp0aW1lc3RhbXB1MjA6MjAyMC0wNS0xMVQwNTozMDowMFpl",
    GenesisBlockPath: "https://9c-test.s3.ap-northeast-2.amazonaws.com/genesis-block-9c-beta-2",
    RpcServer: true,
    RpcListenHost: "0.0.0.0",
    RpcListenPort: 6967,
    MinimumDifficulty: 5000,
    SwarmHost: "0.0.0.0",
    SwarmPort: 6968,
    StoreType: "rocksdb",
    StorePath: ".blockstore",
    NoMiner: true,
    TrustedAppProtocolVersionSigners: ["02a5e2811a9bfa4eec274e806debd622c53702bce39a809918563a4cf34189ff85"],
}

GraphQL webpack intergration

#41 이후 graphql-code-generator가 적용되었습니다.
하지만 직접 CLI에서 호출하게 하였기 때문에 webpack에서 제공하는 hot-reload 기능을 사용하지 않습니다.
graphql-code-generator에도 hot-reload를 적용할 수 있으면 좋겠습니다.

dotansimha/graphql-code-generator#3494

맥에서 마이너 옵션을 킬 시 헤드리스가 실행 안 되는 문제

AS-IS

System.IO.IOException: Read-only file system
   at System.IO.FileSystem.CreateDirectory(String fullPath)
   at System.IO.Directory.CreateDirectory(String path)
   at Libplanet.Store.DefaultStore..ctor(String path, Boolean compress, Boolean journal, Int32 indexCacheSize, Int32 blockCacheSize, Int32 txCacheSize, Int32 statesCacheSize, Boolean flush, Boolean readOnly)
   at Libplanet.Standalone.Hosting.LibplanetNodeService`1.LoadStore(String path, String type, Int32 statesCacheSize) in /Users/suho/Workspaces/nekoyume-unity/Libplanet.Standalone/Hosting/LibplanetNodeService.cs:line 171
   at Libplanet.Standalone.Hosting.LibplanetNodeService`1..ctor(LibplanetNodeServiceProperties`1 properties, IBlockPolicy`1 blockPolicy, Func`5 minerLoopAction, Progress`1 preloadProgress, Boolean ignoreBootstrapFailure) in /Users/suho/Workspaces/nekoyume-unity/Libplanet.Standalone/Hosting/LibplanetNodeService.cs:line 63
   at NineChronicles.Standalone.NineChroniclesNodeService..ctor(LibplanetNodeServiceProperties`1 properties, Nullable`1 rpcNodeServiceProperties, Progress`1 preloadProgress, Boolean ignoreBootstrapFailure) in /Users/suho/Workspaces/nekoyume-unity/NineChronicles.Standalone/NineChroniclesNodeService.cs:line 85
   at NineChronicles.Standalone.StandaloneServices.RunHeadlessAsync(NineChroniclesNodeServiceProperties properties, IHostBuilder hostBuilder, StandaloneContext standaloneContext, CancellationToken cancellationToken) in /Users/suho/Workspaces/nekoyume-unity/NineChronicles.Standalone/StandaloneServices.cs:line 18
   at NineChronicles.Standalone.Controllers.GraphQLController.RunStandAlone(ServiceBindingProperties properties) in /Users/suho/Workspaces/nekoyume-unity/NineChronicles.Standalone/Controllers/GraphQLController.cs:line 77

스탠드얼론에서 발생하는 이슈입니다. NoMiner 옵션을 false로 하면 해당 이슈가 발생합니다.

TO-BE

고칩시다

키 삭제 구현

현재 키 삭제가 구현되어있지 않습니다. 키 삭제를 구현해야 합니다.

마이닝 옵션 on/off를 론처단에서 가능하게 하기

  • 현재는 config.json 을 수정해야 하지만, 일반 사용자가 그렇게 하기는 쉽지 않습니다.
  • 마이닝 옵션을 론처단에서 on/off 할 수 있게 만들어, 사용자가 손쉽게 마이닝 옵션을 킬 수 있게 합니다.

file-loader 사용해서 아이콘 불러오기

AS-IS

현재 빌드 상태에 따라 트레이 아이콘이 불러와지지 않는 현상 있음, file-loader 사용해서 파일을 dist로 옮기고 실행 가능하게 변경.

TO-BE

dist를 삭제하고 빌드를 처음부터 돌려도 아이콘이 살아있어야 함.

프리로딩 프로그레스 바

프리로딩 할 때 진행상황을 프로그레스 바 같은 것으로 표시해 줘야합니다.
GraphQL API 쪽에 preload subscription을 추가해야 할 것 같습니다.

게임 실행 인자 추가하기

https://github.com/planetarium/electron-launcher/blob/44eda50c172d3365019b1521a5851cff102c8655/src/views/LobbyView.tsx#L23

지금은 private-key 옵션만 넘기고 있는 데 RPC 와 관련된 인자도 추가해야합니다.

planetarium/nekoyume-unity Launcher에서는 다음과 같이 호출하고 있습니다.

string commandArguments =
    $"--rpc-client --rpc-server-host {RpcServerHost} --rpc-server-port {RpcServerPort} --private-key {PrivateKeyHex}";

https://github.com/planetarium/nekoyume-unity/blob/aaf6edd30bcd548cf3f4bc1d18569edaa8e51fb4/NineChronicles.Launcher/Launcher/LibplanetController.cs#L430

설정 파일 별도로 분리

AS-IS

현재 constant 에 있는 것들은 대부분 동적으로 사용자가 설정할 수 있어야 함에도 불구하고 빌드 타임에 상수로 집어넣고 있어 설정을 바꿀 때마다 빌드를 다시 해 줘야 함

TO-BE

설정을 launcher.json이나 config.json 같은 파일로 분리한 다음, 사용자가 동적으로 설정할 수 있게 구조 변경

NineChronicles.exe 가 중복 실행됩니다.

재연 방법

  • NineChronicles.exe(론처)를 실행한 상태에서 NineChronicles.exe를 다시 실행합니다.

기대 동작 (론처v1)

  • 유니티 플레이어(9c.exe) 를 실행할 수 있는 상태라면, 바로 9c.exe를 실행합니다.
  • 유니티 플레이러를 실행할 수 없는 상태라면 아무 동작도 하지 않습니다.

실제 동작

  • NineChronicles.exe가 2개 실행됩니다.

리팩토링

리팩토링 계기

  • 처음에 PoC로 시작한 프로젝트임.
  • 최대한 상태 관리 라이브러리를 안 쓰려고 몸비틀며 작업함. (도입 비용이 더 비쌌으므로)
  • 하지만 결국 MobX 도입하는 바람에 전역/지역 상태가 혼재함.
  • 원래는 이 타이밍에 걷어냈어야 하는데 못 걷어냄.
  • 컴포넌트가 상태 독립적이지 못하게 되었고 테스트 코드를 작성하지 못하게 됨.
  • 목업도 나왔으니 컴포넌트를 뽑아낼 수 있게 됨.

설계

  • components: 상태 독립적인 모듈들만 존재해야 함.
  • views: components 를 이용해서 상태 독립적인 화면을 만듬.
  • pages: MobX로부터 상태를 inject 받아 밑의 view로 뿌려 줌.

새로운 페이지 생성 Flow

component 만들기 -> view 만들기 -> store 만들기 -> page 만들기 -> App.tsx에 등록

e2e 테스트 추가

Windows, macOS 테스트를 CI에서 자동으로 돌리면 좋을 것 같습니다.

CI

CI에서 자동으로 빌드를 찍습니다. (#21 이슈가 해결된다면 테스트도 CI에서 돌려봅니다.)

Self-Contained 가 아니어도 실행 가능한지 확인하기

AS-IS

Standalone publish 시 Self-Contained 를 하지 않으면 이상한 .NET 버전을 사용해서 생기는 문제가 있었음. 그런데 Self-Contained 를 걷어내는 중이라 사용하기 껄끄러움.

TO-BE

안 써도 괜찮은지 확인하고, 안 쓸 수 있으면 걷어내기.

로거 등록하기

AS-IS

현재 로거가 없어서 로깅하는 데 애로사항이 많음

TO-BE

노드 로깅은 몰라도 일렉트론에서 처리할 수 있는 로그는 전부 파일로 떨어트릴 수 있게 한다

스냅샷 다운로드 위치 지정

AS-IS

현재 블록체인 스냅샷 다운로드 위치와 압축 푸는 위치가 실제 사용하는 블록체인 위치랑 다름

TO-BE

제대로 된 위치에 다운받고, 압축 푼 다음 압축파일은 삭제

멀티플랫폼 지원

AS-IS

현재 PATH나 개발 환경 자체가 MacOS에 맞춰져 있음.

TO-BE

process.platform 이용해서 분기에 따라 각 운영체제의 룩앤필을 통일화

키 존재 여부에 따라 인덱스 페이지 도입부 달라지게

#87 관련 이슈입니다.

현재는 키가 존재하건 존재하지 않건 로그인 페이지부터 보여주지만, 키가 존재한다면 로그인 페이지가 아니라 계정 생성(활성화) 페이지가 나와야 합니다.

지금은 아직 활성화 키 기능이 구현되어 있지 않으므로, 키 생성 페이지가 나오게 하면 좋겠습니다.

패키징 후 lib으로 된 executable 스탠드얼론 실행 안 됨

AS-IS

lib 형태로 빌드해 나온 standalone을 일렉트론 패키징할 때 dist에 넣고 돌려도 실행이 안 됨, 아마 dotnet 명령어로 실행시키는 부분에서 문제가 생기는 것으로 보임.

TO-BE

빌드해서 나온 결과물이 단독 실행가능한 파일로 나오게 하고 그걸 실행하게 코드 변경

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.