macOS から Github にアクセス

下記コマンドを入力して SSH 接続の Key を生成する。

ssh-keygen -t rsa

途中、保存先ディレクトリや、パスフレーズを聞かれるので必要があれば適宜設定する。
何も入力せずに Enter で先に進める事も可能。

/Users/name/.ssh/ に鍵が出来るので、id_rsa.pub を cat コマンドで開いてコピーする。
コピーした鍵を Github の Settings -> SSH and GPG keys に登録する。

後は、clone したいリポジトリssh パスを取得して、git clone すれば取得できる。

C++ pixelのbilinear処理

#include <iostream>
#include <vector>

// ピクセルを表す構造体(RGB)
struct Pixel
{
    unsigned char r;
    unsigned char g;
    unsigned char b;
};

// バイリニア補間関数
Pixel BilinearInterpolate(  const Pixel& top_left, const Pixel& top_right, const Pixel& bottom_left, const Pixel& bottom_right, 
                            double x_ratio, double y_ratio)
{

    Pixel result;

    result.r = (unsigned char)(
        top_left.r * (1 - x_ratio) * (1 - y_ratio) +
        top_right.r * x_ratio * (1 - y_ratio) +
        bottom_left.r * y_ratio * (1 - x_ratio) +
        bottom_right.r * x_ratio * y_ratio);

    result.g = (unsigned char)(
        top_left.g * (1 - x_ratio) * (1 - y_ratio) +
        top_right.g * x_ratio * (1 - y_ratio) +
        bottom_left.g * y_ratio * (1 - x_ratio) +
        bottom_right.g * x_ratio * y_ratio);

    result.b = (unsigned char)(
        top_left.b * (1 - x_ratio) * (1 - y_ratio) +
        top_right.b * x_ratio * (1 - y_ratio) +
        bottom_left.b * y_ratio * (1 - x_ratio) +
        bottom_right.b * x_ratio * y_ratio);

    return result;
}

// メイン関数
int main() {


    // 仮定:srcImageは512x512、dstImageは1024x1024の大きさ
    const int srcWidth = 512, srcHeight = 512;
    const int dstWidth = 1024, dstHeight = 1024;

    std::vector<std::vector<Pixel>> srcImage(srcHeight, std::vector<Pixel>(srcWidth));
    std::vector<std::vector<Pixel>> dstImage(dstHeight, std::vector<Pixel>(dstWidth));

    // ここで、srcImageに画像データを読み込む

    // リサイズ処理
    for (int y = 0; y < dstHeight; ++y) {
        for (int x = 0; x < dstWidth; ++x) {


            double gx = ((double)x) / dstWidth * (srcWidth - 1);
            double gy = ((double)y) / dstHeight * (srcHeight - 1);

            int gxi = (int)gx;
            int gyi = (int)gy;

            Pixel top_left      = srcImage[gyi][gxi];
            Pixel top_right     = srcImage[gyi][gxi + 1];
            Pixel bottom_left   = srcImage[gyi + 1][gxi];
            Pixel bottom_right  = srcImage[gyi + 1][gxi + 1];

            double x_ratio = gx - gxi;
            double y_ratio = gy - gyi;

            dstImage[y][x] = BilinearInterpolate(top_left, top_right, bottom_left, bottom_right, x_ratio, y_ratio);
        }
    }

    // ここで、dstImageを画像ファイルに保存する

    return 0;
}

C++ condition_variable サンプルコード

#include <iostream>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <chrono>

std::mutex mtx;
std::condition_variable cv;
bool ready = false;

void print_id(int id) {

    std::unique_lock<std::mutex> lck(mtx);

    while (!ready) {
        cv.wait(lck);
    }

    // スレッドが再開された後の処理
    std::cout << "Thread " << id << '\n';
}

void go() {

    std::unique_lock<std::mutex> lck(mtx);

    ready = true;

    cv.notify_all(); // 全てのスレッドに通知
}

int main() {

    std::thread threads[10];

    // スレッドの起動
    for (int i = 0; i < 10; ++i) {
        threads[i] = std::thread(print_id, i);
    }

    std::this_thread::sleep_for(std::chrono::milliseconds(100));

    // 全スレッドの再開
    go();

    // 全スレッドの終了を待機
    for (auto& th : threads) {
        th.join();
    }

    return 0;
}

興味があるゲーム会社のまとめ

カプコン

https://www.youtube.com/@CAPCOM_RandD/videos

https://www.docswell.com/user/CAPCOM_RandD

