iopietro / Travianz-Legacy

Join our Discord Server: https://discordapp.com/invite/9fbJKP9 | New repo: https://github.com/iopietro/Travianz
GNU General Public License v3.0
160 stars 94 forks source link

Tasks for TravianZ Version 8.3.5 #544

Open Shadowss opened 6 years ago

Shadowss commented 6 years ago

Hello guys,

That tasks remain to fix from version after release 8.3.4

System / Automatic Enforced Game Rules

The following things are automatically enforced by the system. Therefore it is no longer possible that you get banned for sending too many resources or friendly conquering / attacking another village: the system will simply not allow you to do this. Automatic Pushing Protection

To get rid of the complete pushing (= excessive resource transfers) section in the rules we developed the below described automatic pushing protection system.

The limitations to the amount of resources a player may send to another one are now hard coded. Therefore it is no longer possible that you get banned for sending too many resources: the system will simply not allow you to do this.

The limitations are complicated and connected to the relationship between the accounts in question.

The different connection types are:

Type 1 Players were not sitters and have not used the same computer or the same network (IP) recently.
Type 2 Players have been sitters recently or have used the same network (IP).
Type 3 Players are currently sitters or used the same PC recently.

Additionally 6 transfer categories exist:

Resource transfers to a bigger player
Resource transfers to a smaller player
Resource transfers to a bigger player to feed own reinforcements
Resource transfers to a smaller player to feed own reinforcements
Raiding a bigger player
Raiding a smaller player

Hourly production

All limitations are based in the hourly production. The resources produced in an hour are calculated by summing up the production of lumber, clay, iron and crop (all crop produced minus the inhabitants of your account) for the complete account. Furthermore one hour of the last week's average net raiding (raiding income - resources lost by being raided) is added to give the hourly production for the account.

Possible combinations of resources:

If the resource transfers are limited to crop (e.g. feeding of reinforcements or supplying artefact villages) resource transfers which include other resources than crop may not be possible. Therefore you have to take care about the combination of resources you try to send away.

Sending resources in advance:

In some cases it is allowed to send resources for some days in advance. For example if you are allowed to send 7 days in advance, you could send the sum of the hourly production from Monday till Sunday all at once.

Rules for connection type 1

can send 2 production hours to bigger player (7 days in advance) but nothing if your account is smaller than 50 population
can send 3 production hours to smaller player (7 days in advance) but nothing if your account is smaller than 50 population
can send 150% crop consumed by your troops reinforcing the other player (100% for 24h in advance)
can send 300% crop consumed by your troops reinforcing the other player (100% for 24h in advance)
can raid bigger player unlimited (when in the same alliance §2 in this section applies)
can raid smaller player unlimited (when in the same alliance §1 in this section applies)

Rules for connection type 2

can send 1 production hours to bigger player (3 days in advance) but nothing if your account is smaller than 50 population
can send 2 production hours to smaller player (3 days in advance) but nothing if your account is smaller than 50 population
can send 125% crop consumed by your troops reinforcing the other player (100% for 12h in advance)
can send 150% crop consumed by your troops reinforcing the other player (100% for 12h in advance)
can raid bigger player unlimited (when in the same alliance §2 in this section applies)
raiding a smaller player is limited by §1 in this section

Rules for connection type 3

cannot send anything to bigger player, bigger player needs to send first
can send 2 hours production to smaller player (1 days in advance) but nothing if your account is smaller than 50 population
can send 100% crop consumed by your troops reinforcing the other player (100% for 6h in advance if the transfers are only crop)
can send 100% crop consumed by your troops reinforcing the other player (100% for 12h in advance if the transfers are only crop)
can raid bigger limited by §2 in this section
can raid smaller limited by §1 in this section
cannot raid villages that have been sent resources in the last 6h by a player you have connection type 3 with

Exceptions

Wonder of the World villages can be supplied unlimited.
Wonder of the World villages can be attacked and reinforced unlimited.
Artefact villages can be supplied with CROP unlimited.
Marketplace trades: If the trade balance (without raid and supply) is within 20% a trade is always possible.

Automatic Conquering Protection

The conquering limitations are also hard coded.

These limitations are not that complicated but also connected to the relationship between the accounts in question.

The different connection types are:

Type 1 Players were not sitters and have not used the same computer or the same network (IP) recently.
Type 2 Players have been sitters recently or have used the same network (IP).
Type 3 Players are currently sitters or used the same PC recently.

Rules for connection type 1

can conquer village when both players have not been in the same or an allied alliance within the last 2 days AND both players are not currently in alliances that have NAP with each others

Rules for connection type 2

can conquer village when there has been NO active sitter connection within the last 14 days AND both players have not been in the same or an allied alliance within the last 2 days AND both players are not currently in alliances that have NAP with each others

Rules for connection type 3

can NOT conquer village of each other

Exceptions

Wonder of the World villages can always be conquered as long as they are not the last village of the defender.
Artefact villages can always be conquered as long as they are not the last village or the capital of the defender.
eliopinho commented 6 years ago

