serafim / opengl-demo
Simple PHP Game Demo (using OpenGL/DX/Vulkan over SDL)
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 165
Watchers: 8
Forks: 12
Open Issues: 1
pkg:composer/serafim/opengl-demo
Requires
- php-64bit: ^8.1
- ext-ffi: *
- bic-engine/audio: ^1.0
- bic-engine/dispatcher: ^1.0
- bic-engine/foundation: ^1.0
- bic-engine/front-controller: ^1.0
- bic-engine/lib-bass: ^1.0
- bic-engine/lib-sdl2: ^1.0
- bic-engine/ui: ^1.0
- bic-engine/ui-sdl2: ^1.0
- bic-engine/var-dumper: ^1.0
- monolog/monolog: ^3.1
- symfony/cache: ^5.4|^6.0
- symfony/process: ^5.4|^6.0
- vlucas/phpdotenv: ^5.4
Requires (Dev)
- cache/filesystem-adapter: ^1.2
- jetbrains/phpstorm-attributes: ^1.0
- nunomaduro/collision: ^6.0
- phpunit/phpunit: ^9.5
- symfony/var-dumper: ^5.4|^6.1
- vimeo/psalm: ^4.24
This package is auto-updated.
Last update: 2025-11-08 19:15:49 UTC
README
Please note that this is only a demo and may contain non-optimal, crazy and completely unbelievable programming techniques (Well, besides the fact that this code is written by a PHP 🐒 developer who has never encountered game development).
If your psyche was injured please consult a doctor.
Peace <3
Oh yes, according to my information, nobody has ever done such things in pure PHP.
Demo in action: https://www.youtube.com/watch?v=vsBbJbhKeeU
Requirements
- PHP 8.1+
- ext-ffi
- Composer
- Windows, Linux or Unix (over X11 and Wayland), MacOS
Additional Requirements (MacOS and Linux only)
- SDL 2.0+
- SDL Image 2.0+
- SDL TTF 2.0+
Installation
Windows
composer installphp app.php
Linux
sudo apt install libsdl2-2.0-0 -ysudo apt install libsdl2-image-2.0-0 -ysudo apt install libsdl2-ttf-2.0-0 -ycomposer installphp app.php
MacOS
brew install sdl2brew install sdl2_imagebrew install sdl2_ttfcomposer installphp app.php
Docker
docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -e XAUTHORITY=$XAUTHORITY $(docker build -q .)
General Information
- The "
./engine/" directory contains deprecated code that will be removed in the future (for now it is required for the demo to work). All actual code is currently contained in the./libs/directory and some part of the old code has already been replaced with the current one. - It is planned to move away from separate installation of binaries
(SDL, SDL Image, etc...) and ship them together with the application.
The
./libs/binaries-downloaderpackage is responsible for their installation. Assemblies are available here in the "assets" section here: https://github.com/SerafimArts/opengl-demo/releases/tag/0.0.1 - It is planned to move away from SDL support and switch to native OpenGL API (This is one of the reasons why MacOS can disappear from the list of available operating systems), and then Vulkan API.
- After rewriting the graphics pipeline, it is planned to add a sound/audio engine (fuck knows how to do it).