Giter Site home page Giter Site logo

mdziekon / uniengine Goto Github PK

View Code? Open in Web Editor NEW
99.0 19.0 36.0 13.8 MB

OGame-like Game Engine

License: GNU Affero General Public License v3.0

PHP 77.10% Smarty 13.09% CSS 2.02% JavaScript 7.77% Shell 0.01% Dockerfile 0.02%
ogame game-server game-engine hacktoberfest

uniengine's Introduction

UniEngine

Release: Stable (latest)

PHP CI status (master) JS & CSS CI status (master)

OGame-clone browser based game engine.


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)
  2. Setup a MySQL server.
    • Disable STRICT_TRANS_TABLES mode.
  3. Create a DB user and DB database for your game server.
  4. Move source files of the project to your webserver's directory.
  5. Install PHP dependencies.
    • composer install --no-dev
  6. Run installation wizard: http(s)://<your_server_address>:<port>/install
  7. 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
  2. Prepare and edit environment config file cp example.env .env && vim .env
  3. Build and run services docker-compose up -d --build
  4. Run installation wizard: http(s)://<your_server_address>:<port>/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.
  5. 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 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.
  2. Close your game server (prevent players from accessing the game).
  3. Perform a full backup of your game server's state (database, configuration, files, etc...).
  4. 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).
  5. Update files to the desired version.
  6. Update PHP dependencies.
    • composer install --no-dev
  7. Run migration script from project's root directory:
  8. (conditional) When needed, apply any one-off scripts required prior to migrations:
    • composer run-script utils:oneoffs:run <SCRIPT_ID>
    • For more details go to Available scripts section.
  9. Restart PHP server.

Development guides

Preparations

  1. Install PHP dependencies (normal & dev):
    • composer install --dev
  2. 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 <MIGRATION_FILE_NAME>
    • 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 <SCRIPT_ID>
    • 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 <SCRIPT_FILE_NAME>
    • 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 to see project's documentation.

Languages

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

Credits

Authors

Contributors

For the contributors list, see Github's contributors graph 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 <https://www.gnu.org/licenses/>.

See LICENSE or licenses/AGPL-3.license files for this project's current license copy.

Until commit 591eba4

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 for the licenses of included external resources.

uniengine's People

Contributors

bblaha avatar dependabot[bot] avatar kagurazakanyaa avatar mdziekon avatar mickaelrod avatar xxidroxx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uniengine's Issues

massmessage_body.tpl - Hardcoded string not in lang file

Hi @mdziekon

in the following file:
templates/default_template/admin/massmessage_body.tpl

Example:

  • Temat
  • znaków
  • Wiadomość do wszystkich
  • <textarea name="tresc" cols="40" rows="10" size="100">Wiadomość administracyjna</textarea>
  • "Wyślij" in type "submit"

Regards,
Alfredo.

[BUG] Task not showing as completed and missing reward, although all subtasks are green

Problem description

Task #11 of the Introductory tasks (Task 11: Players' unions) shows green for all subtasks, but I received no reward and the task still shows as incomplete.

