An open API service indexing awesome lists of open source software.

https://github.com/mdziekon/UniEngine

OGame-like Game Engine
https://github.com/mdziekon/UniEngine

game-engine game-server hacktoberfest ogame

Last synced: about 1 year ago
JSON representation

OGame-like Game Engine

Awesome Lists containing this project

README

          

# UniEngine

[![Release: Stable (latest)](https://img.shields.io/github/release/mdziekon/UniEngine.svg?label=release%3Astable&logo=github&logoColor=FFFFFF)](https://github.com/mdziekon/UniEngine/releases)

[![PHP CI status (master)](https://github.com/mdziekon/UniEngine/actions/workflows/php-ci.yaml/badge.svg)](https://github.com/mdziekon/UniEngine/actions?query=branch%3Amaster)
[![JS & CSS CI status (master)](https://github.com/mdziekon/UniEngine/actions/workflows/js-ci.yaml/badge.svg)](https://github.com/mdziekon/UniEngine/actions?query=branch%3Amaster)

OGame-clone browser based game engine.

---

- [Requirements](#requirements)
- [Installation](#installation)
- [Updating from older versions](#updating-from-older-versions)
- [Development guides](#development-guides)
- [Documentation](#documentation)
- [Languages](#languages)
- [Credits](#credits)
- [License](#license)

## Requirements

- PHP
- ``>= 7.0 && < 7.3``
- Composer
- ``>= 1.6``
- MySQL
- ``>= 5``
- A webserver (eg. nginx)

### (Additional) Development requirements

- Node.js
- ``>= 11``

## Installation

### Bare Metal

1. Setup a webserver capable of running PHP scripts.
- ``php.ini`` file should have ``E_NOTICE`` reporting disabled, eg.:
- ``error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT``
- PHP needs to have write permissions to these files / directories:
- ``config.php``
- (one-off, installation purposes)
- ``includes/constants.php``
- (one-off, installation purposes)
- ``tmp/``
- (permanent, eg. for Smarty cache)
1. Setup a MySQL server.
- Disable ``STRICT_TRANS_TABLES`` mode.
1. Create a DB user and DB database for your game server.
1. Move source files of the project to your webserver's directory.
1. Install PHP dependencies.
- ``composer install --no-dev``
1. Run installation wizard: ``http(s)://:/install``
1. Remove ``install/`` directory

### Docker

1. Prepare config file ``mkdir docker && cp config.php docker && cp includes/constants.php docker && sudo chown 33:33 docker/*.php``\
The user and group id 33 here is the `www-data` user from `nginx:stable` and `php:7.3-fpm`, because it may have a different name on some hosts (for example, on archlinux it is `http`), use its id here to make sure it is available
1. Prepare and edit environment config file ``cp example.env .env && vim .env``
1. Build and run services ``docker-compose up -d --build``
1. Run installation wizard: ``http(s)://:/install``\
The port number should already be defined in ``.env``, unless you are using a reverse proxy such as nginx or traefik, then this should match the configuration in your reverse proxy.
1. Initialize with the root user password and database name defined in the ``.env`` file, database host should be ``db``

## Updating from older versions

1. Check [__Releases__ section](https://github.com/mdziekon/UniEngine/releases) to see if migration scripts have been provided between your current version and the latest version you want to upgrade to.
- In case of missing migration scripts, **do not try to use the auto-migrate functionality!** It may completely break your game server.
- In case of major breaking changes (which for some reason were not possible to auto-migrate), there should be a release note explaining why and what manual actions have to be performed to proceed with migration.
- In case of major breaking changes, it also might be required to apply migration scripts incrementally using older versions of the code first. In such cases, the migrator will check the constraints before applying any migrations, and will try to inform you what version's migrations should be applied first.
1. Close your game server (prevent players from accessing the game).
1. Perform a full backup of your game server's state (database, configuration, files, etc...).
1. Make sure that your PHP server has write access to game server's files (in case if one of the migration scripts might need this).
1. Update files to the desired version.
1. Update PHP dependencies.
- ``composer install --no-dev``
1. Run migration script from project's root directory:
- ``composer run-script migrate:run``
- For more details go to [Available scripts](#available-scripts) section.
1. (conditional) When needed, apply any one-off scripts required prior to migrations:
- ``composer run-script utils:oneoffs:run ``
- For more details go to [Available scripts](#available-scripts) section.
1. Restart PHP server.

## Development guides

### Preparations

1. Install PHP dependencies (normal & dev):
- ``composer install --dev``
1. Install Node.js dependencies:
- ``npm ci``

### Available scripts

- Run PHP code linting (powered by PHP Code Sniffer)
- ``composer run-script ci:php:phpcs``
- Run all not-yet-applied migrations
- ``composer run-script migrate:run [--confirm-manual-action]``
- Script will automatically apply all outstanding migrations.
- A manual interaction might be required. If that's the case, follow the instructions printed to the command line and then run the script again with ``--confirm-manual-action`` flag.
- After successful migration, a marker file will be created (``config/latest-applied-migration``) for future migrations.
- Generate new migration file using a template
- ``composer run-script migrate:make ``
- New migration file with autogenerated ID (date) will be created in ``utils/migrator/migrations/`` directory.
- Run any available one-off script
- ``composer run-script utils:oneoffs:run ``
- Running these scripts manually might be required to complete certain migrations.
- Generate new one-off script file using a template
- ``composer run-script utils:oneoffs:make ``
- New one-off script file with autogenerated ID (date) will be created in ``utils/one_offs/scripts/`` directory.
- Run JavaScript code linting (powered by ESLint):
- ``npm run ci:js:eslint``
- Run CSS code linting (powered by stylelint):
- ``npm run ci:css:stylelint``
- Rebuild (minification + cachebusting) JS & CSS files:
- ``npm run build:minify``
- All files from ``js/`` and ``css/`` directories will be re-minified (only when actually changed) and saved in their respective ``dist/`` directories.
- _Note:_ when a file has no changes, this script **won't** remove the old minified & cachebusted file from ``dist/``. File replacement happens only if a source file has changes, or there is no result file yet.
- _Note:_ this script does **not** automatically replace filepaths in templates. For now, this has to be done manually by a developer.
- _Note:_ due to legacy reasons, all files in ``dist/`` are stored in the repo.

---

## Documentation

Visit [docs/index.md](./docs/index.md) to see project's documentation.

## Languages

- English 🇬🇧
- Polish / Polski 🇵🇱
- French / Français 🇫🇷 (work in progress, temporarily disabled)

## Credits

### Authors

- Michał Dziekoński (https://github.com/mdziekon)

### Contributors

For the contributors list, see [Github's contributors graph](https://github.com/mdziekon/UniEngine/graphs/contributors) or use any Git client to extract that list.

## License

### Current license

```
UniEngine - OGame-like Game Engine
Copyright (C) 2021 Michał Dziekoński

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
```

See [`LICENSE`](./LICENSE) or [`licenses/AGPL-3.license`](./licenses/AGPL-3.license) files for this project's current license copy.

### Until commit [591eba4](https://github.com/mdziekon/UniEngine/commit/591eba40476d42781f33eeaf10acf5859b464f33)

```
UniEngine - OGame-like Game Engine
Copyright (C) 2013-2021 Michał Dziekoński

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
```

### Other licenses

See [`licenses/OTHERLICENSES`](./licenses/OTHERLICENSES) for the licenses of included external resources.