1

Topic: [REQUEST] Automatic high ping players kick [c++ help needed]

I don't know if it's possible to enable the server to kick high ping players through players.cpp ,
but it seems very easy..

{
        CLIENT_INFO info;
        if(server_getclientinfo(client_id, &info))
        {
            latency.accum += info.latency;
            latency.accum_max = max(latency.accum_max, info.latency);
            latency.accum_min = min(latency.accum_min, info.latency);
        }

        if(server_tick()%server_tickspeed() == 0)
        {
            latency.avg = latency.accum/server_tickspeed();
            latency.max = latency.accum_max;
            latency.min = latency.accum_min;
            latency.accum = 0;
            latency.accum_min = 1000;
            latency.accum_max = 0;
        }
    }

Is it possible to add a line somewhere there which disconnects players with a certain ping?
Maybe this ping limit could be a setting in the configs? any1 got an idea how i can do this?

2

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

Let them playing... hope nobody will help you doing this crappy feature.

Not Luck, Just Magic.

3 (edited by Lanta 2010-07-15 18:19:09)

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

If you know just a little of C do it yourself. Is that hard?

PS: i remember you you have to change also the gametype because that's no more vanilla Teeworlds.

Support Staff - ESL.eu Teeworlds Admin

4

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

Ok thirst of all Dune, why would i want silly comments " let them play " would you want players wasting player spots who cant even move around because of 1000 ping????? dont tell me its a crappy feature... maximum ping i would say 400..

And Lanta im asking for help, im not saying i can do it..

5 (edited by Lanta 2010-07-15 21:33:52)

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

Silentdeaths wrote:

Ok thirst of all Dune, why would i want silly comments " let them play " would you want players wasting player spots who cant even move around because of 1000 ping????? dont tell me its a crappy feature... maximum ping i would say 400..

And Lanta im asking for help, im not saying i can do it..

Some connection goes to 1000 for just a second, them come back to something sane (40-50)... how can you select players to kick? You will need something like an average ping value...
By the way, it's just useless since there is the votekick... yeah, like you defined it "a crappy feature".
You are not asking for help, you are asking us to code it... that's different. If you want your mod, do it yourself and, if you can't, open a C book and start studying. That's not called "HELP", that's called "MOD IDEA"

Support Staff - ESL.eu Teeworlds Admin

6

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

in my opinion his idea is pretty good
@Lanta i think, he can programm that the ping should be 4 seconds, or sth like that ,very high to be kicked

dont be hard with me:i am just a softdrink xD

7

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

I don't think that it is right to kick players who has high ping. Let them play!

8

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

FreshCola wrote:

in my opinion his idea is pretty good
@Lanta i think, he can programm that the ping should be 4 seconds, or sth like that ,very high to be kicked

The server already kicks people that are timing out.
And omg, don't kick people with ping higher than 400, force them to spec I don't know...

Not Luck, Just Magic.

9

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

KillaBilla wrote:

@3da: People with high pings let the server lag more and so there is less fun for the others, also if they are again and again shouting "OMG Laaaaaaaagggggg". wink

The ping of others dont effect other Players!

b2t: I think its a bad idea to kick those players. They maybe just want to have fun playing tw. As surprising as it sounds... those players can have fun with such a high ping and since it doesnt effect other players, it shouldnt be a problem ti just let them play.

I guess nobody is going to write sucht a mod for you wink

uptee - a simple web interface for hosting and maintaining teeworlds servers
teerace - a website gathering results of trusted Race-mod servers providing global ranking and statistics
*gV* rox ^^

10

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

Guys u dont understand.. i live in south africa.. South African server's can not handle players from overseas, they get constant pings of 1000, and i do know how to code, im asking for 1 sentence THATS ALL,

how can it be fun to play, if u can not move????? all you see is you respawning, you guys may like a free practise dummy on your servers, but i dont okay?

11

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

Only a very limited number of persons will be able to access your server, only people from your country, your friend... so just put a password smile

