exch-bms2 / beatoraja

Cross-platform rhythm game based on Java and libGDX.
GNU General Public License v3.0
642 stars 148 forks source link

Add basic camera support #731

Open mlaux opened 1 year ago

mlaux commented 1 year ago

This PR adds basic webcam support. This is useful to show controllers/keyboards when streaming from a different machine than beatoraja is running on, or an arcade cabinet. When enabled, the camera will render in the skin's BGA area - the camera image respects the BGA expansion setting.

I used this library with this driver to implement support.

I've only tested this on Mac, so I'm definitely interested in some Windows test results and general feedback on my approach. Ideally there would be a separate SkinObject for the camera, but having it share the BGA's area seems reasonable too - I didn't want to mess with the design of the skin.

Screen Shot 2023-02-09 at 12 14 46 AM

Screen Shot 2023-02-09 at 12 20 38 AM

Getaji commented 1 year ago

This is a nice new feature, the drawback is that it cannot be displayed at the same time as the BGA, but it might be a good idea to figure out how to handle this separately after this feature is implemented. However, when we checked the operation on Windows 10, several problems occurred and eventually we could not confirm proper operation.

[atomic-processor-1] ERROR com.github.eduramiba.webcamcapture.drivers.capturemanager.CaptureManagerFrameGrabberSession - At least 6553600 bytes needed but passed buffer has only 2764800 remaining size

The camera I am using is an app called DroidCam that uses the Android camera as a PC webcam and the camera resolution is 1280x720. I would like to get feedback from other Windows users as this may be a problem specific to my environment.

Translated with www.DeepL.com/Translator


原文:

これは良い新機能です。BGAと同時に表示できないのが難点ですが、この機能を実装した後で別途で対応方法を考えるのがいいかもしれません。しかし、Windows10で動作確認したところ幾つかの問題が発生し、最終的には正常な動作を確認できませんでした。

[atomic-processor-1] ERROR com.github.eduramiba.webcamcapture.drivers.capturemanager.CaptureManagerFrameGrabberSession - At least 6553600 bytes needed but passed buffer has only 2764800 remaining size

使用しているカメラはAndroidのカメラをPCのWebcamとして利用するDroidCamというアプリで、カメラの解像度は1280x720です。これが私の環境に特有の問題かもしれないので、他のWindows利用者のフィードバックも頂きたいところです。

ich59669 commented 1 year ago

What is the advantage of incorporating a webcam into beatoraja? If you are looking for a webcam to display the view of the user's hand in real-time video streaming, it should be sufficient to use the functionality of the streaming software. If you want the camera to be displayed on the skin, you can reserve that area on the skin and composite the camera image on the distribution software.

Assume that the webcam is displaying the hand you are playing with. Players normally do not see their hand as displayed by the webcam. If they do, it would be when a rhythm game beginner wants to check his/her hand, or when a player wants to review his/her play later. If it is the former, I think it makes sense to implement it, but it would only be effective in the very beginning of the game. (I am a 24-key newbie, and at that time I was playing by compositing my own hand and beatoraja with OBS.) If the latter, I believe that the current situation should be handled by the delivery software.

If we were to implement a webcam feature, in addition to

This would allow users to easily create videos without having to go through distribution software, We believe that the webcam functionality will be very useful. Translated with www.DeepL.com/Translator (free version)

原文: そもそも、beatorajaにウェブカメラ機能を組み込む利点とは、なんなのでしょうか。 もしあなたがリアルタイム動画配信での手元等の表示機能として期待しているのならば、それは配信ソフト側の機能を用いれば事足りるはずです。 カメラを表示する領域がスキン上でほしいならば、スキン上にその領域だけを確保し、カメラの映像は配信ソフト側で合成すれば良いです。

ウェブカメラが自分のプレイ中の手元を表示していると仮定します。 プレイヤーは普通、ウェブカメラが表示している自分の手元を見ることはありません。 もし見るとするならそれは、リズムゲーム初心者が自分の手元を確認するときか、またはプレイヤーが後から自分のプレイを見返したいとき、だと考えます。 前者なら本体側に実装する意味はあると思いますが、それはプレイのごく初期のみでしか有効でないでしょう。 (私は24keyの初心者であり、そのときは自分の手元とbeatorajaをOBSで合成してプレイしていました。) 後者ならば、現状は配信ソフト側で対応すればよいと考えています。

もしウェブカメラ機能を実装するなら、それに加えて

という機能を実装することで、配信ソフトを経由することなくユーザーが気軽にプレイ動画を作成できるようになり、 ウェブカメラ機能がとても有用になると考えます。