Engine details

  • Engine version:
    • `version 1.0.0
    • commit 41b05d29f203fdc1c266f5df06afbbd9b5f4e0b6
  • Custom modifications:
    • Yes
    • No
  • Environment:
    • local
    • testing (inaccessible from the outside)
    • production (accessible from the outside world)
  • Configuration:
    • Game speeds 1x
    • Debris settings 1x
    • Any other relevant config entry

Steps to reproduce

Not sure if this reproduces the error, but those were my steps:
Player A (me) sent a friend request.
Player B accepted friend request.
Player B received reward for accomplished task, Player A had no green sub task.
Player A created an Alliance to get the task reward.
Sub task now shows green for Player A, but main task is not completed and no task reward was received.

Expected behavior

Task should be completed, rewards paid out

Actual behavior

Subtasks are completed, main task is not, no rewards paid out

Screenshots

https://i.imgur.com/DF8Z52E.png

Desktop:

  • OS: Ubuntu 20.04
  • Browser: Brave
  • Version: 1.5.123 Chromium: 80.0.3987.163 (Official Build) (64-bit)

Bug in the installer

If you try to install the game there are several sql errors. Errors appear when you insert a new entry in the various tables. When i have some free time I try to propose a fix

Add PHP 7+ support

This project originated from times where PHP 7 was not a thing. Now, with major improvements in newer versions, project could greatly benefit from performance improvements in the base PHP interpreter.

However, this requires some modifications due to breaking changes introduced in PHP 7.

So far, I'm aware of these things that need to be changed:

  • Migrate mysql to mysqli (mysql extension was removed in PHP 7)
  • Replace some preg_replace with /e flag calls with preg_replace_callback() (/e/ flag was removed in PHP 7; besides, the "callback" version should be more simple and more secure)

Implement autoscaling of expedition's rewards

Request background

In #123 the new and rewritten expeditions system has been merged into master. However, it's "reward system" is currently set to a flat reward value. This value (or values for any new events to be added in #124) should automatically scale based on these criteria:

  • Ships in the fleet (more ships / more expensive ships should yield better rewards; however, there should be an upper limit on that)
  • Server's speeds (resources extraction & overall game speed)
  • Server's owner defined multiplier (additional variable / function for fine tuning on demand)

Related issues or PRs:

Possible game lock for certain players when using Morale system

It is possible for two (or more, since United attacks are affected as well) players be locked out of the game due to a bug in Morale system related calculations.

Specifically, when one of the participants of a battle does not have their morale_points calculated yet (highly unlikely, but might happen eg. when using admin account with admin protection disabled), the morale time addition might be calculated as INF, leading to game lockdown (for the participants of the battle, or anyone how cause the calculation of that battle) due to an SQL error. In addition to that, it seems that the error reporting code does not currently unlock the tables, leading to an error reporting nesting error, which has to be fixed as well.

TODO:

  • Fix the morale additional time recalculation (provide a safeguard)
  • Fix the error reporting code to automatically unlock all tables in the session

Install-Script broken

Hi there,
I wanted to try this engine and went on installing it.
As I always got the message that a db query failed and I would have to reset the database und do it all over I went hunting for the actual error.

When creating the admin user there are multiple fields in the table that are defined as "NOT NULL" but no data is provided for those columns.
Affected columns: user_agent, screen_settings, current_page, settings_FleetColors.
The same type of problem occurs with creation of the admin planet for columns: buildQueue, techQueue, shipyardQueue.

Add basic Docker / Vagrant configuration

Currently, to set up and run this project, one needs to start PHP & MySQL servers manually. It would be nice to automate this process, even if just for development purposes.

A simple docker-compose or Vagrant configuration script should do the trick.

Resources recalculation does not apply negative income when storage is full

Steps to reproduce

  1. Fill up deuterium storage
  2. Set deuterium production to 0% and deuterium consumption (reactor) to >0%

What should happen

  • Deuterium should slowly be drained from the storage

What actually happens

  • Deuterium is stuck at the full storage capacity amount

Regression tracking

Caused by (PR):

  • #56 (most likely offender)

Caused by (relevant code pieces):

if ($resourceCurrentAmount >= $resourceMaxStorage) {
return [
'isUpdated' => false,
'income' => 0
];
}

LostCode Page Href Link

Hi @mdziekon

the following link on lostcode.php is wrong :

href="{GameURL}">{servername}

Because GameURL is differently filled from for example the lostpassword.php (where is correct).

lostcode.php: $parse['GameURL'] = $_GameConfig['game_name'];
lostpassword.php: $parse['GameURL'] = GAMEURL_STRICT;
reg_mainpage.php:$parse['GameURL'] = GAMEURL_STRICT;

On lostcode.php should be $parse['GameURL'] = GAMEURL_STRICT;
Do you agree?

Regards,
Alfredo.

Ref link in index

Ref link doesnt work because reg.php not exists ( http://ip/UniDevelop/index.php?r=8)

I solved it in my local environment changing in the index.php the reg.php in reg_mainpage.php.

The cookie in constant.php must have the server ip as domain: i will share my conf if needed.

Available for further clarifications also at [email protected]

Regards
Alfredo

Environment Reset functionality

Hi Michal,

I think that can also be useful an Environment Reset by the Administrator (or via custom PHP script that can be manually executed) . In this way would be possible to reset the environment removing:

  • truncate Users table (excluding the first Admin)
  • truncate Planets table (excluding the first Admin's planet)
  • Set "today" the includes/constants.php:define('SERVER_MAINOPEN_TSTAMP' , 1559924754);

and.... what else is needed for a Env. Reset ?

  • all other tables should be truncated except of "_config" table ?

Best Regards,
Alfredo.

Attack Button

Hi guys,
I noticed that when the attack button is pushed from universe or from spy report, basically after the flets selection, the coordinates are lost and you will find your mother planet coordinates. Also if you change the coordinates manually, in the next page an error messagge says that the mission domt exist.

The Transport mission works correctly.
Im using the Master branch.

Write me for further information [email protected]

Regards
Alfredo.

Attack: http://192.168.1.156/UniDevelop/fleet.php?galaxy=2&system=462&planet=8&planettype=1&target_mission=1 --> http://192.168.1.156/UniDevelop/fleet1.php --> mission wrong

Trasport: http://192.168.1.156/UniDevelop/fleet.php?galaxy=2&system=462&planet=8&planettype=1&target_mission=3 --> http://192.168.1.156/UniDevelop/fleet1.php
--> its ok

Impossible to logout when user account has been locked due to exceeded activation requirement limit

Steps to reproduce

  1. Set your server config to require email activation
  2. Create a new account
  3. Wait for the activation requirement to reach its time limit
  4. Get the "You need to activate your account to continue the game"

What should happen

  • I should be able to logout (there should be a button / link to do that)
  • I should be able to forcibly logout myself going directly to the /logout.php page

What actually happens

  • There's no button / link to logout and destroy the session
  • Force logout (by going directly to /logout.php) has no effect

MySQL issue can't a text column have a default value in MySQL

Hi @mdziekon

I understood why you put in README:
Setup a MySQL server. Disable STRICT_TRANS_TABLES mode.

Basically, I noticed the MySQL has an Issue on some operative system where the "Text" field cannot have a default value: this can be bypassed as you wrote OR otherwise is possible put all "Text" field as DEFAULT NULL.

I noticed this issue using Altervista (hosting site) and i solved it putting the "Text" fields as default null : this is needed in case the user don't have the "Admin" control of the MySQL database.

An Example of issue:

Field 'screen_settings' doesn't have a default value
INSERT INTO Uni1_users SET username = 'TestReg', email = '[email protected]', email_2 = '[email protected]', ip_at_reg = '78.13.222.196', id_planet = 0, register_time = 1561585694, onlinetime = 1561585694 - (246060), rules_accept_stamp = 1561585694, password = MD5('TestReg');
File: /Uni1/reg_ajax.php?callback=regCallback&register=1&username=TestReg&password=TestReg&email=email%40email.it&galaxy=1&rules=on&captcha_response=&_=1561585694040
User: []

https://stackoverflow.com/questions/3466872/why-cant-a-text-column-have-a-default-value-in-mysql/25233562

Do you see any issue putting these Text fields as DEFAULT NULL ?

Best regards,
Alfredo.

Błąd w badaniach

Znalazłem dość istotny błąd gry w badaniach. Badania można wykonywać na wszystkich planetach ogólnie ale błąd polega na tym, że na poszczególnych planetach kolejna nie widzi,że na innej planecie dana technologia jest już rozbudowywana. Dla przykładu. Masz 9 planet. Na pierwszej planecie włączasz tworzenie szpiegowskiej na +1, następnie szybko się przełączasz i na kolejnych planetach nadal masz możliwośc właczenia badań szpiegowskiej na +1 bo kolejka nie widzi, że na pierwszej planecie badanie się już wykonuje. Tym oto sposobem po zakończeniu badań na wszystkich planetach masz szpiegowską na 9 poziomie płacąc surowcami jedynie za rozbudowę pierwszego poziomu.

Czy mógłbyś pomóc w załataniu tego błędu? Bardzo bym Cię prosił o kontakt na [email protected]

Replace "config baking" with proper JSON-style or dotenv-style config files

Right now, the installation process generates config & constants files and "bakes" them as .php files.

This should be replaced with JSON or dotenv style configuration, for easier maintainability and reduced generation complexity (currently we're using the old templating system which was not designed for that purpose).

Certain system messages sent to other users during calculation use the "host" user's language

Description

It seems that all system messages (messages displayed using message templates and parameters stored at message creation time) which use statically created parameters using $_LANG suffer from hard-baking message pieces in just one language inherited from "host" user (the user in whom context the calculation is being made). Usually it's not a problem, but some scripts generate messages for other users as well, which might have other languages picked. One such script is Attack mission handler (MissionCaseAttack.php).

Steps to reproduce (example)

  1. Find / create a user which uses different language than yourself
  2. Attack that user
  3. Check the attacked user's new messages (defense report message)

What should happen

  • The message should consist of all pieces in the language picked by the attacked user

What actually happens

  • The message consist of some pieces in the language picked by the attacking user

Regression tracking

Caused by (PR):

  • N/A

Caused by (relevant code pieces):

$Message = false;
$Message['msg_id'] = '075';
$Message['args'] = array($ReportID, $ReportColor2, $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $TargetTypeMsg, $ReportHasHLinkRelative, $ReportHasHLinkReal);
$Message = json_encode($Message);
unset($DefendersIDs[0]);
Cache_Message($DefendersIDs, 0, $FleetRow['fleet_start_time'], 3, '003', '017', $Message);
(one example)

Polish Hardcoded Calendar - AdminPanel - ChangeBan - SelectDate

Hi @mdziekon

there is an hardcoded calendar in AdminPanel > "Change a Banned user" > where is possible select a date there is a calendar that is in Polish.

I suppose that is related to this part of JavaScript but im not sure:
libs/jquery-ui-datepicker-pl/jquery-ui-datepicker-pl.min.js:jQuery(function(a){a.datepicker.regional["pl"]={closeText:"Zamknij",prevText:"&#x3c;Poprzedni",nextText:"Następny&#x3e;",currentText:"Dziś",monthNames:["Styczeń","Luty","Marzec","Kwiecień","Maj","Czerwiec","Lipiec","Sierpień","Wrzesień","Październik","Listopad","Grudzień"],monthNamesShort:["Sty","Lut","Mar","Kwi","Maj","Cze","Lip","Sie","Wrz","Paź","Lis","Gru"],dayNames:["Niedziela","Poniedziałek","Wtorek","Środa","Czwartek","Piątek","Sobota"],dayNamesShort:["Nie","Pn","Wt","Śr","Czw","Pt","So"],dayNamesMin:["N","Pn","Wt","Śr","Cz","Pt","So"],weekHeader:"Tydź",dateFormat:"yy-mm-dd",firstDay:1,isRTL:false,showMonthAfterYear:false,yearSuffix:""};a.datepicker.setDefaults(a.datepicker.regional["pl"]);if(typeof a.timepicker!="undefined"){a.timepicker.regional["pl"]={timeOnlyTitle:"Wybierz Czas",timeText:"Czas",hourText:"Godzina",minuteText:"Minuta",secondText:"Sekunda",millisecText:"Milisekunda",currentText:"Teraz",closeText:"Gotowe",ampm:false};a.timepicker.setDefaults(a.timepicker.regional["pl"])}})

I hope that my little analysis can help you.
Regards,
Alfredo.

Refactor fleet missions' code

Summary

In fleet missions' code there's a great deal of code duplication and complexities that are not easily grasped. This code needs to be refactored.

This should also help with writing adjustments to the expeditions code (#90)

Background

TBD

Related issues or PRs:

  • Part 1: #92 (Resources pillage calculation)
  • Part 2: #93 (Resources loss & debris calculation)
  • Part 3: #94 (Galaxy debris update)
  • Part 4: #95 (Morale modifiers calculation)
  • Part 5: #96 (User technologies initialization)
  • Part 6: #97 (User stats aggregation)
  • Part 7: #98 (Post-combat fleet updates)
  • Part 8: #100 (Post-combat system messages)
  • Part 9: #102 (Defense systems rebuild)
  • Part 10: #106 (Defenders' details aggregation)
  • Part 11: #107 (Combat result stats aggregation)
  • Part 12: #110 (Combat morale updates)
  • Part 13: #119 (Report data aquisition refactor)
  • Part 14: #120 (Moon creation refactor)
  • Part 15: #182 (Simulator utils refactor)
  • Part 16: #183 (Validators & helpers when sending fleets)
  • Part 16a: #184
  • Part 17: #185 (Bash limits validator)
  • Part 18: #187 (Noob protection validator)
  • Part 19: #188 (Fleet row creation refactor)
  • Part 20: #189 (Target info getter refactor)

Resources at Start functionality

Hi Michal,

I have analyzed this functionality, as you said, the formula is in CalculateBasicResourceSet:
$Calc['metal'] = round(1000 * pow($RegisterDays / 0.2, 2));
Use case:

* $RegisterDays = 8
* 1000 x ( 8 / 0,2)^2 = 1.600.000 of Metal : this is a very big amount that is also not considering the universe speed.

From my point of view, a good formula can be:

* $UniverseSpeed = "SELECT `config_value` FROM {{config_table}} WHERE `config_name` = 'resource_multiplier' ;";  --> for example 20 (20x) on my server

* $Calc['metal'] = round( 1000 * $RegisterDays *  $UniverseSpeed )  ;  means 1000 * 8 * 20 = 160.000 that is better

What do you think?

In this way the configuration is on the "universe res. speed" side in this way :)

Regards,
Alfredo.

Default English translation

This project's base language should be English, as this is the most commonly used language throughout open source community. Polish translation can stay as well, but should not be used by default.

TODO:

  • Translate all language files to English (provide another translation).
  • Find and remove all "hardcoded" Polish texts. So far I'm aware of:
    • Timers using "g m s" ("godziny, minuty, sekundy" in Polish), which should depend on the translation.

Reinstate expedition fleet mission's code

Feature request summary

Bring back and reenable the ability to send player's fleet on an "expedition" mission.

Request background

In the current codebase, expeditions (sending fleet to the outskirt of any solar system in order to have a random chance of either getting some additional resources, ships, or with bad luck, getting your fleet damaged or destroyed) are completely disabled.

As stated in the old expeditions file (includes/functions/MissionCaseExpedition.php), the reasoning for this state of the game is as follows:

// -------------------------------------------
// WARNING - WARNING - WARNING
// -------------------------------------------
// This script is NOT COMPATIBLE with current implementation of FleetHandler function and it's supporting functions
// Usage of this script without any changed can (and probably will) cause damage to your DataBase
// Before using it, make sure that it's fully compatible with FleetHandler function
// -------------------------------------------

TL;DR: the mission's code was not rewritten to be compatible with the "new" Fleets handling system back in the days when the rewrite happened.

Related issues or PRs:

Improve updater/migrator

Current migration process (admin/updater.php) involves too much dependencies on the core functions of the application. It also should not be accessible via admin panel, it should most likely be a command run from CLI. Once #18 is completed, it should reside in a directory separate from the app's core files.

TODO:

  • Provide slimmed-down version of the current admin/updater.php file
    • Protect from unauthorised execution (for now, use DBs password from config.php file)
    • Create migration script's interface (both up and down)
    • Make sure that all current scripts are compatible
    • Store last used migration script ID in lock file (instead of DB)
  • Provide a simple composer script to run migration process

Problem z logowaniem

Po podaniu zgodnego loginu i hasła wyskakuje: "Nie jesteś zalogowany! Zaloguj się!"

Podczas tworzenia nowego konta "Wystąpił błąd podczas przetwarzania żądania. Prosimy o kontakt z Administracją..." po czym w bazie danych dane już są.

Jaka jest tego przyczyna?

It's possible to join a united attack which has been turned back

Steps to reproduce

  1. Attack a target with a flight long enough to manipulate attack unions
  2. Turn that fleet into a united attack
  3. Wait a bit (eg. 2 minutes)
  4. Turn back the united attack fleet
  5. Try to send another attacking flight to the same coordinates (manually select all options)
  6. When selecting mission, pick "United attack" and select the original, turned back fleet from the ACS list

Expected result

  • The turned back flight is no longer displayed on the list in the third step of fleet control (fleet2.php)
  • It is not possible to join that United attack

Actual result

  • The turned back flight is being displayed
  • It is possible to join the turned back United attack
    • When the second joined fleet reaches its destination, nothing happens (no attack occurs, fleet correctly returns to the origin coordinates)
  • In certain cases, there's a left-over record of the turned back United attack, meaning that "United attack" option is now always available

[QUESTION] Setting up stats cron

Hi,
I would like to set up the stats cron job so statistics don't have to be calculated manually.
From my understanding of

autostatbuilder.php (l37 ff)

if (
    (
        !isset($_User['id']) ||
        $_User['id'] <= 0
    ) &&
    !empty(AUTOTOOL_STATBUILDER_PASSWORDHASH) &&
    !empty($_GET['pass']) &&
    md5($_GET['pass']) == AUTOTOOL_STATBUILDER_PASSWORDHASH
) {
    $isAuthorised = true;
}

I should be able to pass a Get variable named 'pass' containing the secretword that I can also find in my config file and should be able to execute the calculation without being signed in (or using a cron job).
However, using the secretword delivers no results.

So the question is: What is "AUTOTOOL_STATBUILDER_PASSWORDHASH"? Where does it get its hash and what password should I use when setting up the cron job?

If you don't mind I would also extend the readme with a manual on how to set up the cron job once I get it running as I feel it is an essential part of the system.

Polish language

Cześć,
Język polski nie działa, ani przy instalacji nie dało się go wybrać, ani po zmianie w bazie danych na pl, ani po zmianie opcji w ustawieniach gry. Wyskakuje komunikat: Unavailable language selected!

Refactor world elements cost calculation code

It looks like a lot of places "manually" calculate world elements (buildings, ships, technologies) costs and other similar derivative values.

To prevent bugs caused by inconsistent implementations and get rid of code duplication, there should be a bunch of shared functions created only for this purpose.

TODO:

  • Create shared cost (and other similar derivative value calculating) getting functions
  • Use these new shared functions throughout the code

Refactor messaging system to allow more flexibility

Summary

Current messaging system is inflexible in terms of how the message arguments can be presented and transformed before presentation to the user. In certain cases, it leads to bugs like #99, where certain piece of the message is "hardcoded" in the sender's message.

The messaging system should be refactored so that every "system message" could be programmatically transformed before being displayed, based on "facts-only" arguments stored as message's arguments. For example, instead of persisting the label of "origin point type" (Planet / Moon), we should be able to store the type's identifier, and then, when the message is about to be displayed, transform that into appropriate label. Not only this will make this more flexible and resitant to bugs, but also may result in a bit of space saving (however, that might be negated by the persistence format, which will most likely change to just JSON; still, space savings are not a priority anymore, at least not that low-level savings).

Related issues or PRs:

Add/Enable language

Hello,

I work on the French translation to help you to finish it and did it for me :)
Can you tell me what I have to modify to add or activate the possibility for players to select this language?

I saw that you had started the French translation (thank you very much) but that it is not activated.

Thanks in advance,
Daeloran

how do i enable expeditions on the engine?

I recently installed the engine and made my game server and I realized that the expeditions to the horizon (planet 16 of each system) are buggy. The ships do not return from the expedition and the resource is not added to the player's account. How do i solve this?

Port minor fixes to the codebase from PR #61

PR #61 is kind of stale because of how much changes I've tried to introduce in a one, big PR, instead of breaking it up into smaller, easier to work on modifications.

To prevent it from getting completely discarded, I'll try to port the fixes and changes in separate, smaller PRs. As of writing of this issue, most of the stuff has been already "reviewed", the only big chunk of code that is still not finished was the Research Lab refactor.

TODO:

  • Merge as much completed stuff from PR #61 to master

Related PRs:

Refactor flight control

Summary

There's a lot of repetition in all steps of the flight control pages' code which can easily be shared for more consistent data flow management. This should reduce possibility of situations where one step is broken, but the previous one which does the same thing is fine.

[BUG] Default value issue after server crash

Problem description

My server went down due to a short power outage. Once it was back up it threw a lot of errors, mostly in the direction of some field not having default values. Example:

Field 'Fleet_Array_Changes' doesn't have a default value

INSERT INTO _fleet_archive
(`Fleet_ID`, `Fleet_Owner`, `Fleet_Mission`, `Fleet_Array`, `Fleet_Time_Send`, `Fleet_Time_Start`, `Fleet_Time_Stay`, `Fleet_Time_End`, `Fleet_Start_ID`, `Fleet_Start_Galaxy`, `Fleet_Start_System`, `Fleet_Start_Planet`, `Fleet_Start_Type`, `Fleet_Start_Res_Metal`, `Fleet_Start_Res_Crystal`, `Fleet_Start_Res_Deuterium`, `Fleet_End_ID`, `Fleet_End_ID_Galaxy`, `Fleet_End_Galaxy`, `Fleet_End_System`, `Fleet_End_Planet`, `Fleet_End_Type`, `Fleet_End_Owner`, `Fleet_ACSID`, `Fleet_Info_HadSameIP_Ever`, `Fleet_Info_HadSameIP_Ever_Filtred`, `Fleet_Info_HadSameIP_OnSend`, `Fleet_Info_UsedTeleport`)
VALUES 
(525, 2, 4, '210,1', 1588597094, 1588597203, 0, 1588597312, 2, 1, 429, 7, 1, 0, 0, 0, '6', '6', 1, 322, 14, 1, '2', '0', false, false, false, 0) 

File: /fleet3.php
User: XXX[2]

The problem first appeared only on the overview.php site, by now it appears on every single site.

What I have tried:
Giving the fields causing the error (Fleet_Array_Changes, building_queue and some more) a default value of NULL. This solves the problem above, however after fleet_archive starts getting filled with NULL default entries for every fleet action I get an error because every insert into query is filled with "!noupt!", which is supposed to be this way according to FlyingFleetHandler.php
if($DataVal === null) { $DataVal = '"!noupd!"'; }
The error disappears when I delete all fleets from the database but occurs again, when fleets either Turn Back or arrive at their destination. After a while all pages show the error listed in the first place.

I can only imagine that the crash caused a query to be cancelled mid-execution, but I was not able to find a fix for it.

Engine details

  • Engine version:
    • version 1.0.0
  • Custom modifications:
    • Yes
    • No
  • Environment:
    • local
    • testing (inaccessible from the outside)
    • production (accessible from the outside world)
  • Configuration:
    • Game speeds
    • Debris settings
    • Any other relevant config entry

Steps to reproduce

Cannot reproduce, but cannot fix

Expected behavior

Fleets get sent correctly, building queues are handled correctly

Actual behavior

Error occurs on every page loaded

Adding a language

Hi recently found this repo and appreciate all the work you put in.
I decided to put some time into a German translation. I have not really worked out the code structure yet, so could you point me to what I'd have to add besides editing the .lang files?

STRICT_TRANS_TABLES

The majority of free hosting website don't allow to change the sql_mode! If you remove this requirement, you are a GOD! :godmode:

Upgrade Recaptcha

The old Recaptcha library doesn't work anymore. It should be upgraded to something newer or completely removed / disabled.

Research/Building page instead of Info in the requirements

Hi Michal,

I want to propose a possible enhancement :

let's assume the following use case:

  • I want build a Death Start ( infos.php?gid=214 )
  • Let's assume that I don't have the Graviton Technology ( infos.php?gid=199 )
  • I'm on the shipyard page ( buildings.php?mode=fleet) , after Death Start selection, would be great if, after the Graviton Technology selection, I'm forwarded directly to the research page (buildings.php?mode=research) instead of the info page (infos.php?gid=199) : in this way is possible directly research what is needed and the clicks are minimized. This is very useful in case the user is from Mobile.

What do you think?

Regards,
Alfredo.

Add more events to expeditions

Request background

In #123 the new and rewritten expeditions system has been merged into master. However, it brought only two, rather not exciting expedition events: "nothing found" and "resources found". There should be more of these events to make expeditions more entertaining for the players.

Proposed event types:

  • Complete fleet destruction
  • Fight against random enemy forces (weak / similar power / stronger than the player)
    • These fights should somehow contribute to player's statistics
  • Recoverable ships found
  • Dark energy found
  • Nothing found & fleet comes back much later

Related issues or PRs:

[BUG] System Error! An Error occured! Error ID: xx

Problem description

After a fresh install of the first universe and after a restart of the server or of the Apache service we get the error "

System Error! An Error occured!" on the overview page.

I've checked the error.log of mysql and apache and found an error on apache's logs.

image

I didn't modify files yet.

Engine details

  • Engine version:
    • `version 1.0.0
    • commit COMMIT_HASH (sorry I don't know where to find it)
  • Custom modifications:
    • Yes
    • No
  • Environment:
    • local
    • testing (inaccessible from the outside)
    • production (accessible from the outside world)
  • Configuration:
    • Game speeds: 1
    • Debris settings: 50
    • Any other relevant config entry

Steps to reproduce

Prerequisites:
Do a fresh install on a debian
Mariadb latest
PHP 7.3
Restart the server after create a Universe

image

Desktop:

  • OS: Windows 10
  • Browser: Edge, Opera, Firefox
  • Version: latests

Thank you for your Help

Refactor Battle Engine (ARES)

Summary

There's a lot of repetition in Battle Engine's code which can easily be shared for both defenders & attackers calculations. This should make it easier to modify the engine in the future.

Also, it's probably time to remove the old engines as well. Let's be honest, no one is going to adjust them to use the same interface as "ARES".

Project's structure reorganisation

Currently there's a huge mess, files / directories non related to the source code being placed alongside of all the sources. Stuff like that. This needs to be fixed.

TODO:

  • Source code should reside in src/ directory.
  • All "datastores" directories should be outside of source directory.
  • Get rid of index.php files that were supposed to stop people from snooping on source code. Rely on webservers "doing the right thing" instead (eg. nginx disabling indexing).
  • ajax/ & admin/ dirs should be placed in PHP's code storage (somehow)
  • All source files should be "per module / per feature" co-located (eg. galaxy view PHP sources should be in the same directory as its template(s))

Stop using "eval" for resource-related calculations

Currently, all resource-related calculations (income, energy production & usage) are performed using functions defined as strings, which are then evaluated using eval function. This is just... wrong and terrible, and should be replaced with functions (most likely lambdas).

Chrome toolbar color

Hi @mdziekon

this is not an issue but only a suggestion. I added on my Env. the <meta name="theme-color" content="#022451"> to files :

templates/default_template/game_main_body_simple.tpl
templates/default_template/game_main_body.tpl

With that is possible set the toolbar color customized. Is more cool from mobile :)

Regards,
Alfredo.

Message Spoofing

I've found a way to message other users pretending to be another user via the message.php file. Any way to block this? It's done by getting the ID of the user and changing the mode ID from 1 (Admin) to any ID of any user. Anyway this can be fixed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.