Not Luck, Just Magic.

12

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

LOL, the most selfish request of the day ?!

why do you want to kick them?
they do not affect your playing experience nor they lag the server like some think!

if you are looking for support for DDRace, please go to http://DDRace.info.

13

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

Silentdeaths wrote:

Guys u dont understand.. i live in south africa.. South African server's can not handle players from overseas, they get constant pings of 1000, and i do know how to code, im asking for 1 sentence THATS ALL,

how can it be fun to play, if u can not move????? all you see is you respawning, you guys may like a free practise dummy on your servers, but i dont okay?

I think players who can't play will either spectate or leave.

14

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

Silentdeaths wrote:

Guys u dont understand.. i live in south africa.. South African server's can not handle players from overseas, they get constant pings of 1000, and i do know how to code, im asking for 1 sentence THATS ALL,

how can it be fun to play, if u can not move????? all you see is you respawning, you guys may like a free practise dummy on your servers, but i dont okay?

Finaly here is the code, change the gametype of the server you are not allowed to use DM, TDM oder CTF.

***** Add in variables.hpp:

MACRO_CONFIG_INT(sv_highpingkick, 1, 0, 1, CFGFLAG_SERVER, "Enable (1) or disable (0) kicking players with high ping")
MACRO_CONFIG_INT(sv_highpingkick_maxping, 400, 0, 1000, CFGFLAG_SERVER, "Max ping")
MACRO_CONFIG_INT(sv_highpingkick_waitingtime, 5000, 1000, 999999, CFGFLAG_SERVER, "Time to wait before kicking the player (ms, 1000 ms = 1 s)")

***** Add in game/server/player.hpp:

int highpingtick;
int start_tick;

after

void on_disconnect();

***** Add in game/server/player.cpp:

this->highpingtick = 0;
this->start_tick = 250;

after

this->client_id = client_id;

***** In game/server/player.cpp replace the PLAYER::tick() function with this here :

void PLAYER::tick()
{
    server_setclientscore(client_id, score);

    // do latency stuff
    {
        CLIENT_INFO info;
        if(server_getclientinfo(client_id, &info))
        {
            latency.accum += info.latency;
            latency.accum_max = max(latency.accum_max, info.latency);
            latency.accum_min = min(latency.accum_min, info.latency);
        }

        if(server_tick()%server_tickspeed() == 0)
        {
            latency.avg = latency.accum/server_tickspeed();
            latency.max = latency.accum_max;
            latency.min = latency.accum_min;
            latency.accum = 0;
            latency.accum_min = 1000;
            latency.accum_max = 0;
        }
    }

    if(start_tick > 0)
        start_tick--;

    char buf1[256];
    char buf2[256];
    char buf3[256];

    if(config.sv_highpingkick && latency.min >= config.sv_highpingkick_maxping && start_tick == 0)
    {
        str_format(buf1, sizeof(buf1), "W A R N I N G\nYour ping is higher than %d!\nFix it or you will be kicked in %2.2f Seconds!", config.sv_highpingkick_maxping, config.sv_highpingkick_waitingtime/1000.0-highpingtick/50.0);
        game.send_broadcast(buf1, client_id);
        highpingtick++;
    }
    else
    {
        if(highpingtick > 0 && start_tick == 0)
            game.send_broadcast("Ping fixed!", client_id);
        highpingtick = 0;
    }

    if(highpingtick/50.0*1000.0 >= config.sv_highpingkick_waitingtime)
    {
        str_format(buf2, sizeof(buf2), "%s got kicked due to a too high ping. (%d)", server_clientname(client_id), latency.min);
        game.send_chat_target(-1, buf2);
        str_format(buf3, sizeof(buf3), "You got kicked due to a to high ping. (%d)", latency.min);
        server_kick(client_id, buf3);
        return;
    }
    
    if(!character && die_tick+server_tickspeed()*3 <= server_tick())
        spawning = true;

    if(character)
    {
        if(character->alive)
        {
            view_pos = character->pos;
        }
        else
        {
            delete character;
            character = 0;
        }
    }
    else if(spawning && respawn_tick <= server_tick())
        try_respawn();
}

