This is a fork of the original Legend of the Green Dragon game by Eric "MightyE" Stevens (http://www.mightye.org) and JT "Kendaer" Traub (http://www.dragoncat.net)
The original readme and license texts follow below, also the installation + upgrade routines which haven't changed much.
Note: The CHANGELOG.txt file does not cover every change. Around 300 commits were made without entries, so refer to the git history for a complete list.
This fork updates the Dragonprime 1.1.1 release with modern tooling while remaining compatible with existing modules. It aims to provide a smoother experience on current PHP versions. The source lives on GitHub where you can follow development and open issues.
Features of this fork include:
- additional hooks
- a stat system with strength, dexterity, and other attributes
- numerous other changes documented in
CHANGELOG.txt - compatibility with PHP 8.3
- PHPMailer replacing the sendmail system
- mail notifications that auto-refresh via Ajax (resources under
async/) - incremental chat updates via
commentary_refreshto load new messages without reloading the page - Ajax requests are rate limited to roughly one per second; faster requests
receive an HTTP 429 response. When enabling Ajax features, copy
config/async.settings.php.disttoconfig/async.settings.phpand adjust$ajax_rate_limit_secondsas needed. - Composer integration for third-party modules
- after modifying Composer settings, run
composer dump-autoloadto recognize new namespaces - after running
composer installorcomposer dump-autoload, includeautoload.phpto load all dependencies autoload.phpautomatically loadsvendor/autoload.phpand registers the project namespace
- after modifying Composer settings, run
- mysqli is now the default database layer
- Twig is now the default template system located in
templates_twig/(classic.htmfiles continue to work)
It should run on any modern PHP environment. Open an issue on GitHub with questions.
Chat with other adventurers and get quick support on our Discord server!
There is no official demo server. You can explore the original at LotGD.net or the current version at Shinobi Legends. You can create an account to explore, but you will only have standard user rights.
See AGENTS.md for full contributor guidelines. Highlights:
- Follow the PSR-12 coding standard.
- Run
composer testandcomposer staticbefore committing. - Check PHP syntax with
php -lon changed PHP files.
- Join the Community
- Contributing
- Read Me First
- System Requirements
- Quick Install
- Getting Started
- Install from Release Archive
- Cron Job Setup
- SMTP Mail Setup
- Beta Setup
- After Upgrading
- Upgrading
- Installation
- Post Installation
- Composer Local Setup
Thank you for downloading the modified version of Legend Of the Green Dragon.
See CHANGELOG.txt for a list of changes up until version 1.3.2.
👉 See CHANGELOG.md for a detailed history after that up until now.
If you need modules, go there and fetch the ones you like. There may be more out there, in the original dragonprime resources or other people's work. Modern DragonPrime resources, templates, and community support now live at DragonPrime Reborn, the successor to the legacy DragonPrime site, which also hosts a snapshot archive of legacy modules that typically require refactoring for PHP 8+ compatibility.
To follow the actively maintained spiritual successor of the main core this fork extends, visit StephenKise's Legend of the Green Dragon, which carries forward ongoing development and releases.
If you need more legacy templates / skins for the game, go there.
To run Legend of the Green Dragon on a typical web host you will need:
- Web server: Apache 2 (or another server capable of running PHP)
- PHP: version 8.3 or newer
- Database: MySQL 5.0 or later. MariaDB is a compatible alternative.
- The database user must have the
LOCK TABLESprivilege.
- Clone the repository.
- Run
composer install. - Open
installer.phpin your browser and follow the prompts. When asked for a cache directory, setDB_DATACACHEPATHto a writable path such asdata/cache. - (Optional) Use Docker—see docs/Docker.md.
Regular upkeep tasks:
- Run
composer updateto update dependencies. - Run
composer testto execute the unit tests andcomposer staticto run PHPStan or other static analyzers; ensure both pass before committing. - Schedule
cron.phpvia cron for automated jobs. - Configure SMTP settings in
config/configuration.php. - If you change
DB_PREFIX, clear the cache directory to avoid reusing metadata from the previous prefix.
- Full PSR-4 / Composer refactor
- Doctrine ORM + migrations
- Twig template engine
- Async/Ajax (Jaxon) UX improvements
- PHP 8.3 baseline
Performance defaults:
- zlib output compression enabled when available.
- Data cache and Twig cache use the
datacachepathdirectory; the game warns admins if the path is missing or not writable.
👉 See UPGRADING.md if you’re moving from 1.3.x
For details on key components:
- docs/Nav.md
- docs/Doctrine.md
- docs/TranslationsGuide.md
- UPGRADING.md — 1.3.x → 2.0 changes, performance defaults
- docs/Deprecations.md — deprecations and migration timelines
Twig templates reside in the templates_twig/ directory. Each template should
have its own folder containing a config.json, page.twig, and popup.twig.
The distribution includes the aurora template and uses it as the default
skin. You can switch to another template by changing the defaultskin setting
or by setting a template cookie. If a matching folder is found, pages are
rendered with Twig; classic .htm templates continue to work as before.
Twig views receive variables for common placeholders like nav, stats, and
paypal, allowing flexible layouts.
Compiled Twig templates are cached under the directory defined by the
datacachepath setting. The engine attempts to create a twig subdirectory
and only enables caching when it is writable. If the path cannot be created
or written to, templates are rendered without caching.
dbconnect.php is created by the installer and stores database and cache
settings in plain PHP. It is the only core file not overwritten during updates
and remains the primary place for these settings. Site-specific overrides can
be placed in the config/ directory (e.g., config/configuration.php) to keep
them separate from the core. After installation you can edit dbconnect.php to
point the datacachepath setting at a writable directory:
$DB_USEDATACACHE = 1;
$DB_DATACACHEPATH = "/path/to/lotgd/data/cache"; // without trailing slashCommon locations include a data/cache folder within the project or a
dedicated directory such as /tmp/lotgd. Give the web server write access
with a command like chmod 775 data/cache (or adjust as required by your
hosting environment). A valid datacachepath enables Twig caching—without it
pages must be recompiled and the game runs noticeably slower.
Official releases include the vendor/ directory so no additional commands are
required. Download lotgd-<version>.tar.gz or lotgd-<version>.zip from the
Releases page, upload the contents
to your web server and open installer.php in your browser. The installer
will guide you through the setup.
Releases are created automatically when pushing a tag that starts with v.
Update the version in common.php, commit the change and push a tag like
v2.0.0 or v2.0.0-rc1. GitHub Actions then builds archives that contain the
application and its vendor/ dependencies while omitting development files such
as the tests/ directory.
cron.php handles automated tasks such as daily resets. Run it from the command line with php cron.php and schedule it in your system's crontab. The script automatically determines its installation directory, so no manual configuration or $GAME_DIR value is required.
⚠️ Do not leavecron.phppublicly reachable. Remove it from the web root or block direct requests. When using Apache, add the following rule to the project’s root.htaccess:<Files "cron.php"> Require all denied </Files>Apply the equivalent protection in other servers (for example, an Nginx
locationblock that returns403) or move the script outside the document root so it can only be executed from the CLI.
| Constant | Bit value | Routine | Notes |
|---|---|---|---|
CRON_NEWDAY |
1 |
Daily reset | Calls Newday::runOnce() to process turns, buffs, and cache maintenance. |
CRON_DBCLEANUP |
2 |
Database maintenance | Runs Newday::dbCleanup() to optimize all tables. Accepts an optional second CLI argument to force an optimization even if the daily timer has not elapsed. |
CRON_COMMENTCLEANUP |
4 |
Content cleanup | Purges old commentary, news, referers, mail, fail logs, and archives via Newday::commentCleanup(). |
CRON_CHARCLEANUP |
8 |
Character expiration | Invokes Newday::charCleanup() and ExpireChars::expire() to remove inactive characters. |
Invoke php cron.php with no arguments for the full maintenance run (1|2|4|8 = 15). Supply a bitmask to limit the routines—for example, php cron.php 5 (1|4) runs the newday reset and content cleanup while skipping database/character cleanup. Leave off the second argument unless you need to force database optimization.
Enable the newdaycron flag in the admin settings (or set newdaycron to 1 in the settings table) to process new days exclusively through the cron job instead of when the first player logs in. Each maintenance step records its work in the Game Log (Superuser ➜ Game Log or gamelog.php), letting administrators confirm that the cron run completed successfully.
LOTGD uses PHPMailer for all outgoing mail. Open the admin settings (or edit
config/configuration.php) and fill in the options under SMTP Mail Settings:
"gamemailhost" => "SMTP Hostname",
"gamailsmtpauth" => "SMTP Auth, bool",
"gamemailusername" => "SMTP Username",
"gamemailpassword" => "SMTP Password",
"gamemailsmtpsecure" => "SMTP Secure mechanism, enum: [starttls, STARTTLS, tls, TLS]",
"gamemailsmtpport" => "SMTP port to use,int",Enable notify_on_warn or notify_on_error and set notify_address in the
Error Notification section to receive site warnings or errors via email.
These notifications rely on the data cache, so ensure $DB_USEDATACACHE is set
to 1 and $DB_DATACACHEPATH points to a writable directory in
dbconnect.php.
pavilion.php is an optional script used when beta features are enabled per
player. Players flagged for beta access see a link to the pavilion in the
village and can use it to try experimental features. The repository provides a
minimal template for this file which simply displays a message and a commentary
section. Customize it to implement your own beta content.
After upgrading from versions prior to 1.1.1 DP Edition you should:
- Check your races and remove any
charstatshooks that only output the race under Vital Info. - Users with data cache enabled must edit
dbconnect.phpand add:
$DB_USEDATACACHE = 1;
$DB_DATACACHEPATH = "/your/caching/dir"; // without trailing slash- Translators should replace hard coded names in dialogues with
%susing the Translation Wizard. - Verify that the server supported languages are configured correctly.
- Index definitions that exceed MySQL's key length limits are now automatically
truncated by the installer. String columns in composite indexes are reduced to
safe prefixes (for example
(191)forutf8mb4) when necessary.
by Eric "MightyE" Stevens (http://www.mightye.org) and JT "Kendaer" Traub (http://www.dragoncat.net)
Modification AND Support Community Page: http://dragonprime.net
Primary game servers: http://lotgd.net http://logd.dragoncat.net
For a new installation, see INSTALLATION below. For upgrading a new installation, see UPGRADING below. If you have problems, please visit Dragonprime at the address above.
Legacy installation and upgrade instructions have moved to docs/LegacyREADME.md.
When upgrading from a legacy release, run the legacy upgrade script before migrations. This applies all legacy SQL for newer versions prior to running Doctrine migrations.
-
Step 1 (pre-migration versions only):
php bin/legacy-upgrade --from-version="1.1.1 Dragonprime Edition" -
Step 2:
php bin/doctrine migrations:migrate
The command reads
src/Lotgd/Config/migrations.phpandsrc/Lotgd/Config/migrations-db.phpby default. If your configuration lives elsewhere, pass--configurationand--db-configurationwith the appropriate paths.
Omitting --from-version bypasses legacy SQL entirely.
- Docker installed
- Docker Compose installed
- Basic knowledge of Docker and command-line operations
Clone the LOTGD repository to your local machine:
git clone https://github.com/NB-Core/lotgd.git
cd lotgdThis repository already includes the essential Docker and configuration files. Review these files and adjust them as needed:
- Dockerfile
- docker-compose.yml
- .env – copy
\.env.exampleto.envand update values as needed - .htaccess
The details of each file are covered in the Configuration Files section.
Build the Docker containers and start the environment:
docker-compose up -d --buildWith the containers running, open installer.php in your browser. When prompted for a cache directory, set DB_DATACACHEPATH to a writable location (for example data/cache) to enable caching.
# Composer stage – install dependencies
FROM composer:2 AS composer
WORKDIR /app
COPY composer.json composer.lock ./
RUN composer install --no-dev --no-interaction --prefer-dist
# Final image with PHP and Apache
FROM php:apache
# Install required packages and PHP extensions
RUN apt-get update && apt-get install -y \
libpng-dev \
libjpeg-dev \
libonig-dev \
libzip-dev \
&& docker-php-ext-configure gd --with-jpeg \
&& docker-php-ext-install gd mysqli pdo pdo_mysql mbstring zip \
&& rm -rf /var/lib/apt/lists/*
# Enable mod_rewrite and .htaccess overrides
RUN a2enmod rewrite
RUN sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
# Copy application code and vendor directory
WORKDIR /var/www/html
COPY . /var/www/html
COPY --from=composer /app/vendor /var/www/html/vendor
# Set permissions for web server
RUN chown -R www-data:www-data /var/www/html
# Expose Apache port
EXPOSE 80
# Enable verbose PHP error reporting
RUN echo "display_errors = On;" >> /usr/local/etc/php/conf.d/docker-php.ini \
&& echo "display_startup_errors = On;" >> /usr/local/etc/php/conf.d/docker-php.ini \
&& echo "error_reporting = E_ALL;" >> /usr/local/etc/php/conf.d/docker-php.ini \
&& echo "log_errors = On;" >> /usr/local/etc/php/conf.d/docker-php.ini \
&& echo "error_log = /dev/stderr;" >> /usr/local/etc/php/conf.d/docker-php.ini
CMD ["apache2-foreground"]