16 tips
syui edited this page 2024-09-19 08:38:50 +00:00

tipsをまとめます。ue, asset, pluginは常にlatestを使用しています。

character

BP(Blueprint)

5.4からはCBP_Player_$nameで作成します。5.3まではBP_Player_$nameでした。

  • https://ruyo.github.io/VRM4U/

  • 髪 : ABP_Post_${name}VrmSpringBone

  • 装飾品 : 揺らすにはABP_itemKawaiiPhysicsを使います。装飾品はblenderで作ります。

  • 法線 : All/Plugins/VRM4U/Util/Actor/PostShadow/BP_PoseCopyToonで作成し、vrmを読み込んでcustomを選択する

motion

ABP(Anim Blueprint)

今後はgame animation sampleに基づいて作成していくのが基本になると思います。

ABP_Player_$nameで作ります。5.3まではAnimGraphLocomotionなどのstateを使って作成していましたが、5.4ではstateはほとんど使用しなくなります。今までのABPを使いたい場合は統合する必要が出てきます。

BP_PlayerでABPを切り替え、ABPにはstateを追加していきます。

必要なmotionはadobeのmixamoを使えます。またbandaiのBandai-Namco-Research-Motiondatasetもあります。

vmcを使うにはvseeface + webcam motion captureを使います。

world

  • 空 : worldの空はsky atmosphereで球体(地球の直径6360)にします。ultra skyなどにはもとから入っています。
  • 雲 : ultra skyなどを使用して雲を作ります。volumetric cloudです。ultra skyはfogで地平線を作るのでそれを無効にします。
  • 海 : ocean wavesを使用します。球体の中心に置きます。

これで惑星形式のworldを作れます。

city

twimotionで作ります。

meshにcollisionが設定されていないのですり抜けます。これを解消するにはmeshを全選択して、右クリックでアセットアクション -> プロパティマトリクスで選択内容を... -> collision complexity(use complex collision as simple...)を選択します。

web

webからゲームを操作できるようにするには、pixel streamingを使います。ゲームは世界的に公開され、アクセスした人はゲームをプレイできます。cloudflare tunnelを使うと自宅サーバーでゲームを動かせるでしょう。

# https://github.com/EpicGamesExt/PixelStreamingInfrastructure
$ cd ~/github/PixelStreamingInfrastructure/Matchmaker/platform_scripts/cmd/
$ ./setup.bat
$ ./run.bat
# https://dev.epicgames.com/documentation/ja-jp/unreal-engine/unreal-engine-pixel-streaming-reference
# --HttpPort 90
# --MatchmakerPort 9999

# Signaling and Web サーバーに対する次のコンフィギュレーション パラメータを設定します。
$ cd ~/github/PixelStreamingInfrastructure/SignallingWebServer/platform_scripts/cmd/
$ ./setup.bat
$ ./Start_SignallingServer_nopublic.ps1 --UseMatchmaker true --MatchmakerAddress 127.0.0.1 --MatchmakerPort 9999 --PublicIp localhost --HttpPort 80

api

varestを使うのが一般的です。ただし、patchがなかったりと色々あるので、http-websocket-helperがおすすめです。jsonはjsonparserがオススメです。

使い方はblueprintueで検索してください。

npc

NPCなどの会話や操作は音声とAIを使用します。

$ curl https://api.openai.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [{"role": "user", "content": "Your question here"}],
    "temperature": 0.7
  }'
$ curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/VOICE_ID" \
     -H "xi-api-key: YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{
           "text": "Hello world!",
           "model_id": "eleven_monolingual_v1",
           "voice_settings": {
             "stability": 0.5,
             "similarity_boost": 0.5
           }
         }' \
     --output output.mp3

login

account(login)はbluesky-social/atprotoを使用します。

# session
host=bsky.social
handle=syui.bsky.social
pass=xxx
url=https://$host/xrpc/com.atproto.server.createSession
curl -sL -X POST -H "Content-Type: application/json" -d "{\"identifier\":\"$handle\",\"password\":\"$pass\"}" $url

# refresh
j=`!!`
token=`echo $j|jq -r .accessJwt`
refresh=`echo $j|jq -r .refreshJwt`
url=https://$host/xrpc/com.atproto.server.refreshSession
curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $refresh" $url

start(title)画面で入力させ、configに入れてWPで表示するとよいでしょう。