This should be all, if you really want to do this.
And dont forget to change the gametype!

15

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

isn't it easier to just make a patch? i think thats a bit easier then copy & pasting tongue

How to compile on windows
~~~ You may NOT edit, or use my work without asking permission at the topic of my work ~~~
if(!game.players[massdestruction]->get_character()) { game.send_chat_target(massdestruction, "You ever gonna learn to aim?") }

16

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

I guess nobody is going to write sucht a mod for you

That's sad, but there's always a guy that don't understand what means providing such a code.

And MassDestruction, you're asking us to provide programming support, most of us disagree with your project, some guy give you the code... at least don't ask them to do all the job for you -.-

Not Luck, Just Magic.

17

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

I think it's a pretty good idea and also absolutely reasonable... When I have 100+ ping, the game is not playable at all. I agree it also ruins the game experience for others. Many online games has this feature.

I'm not yet familiar with the TeeWorlds source, but basically you just would have to measure the clients' pings for a while (say 10 sec) to rule out the players who should be kicked or moved to spectator mode. Also an average of his pings can help to decide it.

Cheers,
easy

18

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

MassDestruction wrote:

isn't it easier to just make a patch? i think thats a bit easier then copy & pasting tongue

No, I've only put this feature in another mod.


Dune wrote:

That's sad, but there's always a guy that don't understand what means providing such a code.

And MassDestruction, you're asking us to provide programming support, most of us disagree with your project, some guy give you the code... at least don't ask them to do all the job for you -.-

He didn't ask me, I've already got the code for somebody else who want to get something like "Automated Server" but he never want's to get the code. Where is ther problem in providing this?


easy wrote:

I think it's a pretty good idea and also absolutely reasonable... When I have 100+ ping, the game is not playable at all. I agree it also ruins the game experience for others. Many online games has this feature.

I'm not yet familiar with the TeeWorlds source, but basically you just would have to measure the clients' pings for a while (say 10 sec) to rule out the players who should be kicked or moved to spectator mode. Also an average of his pings can help to decide it.

Year, most Call of Duty and Counter Strike Servers have this feature.
With the code if posted you can do this. Only moving to spectator isn't done.

19

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

I agree it also ruins the game experience for others. Many online games has this feature.

And NOT Teeworlds. You can see in the serverlist the ping of servers and choose to do not join a 500-ping server... and noobs don't speak nor 'ruin the game'...

He didn't ask me, I've already got the code for somebody else who want to get something like "Automated Server" but he never want's to get the code. Where is ther problem in providing this?

He asked the community, and even if you didn't code it, you provided him code. It's the same.

Not Luck, Just Magic.

20

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

thank you very much killa

21

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

I really don't see what the fuss is all about, this request seems pretty legitimate to me (more than most modding requests). Of course it has to be well thought to avoid kicking players simply for a short lag-spike.

22

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

Magnet wrote:

I really don't see what the fuss is all about, this request seems pretty legitimate to me (more than most modding requests). Of course it has to be well thought to avoid kicking players simply for a short lag-spike.

You can't just kick high ping players because of their location. It's not like they can move. They don't affect the gameplay experience either. It is discrimination.

Ex-King of Teeworlds

23 (edited by Kottizen 2010-07-29 11:58:54)

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

I agree with yemDX, the highpingers have all right to play.

24

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

easy wrote:

When I have 100+ ping, the game is not playable at all.


Definetely disagree, i have permanent 100+ ping and i can play vanilla and race properly without any problems... Let the players decide themselves whether they can or cant play at their ping.

25

Re: [REQUEST] Automatic high ping players kick [c++ help needed]

With 200 ping, I can play fine (vanilla, maybe because i've been playing with 200 for a few years) . This feature is just to lower the number of people in the servers, which really sucks.