Skip to content

Project Setup

Setting up a new VISU PHP Game Project.

Is PHP-GLFW already installed?

Have you read the installation guide yet? If not, please do so first. VISU requires the following:

Follow the installation guide if you haven't installed the extensions yet!

Creating a new VISU project

Pick your Setup

VISU can be setup in multiple different ways, for the sake of simplicity we are going to focus on two main methods:

  1. πŸš€ VISU Quickstart (Recommended for beginners)
    The VISU Quickstart creates a minimal and lightweight VISU application for rapid prototyping.

  2. ⚑ Full VISU Starter Project (Advanced)
    The VISU Starter Project creates a fully featured VISU application with basic game structure, asset management, and example code. (Think like a framework with controllers, routing, views, etc.)

Once you have all the requirements installed, you can create a new VISU project using Composer's create-project.

VISU Quickstart

You can find the VISU Quickstart repository here.

VISU Quickstart

To create a new VISU Quickstart project, run the following Composer command in your terminal:

composer create-project phpgl/visu-quickstart -s dev --prefer-dist my-php-game

This command will create a new VISU project in the my-php-game directory.

Then enter the newly created project in your terminal:

cd my-php-game

And you're ready to go!

php bin/start.php

VISU Quickstart Window

You should see a window open with a black background and red ball that you can move around with "WASD" keys.

Quickstart Structure

my-php-game/
β”œβ”€β”€ app.ctn        <- App Configuration / Dependency Container
β”œβ”€β”€ bootstrap.php  <- Bootstrap / Initialization File
β”œβ”€β”€ composer.json
β”œβ”€β”€ app/           <- Additional configuration / dependencies
β”œβ”€β”€ bin/           <- Executable scripts
β”œβ”€β”€ src/           <- Your game code
β”‚   └── Application.php
β”œβ”€β”€ var/           <- Writable directory for logs, cache, etc.
└── vendor/        <- Composer dependencies

Full VISU Starter Project

You can find the VISU Starter Project repository here.

To create a new VISU Starter project, run the following Composer command in your terminal:

composer create-project phpgl/visu-starter -s dev --prefer-dist my-php-game

This command will create a new VISU project in the my-php-game directory.

There's a quick wizard that might ask you for a few basics, like your game's name, to create the initial configuration.

After the installation, open the newly created project in your terminal:

cd my-php-game

Running the game

Once all dependencies are installed, you can run the game by executing the play command:

./bin/play

A window should open with a black background and a few flying elephpants in it.

Image title

VISU Starter Project Screen

Controls

The controls of the VISU PHP starter game are as follows:

  • W - Move up
  • A - Move left
  • S - Move down
  • D - Move right
  • F1 - Toggle debug text and profiler
  • ctrl+c - Toggles the ingame console
  • ESC - Exit the game