Skip to content

Commit

Permalink
add book
Browse files Browse the repository at this point in the history
  • Loading branch information
syui committed Feb 8, 2025
1 parent bfc9b78 commit abdc9c7
Show file tree
Hide file tree
Showing 47 changed files with 985 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: github pages

on:
push:
branches:
- main

jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 23

- name: Build
env:
TZ: "Asia/Tokyo"
run: |
cd ./book
npm i
npx honkit build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book/_book
publish_branch: gh-pages
user_name: 'ai[bot]'
user_email: '138105980+yui-syui-ai[bot]@users.noreply.github.com'
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@
/scpt/*.jpeg
/scpt/*.png
config
book/_book
book/node_modules
book/*/*.ini
book/*.ini
1 change: 1 addition & 0 deletions book/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ue-book.syui.ai
5 changes: 5 additions & 0 deletions book/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
![](cover.jpg)

# Unreal Engine 5 Guide Book

<a href="/book.pdf" target=”_blank”>download</a> | <a href="https://ue-book.syui.ai" target="_blank">web</a>
35 changes: 35 additions & 0 deletions book/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Summary

* [Unreal Engine 5 Guild Book](README.md)
* [default](default/README.md)
* [asset/plugin](default/00_asset.md)
* [start](default/01_start.md)
* [install](default/02_install.md)
* [tips](default/03_tips.md)
* [game animation sample](gas/README.md)
* [キャラクターを追加する](gas/01_character.md)
* [飛びつける高さを増やす](gas/02_jump.md)
* [キャラクターの見た目を変える](gas/03_vrm.md)
* [モーションキャプチャで動かす](gas/04_vmc.md)
* [揺れものを設定する](gas/05_kawaii.md)
* [カメラワークの設定する](gas/06_camera.md)
* [アニメーションを作成する](gas/07_anim.md)
* [niagaraでダメージを出す](gas/08_niagara.md)
* [椅子に座る](gas/09_chair.md)
* [control rig sample](crs/README.md)
* [CRでキャラクターを動かす](crs/01_character.md)
* [ボスを作る](crs/02_boss.md)
* [city sample](city/README.md)
* [惑星形式のmapを作る](city/01_remove.md)
* [橋を作る](city/02_bridge.md)
* [建造物を作る](city/03_house.md)
* [json blueprint utilities](json/README.md)
* [apiから情報を取得する](json/01_varest.md)
* [pixel streaming](pixel/README.md)
* [基本事項](pixel/01_server.md)
* [有料アセット](plan/README.md)
* [superhero fligth animations](plan/01_flying.md)
* [ultra dynamic sky](plan/02_uds.md)
* [ocean waves](plan/03_ocean.md)
* [nice interaction system](plan/04_item.md)
* [end](end/README.md)
43 changes: 43 additions & 0 deletions book/city/01_remove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 惑星形式のmapを作る

game engineのmapは基本的に平面で作られています。どこまで行っても地平線が広がっているだけで、そこから抜け出すことはできません。月や太陽があっても背面の絵を動かしているだけです。

これを現実に合わせた形を独自に作っています。これを`planet system`と呼びます。

地球があって、上に飛ぶと大気圏があり、大気圏を抜けると宇宙があり、月があり、太陽があるという形にすることを目指します。全てはつながっていて、そこに行くことができます。

## 海の境界を消す

海には境界があってそれが惑星システム(planet system)を構築する際に邪魔になるので消します。

## ocean wavesで惑星の海を作る

[ocean waves](https://www.unrealengine.com/marketplace/ja/product/ocean-waves)

必要なものを`/Content/OceanWaves/Levels/EarthSizedOceanPlanet`からcopyして持ってきましょう。

- `BP_EarthSizedSphericalMesh`
- `BP_EarthSizedOcean`
- `WaterVolume`

`BP_EarthSizedSphericalMesh``transform-location-z:-63600000`にします。`Sphere Radius:63600000`にします。`SphereEdge Length:16000000`になるはずです。

次に海上の影問題を修正するため`Material Overrides`, `Material Outer/Inner`をすべて変更します。私は`/Vefects/Water/VFX/WaterMaterials`を使用しました。

次に`BP_EarthSizedOcean``Volume Maaterials``WaterVolume`をセットします。`Above/Underwater``/Vefects/Water/VFX/UnderWater`に変更します。`height:0`にします。これは海に入って出たときに海中を適用する高さを設定します。

## ultra dynamic skyで天候と惑星を作る

[ultra dynamic sky](https://docs.google.com/document/d/1xAr0Hd3mY7Mp0g0waKLUvJaddUPaVxEeRoEEFXctCE0/)

1. `/Content/UltraDynamicSky/Blueprints/Ultra_Dynamic_Sky`を開きます。
2. そこに地球と月と太陽のBPを入れます。各自が用意してください。なお、地球は`SkyAtmosphere`の下に置いてください。
> 名前は 地球(BP_Earth), 月(BP_Moon), 太陽(BP_Sun) としておきます。
3. `BP_Earth`は詳細から`transform-location-z:-636000000`, `transform-scale:6360000`にします。
4. `Sky_Sphere_Mesh``transform-scale:50000`にします。
5. 関数の`Current Star Color(pure)`にて高度を取得できるため、各componentの表示と非表示(visibility)を切り替えます。

<iframe src="https://blueprintue.com/render/k3xgicx_/1" scrolling="no" allowfullscreen style="width:100%;height:400px"></iframe>

- `BP_Earth`: `transform-location-z:-636000000`, `transform-scale:6360000`
- `Sky_Sphere_Mesh`: `transform-scale:50000`
9 changes: 9 additions & 0 deletions book/city/02_bridge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# 橋を作る

[automotive bridge scene](https://www.fab.com/ja/listings/a472df9d-9179-4743-8d41-335f9ef55546)

1. `/Content/AutomotiveBridgeScene/Blueprints/BP_CurvedBridge`, `BP_StraightBridge`を開きます。これをつなぎ合わせていくことで橋を作ります。
2. Lampが動きませんので、選択した上で`Static Mesh``city sample`に入っている`/Content/Prop/Kit_StreetLamp_C/Mesh/streetLampC`と入れ替えます。
3. 私はベンチのところを`traversable(トラバーサブル)`するためにGASの`/Content/LevelPrototyping/LevelBlock_Traversable`を入れています。Base Materialを`/Content/Characters/Echo/Materials/M_hide`にして透明にします。

![](../img/0003.png)
9 changes: 9 additions & 0 deletions book/city/03_house.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# 建造物を作る

1. [twinmotion](https://www.twinmotion.com/)をinstallして、建造物を作ります。template(テンプレート)を編集しても構いません。
2. できたらexportしてueの$projectを選択します。`$project/${name}_Assets`が作成されます。`datasmith`の置き場所は変更しても構いません。
3. $projectを開いて、pluginの`datasmith`を入れます。そして、`$name (Datasmith シーン)`のファイルをmapにD&Dします。
4. すり抜け問題を解消するには作成された`mesh`を全選択して、右クリックで`アセットアクション -> プロパティマトリクスで選択内容を... -> collision complexity(use complex collision as simple...)`を選択します。
> 私の場合はmeshが`/Content/Twinmotion/room/Geometries/`にあります。
<iframe width="100%" height="415" src="https://www.youtube.com/embed/BsLOlAr-wBY?si=jahPUVD8YMMfefvm&start=152&end=160&mute=1&rel=0&showinfo=0&controls=0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
37 changes: 37 additions & 0 deletions book/city/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# city sample

[city sample](https://www.unrealengine.com/marketplace/ja/product/city-sample)

ニューヨーク(NY)をモデルに都市が作られています。人と自動車が動いています。自動車は乗ることや破壊することができます。

## AutomatedPerfTesting

`AutomatedPerfTesting`は5.5で追加されたpluginです。

> Experimental release of Automated Perf Testing Plugin v0.1, providing Gauntlet Test Controllers, UAT Test Nodes, and BuildGraph macros for adding common automated performance tests to a project’s automated build and test.
- https://dev.epicgames.com/documentation/ja-jp/unreal-engine/unreal-engine-5.5-release-notes
- https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Plugins/AutomatedPerfTesting

そのうち解消されると思いますが、現在(2024-11-18)、city sampleはbuildできません。`Engine/Plugins/Performance/AutomatedPerfTestingにAutomatedPerfTestConfig.cs`, `AutomatedPerfTestNode.cs`が含まれていないため`${project}/Build/Script/CitySample.Automation.csproj`に記述されているcompileが通らないのです。

```html
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="CitySample.Automation.csproj.props" Condition="Exists('CitySample.Automation.csproj.props')"/>

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Include="$(EngineDir)\Plugins\Performance\AutomatedPerfTesting\Build\Scripts\AutomatedPerfTestConfig.cs" />
<Compile Include="$(EngineDir)\Plugins\Performance\AutomatedPerfTesting\Build\Scripts\AutomatedPerfTestNode.cs" />
</ItemGroup>

</Project>
```

これはgithubにあるsrcから持ってくるしかありません。アクセスするにはorgに参加します。

https://github.com/EpicGames/UnrealEngine/tree/release/Engine/Plugins/Performance/AutomatedPerfTesting/Build/Scripts

Binary file added book/cover.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/cover_b.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions book/crs/01_character.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# CRでキャラクターを動かす

`control rig``CR_xxx`というファイル名がつけられています。

## dragon

例えば、ABPで`head_global_ctrl`の値を更新します。

<iframe src="https://blueprintue.com/render/o3glwh72/1" scrolling="no" allowfullscreen style="width:100%;height:400px"></iframe>

## mech

1. `/Content/ControlRig/Characters/Mech/Meshes/SKM_Mech`からABP, BP, SM(StaticMesh)を作成します。
2. ABPから`Control Rig``cannon_ctrl`などを動かせます。

```sh
- /Content/ControlRig/Characters/Mech/BP_Mech
- /Content/ControlRig/Characters/Mech/ABP_Mech
- /Content/ControlRig/Characters/Mech/Meshes/SM_Mech
```

91 changes: 91 additions & 0 deletions book/crs/02_boss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# ボスを作る

敵(enemy)やボス(boss)には必要なものが多いです。動きや攻撃パターン、エフェクト、ステータスやドロップアイテム、ゲージ表示、BGMなどが必要になります。場合によっては演出も必要です。

<iframe width="100%" height="415" src="https://www.youtube.com/embed/BsLOlAr-wBY?si=jahPUVD8YMMfefvm&amp;start=20&end=50&amp;mute=1&rel=0&showinfo=0&controls=0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

bossは`/Content/ControlRig/Characters/Mech`を元に作ります。

## 注意

ここからはbattle systemのassetを購入したほうがいいかもしれません。できれば評価が高くsale中のものを選びましょう。ほとんどこれ一つでゲームが作れてしまうので、多くの開発者はこのジャンルのassetを改造してゲームを作っています。スタイリッシュアクションの動きを見るとわかります。

https://www.fab.com/category/game-template/rpg

## 動きを作る

まずABPを作成し、基本的なAnimGraphを作成します。

projectにはsampleのABPがあるはずですからAnimGraphに`idle`, `jump`, `run`などが揃っているをcopyします。

[![](../img/0004.png)](../img/0004.png)

ここでは`AnimGraph -> Locomotion -> Idle`を編集します。

動きはABPの`Look At`が使えます。boneを指定するとPlayerに追従します。

`[Mech_Idle] --> [Look At](Bone to Modify:cannon_01) --> Output Animation Pose`

[![](../img/0006.png)](../img/0006.png)

## 攻撃を作る

私は最初に購入したassetの[space frontier stations & ships](https://docs.google.com/document/d/1p5MY13cpTlVtqP7sCQpAoE_k5VHklmndZ4cHeBy105Y/edit?tab=t.0#heading=h.nx19nrsdk37u)を使いました。なお、購入はおすすめしません。長いので以降は`space station`とします。

ここからはassetの解説になります。しかし、基本的な考え方については変わりません。まずは考え方を紹介します。

1. ターゲットをロック
2. ダメージ処理

ターゲット(target)をロック(lock)できるようなシステムは大抵、攻撃頻度やダメージ、コリジョンなど基本設定ができるようになっています。`epic games`が提供するassetや無料のassetでも同じです。そういった物を見つけてbossのBPに組み込みます。

ただし、ダメージ処理、例えば、HP管理や倒された時の処理は自分で書く必要があるかもしれません。

### 最初に触ったassetが影響を与える

ここからは少し昔の話をします。基本的には読み飛ばしてください。

私はueで最初に触り始めたのがこのasset(space station)でした。当時は何もわからずに手探りで自分のモデルを表示して遊んでいました。宇宙空間に自分のモデルを表示したときは本当に嬉しくて感動しました。

当時は`superhero flight animations`という空を飛ぶためassetも購入して同時に使っていましたが、今でもその影響は残っています。

その人のゲーム作りは最初に触ったassetが強く影響を与えるのだと思います。これはgame engineも同じです。

### space stationの基本構造

1. `/Content/SpaceStation/Blueprints/Weapons`で各武器のタイプを選べます。ここでは`BP_TurretGatling`を開きます。
2. `/Content/SpaceStation/Blueprints/Weapons/BP_TurretGatling(Self)`の詳細から`Weapon -> Shooting Delay:1`にして`Turret -> Turret Aiming Speed:150`にします。これは発射速度とターゲットに合わせる速度の設定です。
3. `/Content/SpaceStation/Blueprints/Weapons/Parent/DT_WeaponTypes`を開きます。ここで弾丸の音(sound)やエフェクト(effect)を設定します。
4. 最後に`/Content/Blueprints/CBP_SandboxCharacter(Self)`の詳細で`actor(アクタ) -> Tags[0] -> Allow Shooting`, `Tags[1] -> ShootingTarget`を追加します。これでPlayerがターゲットにロックされるようになります。
5. あとは`/Content/SpaceStation/Blueprints/Weapons/BP_TurretGatling`をmapに置いてください。

### ダメージ処理

damage(ダメージ)の処理を書きます。

`/Content/Blueprints/CBP_SandboxCharacter``Event Any Damage`を追加します。これでdamageを受けますが、hpを用意してそれが0になったときゲームオーバー(gameover)する処理を書いたりします。

<iframe src="https://blueprintue.com/render/xbwy4u36/1" scrolling="no" allowfullscreen style="width:100%;height:400px"></iframe>

これはGame Ability System(GAS)を使うと便利です。

https://dev.epicgames.com/documentation/ja-jp/unreal-engine/gameplay-ability-system-for-unreal-engine

## HPゲージの表示

`widget``ProgressBar`を作ります。まず`BP_Mech`にbox collisionを入れて、そこに入ると`boss active`になります。`true`ならwidgetを表示する仕組みです。

ProgressBarは`0.0 -> 1.0`なので注意してください。`HP_Current`から`HP_Max`を割り算します。

<iframe src="https://blueprintue.com/render/xbwy4u36/2" scrolling="no" allowfullscreen style="width:100%;height:400px"></iframe>

## 撃破処理

bossを撃破するまでの処理を書きます。

damageを受けて0になると消滅し、ドロップアイテムを落とします。消滅時はniagaraでeffectを再生します。damageを受けたときも同じです。

ドロップアイテムは`nice interaction system`というassetを使用しています。これは`E`を押すとアイテム(item)が取得できるものです。

<iframe src="https://blueprintue.com/render/xbwy4u36/3" scrolling="no" allowfullscreen style="width:100%;height:400px"></iframe>

6 changes: 6 additions & 0 deletions book/crs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# control rig sample

[control rig sample](https://www.fab.com/ja/listings/2ce3fe44-9ee6-4fa7-99fc-b9424a402386)

`control rig sample`では人間以外のcharacterを動かすことができます。

38 changes: 38 additions & 0 deletions book/default/00_asset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# asset/plugin

現在使用しているplugin(プラグイン)やasset(アセット)の`version(バージョン)`を記述します。

ゲームは無料のassetだけでも作れます。しかし、時間やクオリティを向上させたい場合は有料のassetを使いましょう。

本書の一部では有料assetの使い方を解説します。[sale](https://www.fab.com/ja/channels/unreal-engine?ui_filter_price=1&ui_filter_is_discounted=1&is_discounted=1)中のものを探しましょう。

## asset

|name|latest|body|
|---|---|---|
|[game animation sample](https://dev.epicgames.com/documentation/en-us/unreal-engine/game-animation-sample-project-in-unreal-engine)|5.5|キャラクターをパルクールアクション|
|[city sample](https://www.unrealengine.com/marketplace/ja/product/city-sample)|5.5|大規模な都市を構築|
|[control rig sample](https://www.fab.com/ja/listings/2ce3fe44-9ee6-4fa7-99fc-b9424a402386)|5.5|人間以外のキャラクター|

## plugin

|name|latest|body|
|---|---|---|
|[pixel streaming](https://github.com/EpicGamesExt/PixelStreamingInfrastructure/blob/master/Docs/pixel-streaming-2-migration-guide.md)|2|ゲームをserverにdeployしてwebからプレイ|
|[twinmotion](https://www.twinmotion.com/ja)|20250101p|建造物をインポート|
|[vrm4u](https://github.com/ruyo/VRM4U/releases/tag/20250206)|20250206|vrmモデルを動かす|
|[kawaiiphysics](https://github.com/pafuhana1213/KawaiiPhysics)|20241201|揺れものを設定|
|[varest](https://github.com/ufna/VaRest)|20240828|curlのようなもの。supportが終了しているのでbuildが必要|
|[tatools](https://www.fab.com/ja/listings/a5d3b60d-b886-4564-bf6d-15d46a8d27fe)|20241206|animを作る|

## 有料

[こちら](/plan/README.md)

## link

こちらで最新情報を取り扱っています。

- https://git.syui.ai/ai/ue/
- https://blueprintue.com/profile/ai/
- https://dev.epicgames.com/community/profile/organization/gdkg/ai/
Loading

0 comments on commit abdc9c7

Please sign in to comment.