RE Engine。国内最高峰。自社エンジンが魅力。

バンダイナムコゲームス

2022年ごろから、自社エンジンの人材募集を行っている。

https://automaton-media.com/articles/hiring/20220203-190654/

https://www.bandainamcostudios.com/recruit/career/interview/13108

自社エンジンも進めているが、使用エンジンとしては Unreal Engine がまだ多そう。

コナミ

https://mspoweruser.com/ja/konami-abandons-fox-engine-pes-2022-unreal-engine/

コナミは FOX Engine から Unreal Engine への乗り換えを行っている。

セガ

https://cgworld.jp/article/202307-uefest-sega.html

ドラゴンエンジンという自社エンジンから Unreal Engine への乗り換え。

スクウェアエニックス

Unreal Engine と自社エンジン

コーエー

KATANA エンジン。

アトラス(ペルソナシリーズ)

https://gamemakers.jp/article/2022_06_16_7692/

Unreal Engine が社内標準のよう

KOJIMA PRODUCTIONS

  • DEATH STRANDING
  • DEATH STRANDING 2
  • OD(Xbox

DECIMA Engine。元々 PS プラットフォーム向けのエンジンだったが、OD の開発も DECIMA を使うのだとしたら DirectX などにも対応するのだろうか。

OD は「Xboxクラウドゲーミング技術」を使うというニュースがあるが、なぜあえてクラウドなのだろうか。

フロムソフトウェア

内製エンジン。

トライエース

https://cgworld.jp/interview/202012-triace.html

Aska Engine は健在。

サイバーコネクトツー

Unreal Engine が社内標準のよう。

プラチナゲームズ

https://www.famitsu.com/news/202003/13194626.html

プラチナエンジンの開発。中途採用ページにもエンジン開発者の募集が乗っているので、引き続き自社開発に取り組んでいる。

シリコンスタジオ

  • Yebis
  • Mizuchi
  • Orochi

ツール。ミドルウェア

Windows C++実行速度の計測

#include <windows.h>
#include <iostream>

void simulateExpensiveOperation() {
    // 時間のかかる操作をシミュレートします。
    // 例えば、1秒間スリープするなど。
    Sleep(1000); // 1000ミリ秒 = 1秒
}

int main() {
    LARGE_INTEGER frequency; // カウンターの周波数
    LARGE_INTEGER start;     // 開始時間
    LARGE_INTEGER end;       // 終了時間

    // カウンターの周波数を取得
    if (!QueryPerformanceFrequency(&frequency)) {
        std::cerr << "High-resolution counter not supported." << std::endl;
        return 1;
    }

    // 開始時間を取得
    QueryPerformanceCounter(&start);

    // 計測したい操作を実行
    simulateExpensiveOperation();

    // 終了時間を取得
    QueryPerformanceCounter(&end);

    // 経過時間を計算(秒単位)
    double elapsedTime = static_cast<double>(end.QuadPart - start.QuadPart) / frequency.QuadPart;

    std::cout << "Operation took " << elapsedTime << " seconds.\n";

    return 0;
}

Apple Watch 向けのアプリをビルド

XcodeApple Watch 向けのアプリをビルドしようとしてハマった。

Developer モードへの変更

Xcode でビルドしたアプリをインストールするためには、開発者モードを有効にしないといけない。ネットの情報を元に、ペアリング済みの iPhone を USB で Mac 本体と接続。iPhone, Apple Watch を全て同じ wifi に接続したところ「設定」→「プライバシーとセキュリティー」の一番下にデベロッパーモードの項目が出現した。

MacWifi に接続する必要は無かった気がする。iPhoneWatch が同じ wif に接続されていればうまくいきそう。

腕に装着しておいた方が良い?

当初、充電器に繋いでいたところ、Disconnected になってしまうことが多かった。パスコードで解除しても Apple Watch が腕を検出できないと自動でロックがかかる仕様(設定で変更できる?)みたいで、充電器に接続している状態だと接続が不安定になっていた。

Copying shared cache symbols from Apple Watch が終わらん

20分ぐらい待って、85%ぐらいまで進んだけど Disconnected になって 0% からやり直し。こちらの Wifi の問題なのか、接続がうまくいかないことがある。

アプリは転送できていた 

Xcode でビルドしたアプリは転送はできていた。よく分からん。

転送に失敗した時

Mac に USB で iPhone で接続し、iPhoneWatch が同じ wifi に繋がっていれば、Xcode からの転送が上手くいく可能性が高かった。失敗したときは恐らく wif  への接続が不安定。