@Shadowss update new files on a test server to start testing

Shadowss commented 6 years ago

All files has been updated today. All query are already executed in database. So is up to date.

iopietro commented 6 years ago

I removed "The forum alliance is completely hackable" because I forgot to tick it in the previous post. Also I removed every bugs you posted here from the previous post (to not have duplicates).

Shadowss commented 6 years ago

Great ! I think first task is the hardest... I look forward for complete this 👍

iopietro commented 6 years ago

Me too, it'll be the first one I'll complete, I already prepared the Automation class for the separation process.

velhbxtyrj commented 6 years ago

Still there is one problem related to the alliance. When a player automatically drops out of the alliance (perhaps this is due to some rights of access to the management of the alliance), upon re-acceptance, it automatically receives the previously assigned access rights to the management. In the admin panel in the Alliance: Alliance Positions section, it is listed as a member of the alliance, although it is not.

Perhaps when exit the alliance, also lose the rights to manage the alliance? This is due to the innovation in the alliance, when the embassy is destroyed, the player automatically withdraws from the alliance.

iopietro commented 6 years ago

You're right, if an alliance member is kicked or leave the alliance, his permissions (related to that alliance) should also be removed.

iopietro commented 6 years ago

In the latest commit (f41666cabc07315372b0d6c8d0ee00cd257f4cee) I've separated Automation.php from the UI and users classes (Village.php, Building.php, etc.), it's only a test, I wanna know if everything works fine.

Try it by playing normally, every one second the Automation.php file will be called through a recursive JS function.

Let me know the results of your test and tell me if you'll notice a faster pages reload time.

Shadowss commented 6 years ago

Server updated !

Oh my GOD !

Calculated in 93 ms Calculated in 49 ms Calculated in 66 ms Calculated in 102 ms - Main building Calculated in 28 ms - training troops

TerraSkye commented 6 years ago

@iopietro but every player online will now call the same page every 1 second. the automation should be handled by a cron. wich restart every minute. and runs for only 60 seconds.

Shadowss commented 6 years ago

@TerraSkye : on original Travian , automation is not run by cronjobs ! @iopietro : i receive this message on the game

catapults

iopietro commented 6 years ago

@shadowss, was it before or after the new automation? What did they mean with "catapults" are glitching the whole game?

@TerraSkye, I said many times that's only a test, I've better solutions to handle the whole automation.

Also, you can't refresh the whole automation every 60 seconds. Every attack/construction finished will have a delay of about 60 seconds.

velhbxtyrj commented 6 years ago

At me in general time of an attack after the expiration has gone to a minus.

Shadowss commented 6 years ago

@iopietro : that`s the whole message. Let me ask him.

I receive a screen. And an answer : of course, just a sec, and my troops are not returning back anymore somehow.

  1. https://imgur.com/a/W3YEUcs
  2. https://imgur.com/a/y4EjqGo

I update the server in this morning at 7:51:41 o'clock Romanian HOUR

He attack at 08:20:03 today, so yes , it`s on new automation

iopietro commented 6 years ago

Do you have some recent errors in your error log file?

If the time goes to a minus value, is because there's an error somewhere because the method "sendUnitsComplete" doesn't get executed.

It could happens even because you've JS disabled on your browser and you're the only one online.

iopietro commented 6 years ago

The server is 1 hour above my actual time zone. Is the server time equal to the Romanian time zone?

eliopinho commented 6 years ago

@iopietro im really impressed by the speed of reloading... very amazing :+1:

iopietro commented 6 years ago

Yep, the loading speed of pages is really good now, but I've to resolve some bug that caused by the new automation system.

Shadowss commented 6 years ago

EDITED. POST TOO LONG

iopietro commented 6 years ago

Ok, I'll fix it as soon as I can.

iopietro commented 6 years ago

Fixed in: fca22ac98b86cbe4610575e60303399fe9c8bd18. Troops are still doubling (attacks will be performed 2 times in a row sometimes) and this is good, it's a good opportunity to finally fix the doubling troops bug.

@Shadowss, you can update your server.

Shadowss commented 6 years ago

@iopietro : Server updated.

Double troops bug dissapear when i change database to InnoDB and from NULL to NOT NULL

There are back again ??

iopietro commented 6 years ago

Yep, it never disappeared, it's because 2 (or more) users can execute the method "sendUnitsComplete" at the same time. To fix this bug, we need a bettere "lock" system.

Shadowss commented 6 years ago

I changed all in database from unsigned to signed. But you know better than me 💃

IonCube explain me this :

As you can see, unsigned has minimum value of ZERO (NULL, 0) and if it goes below 0 it will go to max value 4294967295 - OVERFLOWED_VALUE , this is why you have many troops. Looking at PHP doc's (PHP: Integers - Manual), Unsigned integer is NOT supported but can be parsed.

