How leo0416/ultimatexnova works
1. What this repo is
- ultimateXnova is a PHP/MySQL browser game server for a space strategy game.
- The application is split into a web-facing game/admin/install surface, a background cron layer, and a set of bundled client-side assets and third-party libraries.
2. Main runtime entry points
- index.php is the public landing/login entry.
- game.php is the main authenticated game shell.
- admin.php is the administration console.
- install/index.php drives installation and upgrades.
- cronjob.php is the scheduled background entry point for game simulation, updates, and maintenance.
3. Server-side application structure
- includes/ contains the core PHP application logic.
- includes/pages/ is the page/controller layer, separated by area: login, game, and admin.
- includes/classes/ holds domain services and handlers for fleets, missions, stats, support tickets, templates, themes, and cron tasks.
- includes/common.php, constants.php, dbtables.php, and vars.php look like bootstrap/configuration and shared definitions.
4. Primary data model and persistence
- The backend persists state in MySQL: players, planets, fleets, messages, alliances, tickets, logs, etc.
- includes/dbtables.php centralizes table names/structure references.
- cache/ stores rendered template cache and PHP session data, showing the app relies on file-backed caching alongside the database.
5. Core game loop and background processing
- The game is not purely request/response; a significant amount of state changes happen asynchronously through cronjob.php.
- Background tasks likely update resources, fleets, combat resolution, statistics, and timed events.
- includes/classes/cronjob/ defines task interfaces, indicating modular scheduled jobs.
6. Combat and fleet simulation subsystem
- Battle resolution is a major subsystem.
- includes/libs/opbe/ provides the combat engine and report rendering.
- Mission and fleet helpers in includes/classes/missions/ and includes/classes/class.FlyingFleetHandler.php orchestrate travel, attacks, recycling, espionage, and report generation.
- CombatReport.php is a top-level report-oriented entry point, likely for viewing or exporting battle results.
7. Templating and UI rendering
- The UI is rendered primarily with Smarty templates under styles/templates/.
- Theme variants such as gow, nova, nextgen, office, and EpicBlueXIII provide alternate skins and layouts.
- includes/classes/class.template.php and class.theme.php connect game data to the selected theme.
- This means presentation is strongly separated from game logic, but still server-rendered.
8. Client-side behavior
- scripts/ contains JavaScript for gameplay interactions, forms, validation, tables, fleet actions, galaxy views, messaging, and login/register flows.
- styles/resource/css/ and theme assets contain the visual layer, while scripts/base/ bundles shared libraries like jQuery, validation, TinyMCE, and tooltip helpers.
- The frontend is mostly enhancement code over server-rendered pages rather than a standalone SPA.
9. Internationalization and content
- The app is heavily localized.
- language/ contains server-side language packs and email/template text for multiple languages.
- chat/js/lang/ and chat/lib/lang/ provide chat localization.
- This localization layer feeds both gameplay UI and system-generated messages.
10. Chat subsystem
- chat/ is a self-contained AJAX chat/shoutbox integration with its own PHP library, templates, assets, and optional socket server.
- chat/socket/server.rb and server.conf indicate a separate real-time component used for chat transport.
- The game embeds chat as an adjunct service rather than folding it into the core gameplay runtime.
11. External integrations
- The repo bundles libraries for SMTP mail delivery, reCAPTCHA, OpenID, Facebook auth, and TeamSpeak integration.
- These are used where the game needs account verification, anti-bot protection, email workflows, or community integration.
- includes/libs/phpmailer, reCAPTCHA, OpenID, facebook, and teamspeak are the main integration boundaries.
12. Automation and server ops tooling
- external/autobot/ contains scripts for automated bot/server behavior such as attacks, building, colonization, and message cleanup.
- external/forcekill-session-patch/ and external/events.php suggest administrative or maintenance utilities.
- scripts/backend/ includes Python tooling, which appears to support backend/server-side automation rather than gameplay.
13. Deployment shape
- The repo is designed to run either on a traditional PHP web server or in Docker.
- Dockerfile and docker-compose.yml package the web app plus its MySQL dependency.
- nginx.md suggests there is deployment guidance for reverse proxy/web server setup.
14. How the pieces interact
- Browser requests hit one of the PHP entry points, which route into includes/pages/*.
- Those pages call into includes/classes/* for game rules and persistence, query MySQL, and render via Smarty templates/theme assets.
- Time-based state changes are applied by cronjob.php.
- Chat, email, and other integrations operate as adjacent subsystems, not as part of the core game engine.
Main entry points: pages Page controllers · classes Game services · common.php Bootstrap · class.template.php Smarty layer
Components 22
Runtimes
Main PHP entry points and background execution paths
- Landing · Public login and landing entry point
index.php - Game shell · Authenticated in-game entry point
game.php - Admin console · Administration entry point
admin.php - Installer · Install and upgrade entry point
install/index.php - Cron runner · Scheduled background simulation and maintenance
cronjob.php
Core app
Shared server-side game logic and persistence
- Bootstrap · Common setup, constants, variables, and table map
includes/common.php - DB schema map · Centralized MySQL table references and structure names
includes/dbtables.php - Page controllers · Login, game, and admin page dispatchers
includes/pages - Game services · Fleet, missions, builds, stats, support, themes, and templates
includes/classes - Fleet handler · Coordinates fleet movement and active fleet state
includes/classes/class.FlyingFleetHandler.php - Missions · Attack, steal, espionage, and report generation helpers
includes/classes/missions - Cron tasks · Modular scheduled job contract and task implementations
includes/classes/cronjob - Combat engine · Battle simulation and combat report rendering
includes/libs/opbe - Cache & sessions · File-backed template cache and session storage
cache
Presentation
Templates, themes, and client-side assets
- Smarty layer · Template rendering and theme binding
includes/classes/class.template.php - Themes · Server-rendered theme templates and assets
styles/templates/theme - Client scripts · Gameplay, login, admin, and shared JavaScript
scripts - Language packs · Server-side text, email templates, and UI strings
language
Integrations
Third-party services and adjacent subsystems
- Chat subsystem · Bundled AJAX chat with optional socket transport
chat - Third-party libs · SMTP, OpenID, Facebook, reCAPTCHA, BBCode, Parsedown, TeamSpeak, ZIP, PHP cron helpers
includes/libs
Ops
Deployment, automation, and maintenance tooling
- Automation tools · Bot, maintenance, and backend automation utilities
external - Deployment · Container and web server deployment definitions
Dockerfile
Connections 27
- Landing → Bootstrap: bootstraps · Loads shared app setup
- Game shell → Bootstrap: bootstraps · Loads shared app setup
- Admin console → Bootstrap: bootstraps · Loads shared app setup
- Installer → Bootstrap: bootstraps · Loads install-time shared setup
- Cron runner → Bootstrap: boots · Initializes background runtime
- Landing → Page controllers: routes to · Dispatches login and public pages
- Game shell → Page controllers: routes to · Dispatches in-game pages
- Admin console → Page controllers: routes to · Dispatches admin pages
- Installer → Page controllers: routes to · Dispatches installer pages
- Page controllers → Game services: uses · Page controllers call into game services
- Game services → Fleet handler: includes · Fleet execution is a central service
- Game services → Missions: includes · Mission orchestration and outcomes
- Game services → Cron tasks: includes · Scheduled jobs extend the cron interface
- Cron runner → Cron tasks: executes · Runs modular background jobs
- Missions → Combat engine: simulates · Combat and report generation depend on battle engine
- Game services → DB schema map: queries · Persists game state through shared table map
- Bootstrap → DB schema map: defines · Shared bootstrap includes table definitions
- Page controllers → Smarty layer: renders · Controllers render via the template layer
- Smarty layer → Themes: selects · Theme-aware server rendering
- Smarty layer → Cache & sessions: reads/writes · Compiled template and session cache
- Page controllers → Language packs: localizes · Page text and emails use language packs
- Page controllers → Client scripts: serves · Pages are enhanced by client-side behavior
- Page controllers → Chat subsystem: embeds · Chat is an adjacent subsystem in the UI
- Page controllers → Third-party libs: integrates · Uses bundled third-party libraries
- Automation tools → Game services: automates · Automation scripts interact with game systems
- Deployment → Game shell: deploys · Container setup serves the PHP app
- Deployment → Chat subsystem: deploys · Deployment may include chat service pieces