yavl / teeworlds-infclassR

Slightly modified version of official InfClass
Other
10 stars 4 forks source link

added print_idcount command to print how many ids are currently used #111

Closed duralakun closed 5 years ago

duralakun commented 5 years ago

This allows you type "print_idcount" into rcon console and the server prints how many entity ids are currently used. We need this to better debug issues related to entity ids, like #109

The output will look like this:

IDCount: 53 - InPercent: 0%

Percent shows how many percent of all ids are currently used, if it reaches 100% it might crash

duralakun commented 5 years ago

As server administrator, i don't need this command. There is no way i can act as an administrator when i see something wrong with the output.

As server administrator if you see the entity count is very high, you can restart the server and prevent a crash

duralakun commented 5 years ago

Could we please have this not as a command, but as a debug printout? Something like:

#ifdef DEBUG
Console()->print(get_number_of_ids());
#endif

This can happen every 10, 100 or 1000 tick.

Most of the time you dont want to see this, when debugging its also important that the console doesnt get spammed with unimportant information.

Could we please have this not as a command

This command does no harm, why dont you want to have more commands?

duralakun commented 5 years ago

With this command you can also check for id leaks better, for example: you write "print_idcount" then you place 2 scientist mines write "print_idcount" again then you die and write "print_idcount" now you can compare the first number with the last, they should be the same

bretonium commented 5 years ago

As server administrator if you see the entity count is very high, you can restart the server and prevent a crash

As server administrator, i

  1. Do not monitor server state using administrative commands
  2. Will not restart the server even if i see high values

Most of the time you dont want to see this, when debugging its also important that the console doesnt get spammed with unimportant information.

Debug logs are always very verbose. It is ok and accepted in all projects. For example, because of debug, logs for the project i work on are 100+ mb daily. grep and search in less handle it just fine.

This command does no harm, why dont you want to have more commands?

Because this command has no value to an administrator. This is code-specific, developer-focused information. Information like this belongs to debug logs. We can add hundreds of "harmless" commands, none of which will be of any value to administrator.

With this command you also check for id leaks better, for example: ... now you can compare the first number with the last, they should be the same

This is debugging of the game. Server administrators do not debug programs. Developers do. All the same information can be obtained from debugging logs.

teoman002 commented 5 years ago

Duralakun, I suggest to you to leave this feature as is, contrary to Breton I think it is very important to have a tool that show ID-Leaks.

However, please provide a debug output in the logfiles. I really look forward to see that. Make sure, the command is called after each round.

duralakun commented 5 years ago

I thought about making it so that it outputs the id count in the terminal as soon as a wrong id crashes the server. But i dont want to do it anymore, you can use this pr or close it, idc anymore.