function parse_unsigned_int($string) { $x = (float)$string; if ($x > (float)2147483647) $x -= (float)"4294967296"; return (int)$x; }

So best option would be just checking for values that go below 0 => make them to NULL and change unsigned to signed data type. This is the main reason why no one is developing Travian, only few private developers understand this. Someone will make a patch for the SQL that could fix everything.

iopietro commented 6 years ago

Yes, but that was another bug, generated by overflowing an unsigned integer (by trying to bring it to -1, but it's not possible for an unsigned integer, so it will be assigned to the maximum integer 32 value = 4294967295).

The doubling troops bug is a different bug, caused by calling the method "sendUnitsComplete" at the same time by two or more users. This shouldn't be possible with our actual lock system, but it presents some fallacy, so we need to use a better lock system.

The "lock" term is used in multithreading applications, you have to use a lock when you don't want that two or more threads access to the same instructions at the same time. In our case, we have to prevent two or more different users to access to the same method, at the same time.

iopietro commented 6 years ago

I removed the timer, because with this code, it caused too much load to the server. Automation.php will be now called only once for page refresh.

iopietro commented 6 years ago

Fixed in 8605996533f5aa7b7e0c7ecf4fc6633859f7ffad. @Shadowss update your server :).

With the rework of the "lock" system I should have resolved a lot of problem related to "two or more users trying to access to the same method".

Shadowss commented 6 years ago

Update done.

Someone on game send me bugs :))))

https://imgur.com/a/EKb6h8n

@iopietro : time bug remain active in building

eliopinho commented 6 years ago

@iopietro @Shadowss

units searched desapered and cant search again in academy...

looking for more ;) btw : amazing job @iopietro and all of us helping :+1: this was gona stay the best version at this rate :1st_place_medal:

Shadowss commented 6 years ago

EDIT. POST TOO LONG

Shadowss commented 6 years ago

I mention i already try to remove /* from index.php line 29 ...

iopietro commented 6 years ago

Try to do a clean installation: delete all files (or overwrite them with the new ones), delete all tables on the database and then install the server.

iopietro commented 6 years ago

The reported bugs were caused by the doubling troops bug, the new lock system wasn't present yesterday and it should have fixed them.

Shadowss commented 6 years ago

I delete all files and database. And recreate all. Same error = blank page

velhbxtyrj commented 6 years ago

Should this item not be an additional option that can be turned on or off?

Issue #304 must to be fixed. Points must go on troops owner not on what player defend

iopietro commented 6 years ago

Yep, it is, that feature is available in Travian: Fire and Sand/Legend and Travian Kingdom.

velhbxtyrj commented 6 years ago

So we have a travian T3.6 and as far as I can remember the points were distributed exactly to one player who was attacked.

iopietro commented 6 years ago

Yes, only the defender gained points, the other players gained nothing.

iopietro commented 6 years ago

@Shadowss, I reinstalled my local server and everything works fine (after deleting all database tables, config.php file and var/installed file), so I don't know.

eliopinho commented 6 years ago

@Shadowss

1- verify your software versions httpd / database server / PHP (specially if you have all modules necessary to it) !!!!!!!! (@iopietro little description wich modules are required!? )

2- via command drop all database and user create new database and assign a new user to it with all permissions. after that flush all previlieges

3- make sure you do not have any files on html folder including files start with .file1 .file2 etc... rm -R /allfileandfolder/*

4- copy new content

5- apply new permissions! chmod -R 777 /filesandfolder/

6- owner!! chown -R www-data:www-data /travianfilesroot/

Shadowss commented 6 years ago

Fixed

iopietro commented 6 years ago

I advice you to make it x500, so people can rebuild their villages faster (to test things).

Shadowss commented 6 years ago

Done.

@iopietro : cannot Assign a possition is blank where must appear my name (on alliance)

@iopietro : enter on my account (same pass) and try to attack oasis (0|2) to see what`s happend.

iopietro commented 6 years ago

But it's 50x, I said x500 :).

Shadowss commented 6 years ago

Yes I know. You can modify yourself. You are admin. I'm not at home

iopietro commented 6 years ago

Ok, thanks :), I didn't see it.

velhbxtyrj commented 6 years ago

There is one idea. How do you look at showing in the game instruction the information about the fact that new innovations have been added to the server? For example, if we have an ordinary T3.6 on the server without the additional functions included, then it will look like usual:

default

But if we include at least one of the new functions, then we see already the following content:

default

By clicking on this link we will see only those functions that are currently enabled on the server:

default

Going by any of the links, we see the description of the function itself:

default

iopietro commented 6 years ago

Yeah, that's a good idea :)!

velhbxtyrj commented 6 years ago

Just so will be the opportunity to introduce players to the new that is implemented on a particular server. And the player reading this information will not ask a question about why in the original Travian it works quite differently than on your server? Also, we can add some information to the newsbox that the server includes new features.

default

iopietro commented 6 years ago

Yes, that's why it's a good idea. Yeah we can do it, maybe we should write every new feature enabled/disabled.