Digital Paint Discussion Board

Paintball 2: The Game => Paintball 2 Discussion => Topic started by: sk89q on December 23, 2007, 01:44:00 AM

Title: !vote, !rules, and other commands on my server -- custom console commands
Post by: sk89q on December 23, 2007, 01:44:00 AM
I'm testing out custom console commands on one of my Paintball servers. I made no modification to the game source.

paintball2://64.27.12.194:27921

* It works most of the time, but occasionally the client may refuse all the print messages from the server
* Name changes will stop it from working for you
* If your name ends in :, you're just out of luck
* A few other issues

Doing votes is possible with this, but at the speed in which the console scrolls sometimes, it's not too feasible.

(http://img170.imageshack.us/img170/497/sshot151gn8.jpg)
(http://img341.imageshack.us/img341/9079/sshot152ez4.jpg)
(http://img341.imageshack.us/img341/9693/sshot153dc9.jpg)
(http://img341.imageshack.us/img341/2751/sshot154bx3.jpg)
Title: Re: Custom console commands
Post by: Eiii on December 23, 2007, 01:58:50 AM
I luv you. So much.

<3

So anyway, if you could just echo that there's a vote going on every 15 seconds, it could work. Does this show up in the chat box? I assume not. That's kinda an issue.
Title: Re: Custom console commands
Post by: sk89q on December 23, 2007, 02:01:12 AM
The messages only show up for the user it's intended for. It will, however, show up in the chat box, so the user doesn't have to be in the console to see the messages.
Title: Re: Custom console commands
Post by: Eiii on December 23, 2007, 02:13:03 AM
Okay, that could work then. The vote notification messages just need to be intended for all users. ;)
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: sk89q on December 23, 2007, 02:04:23 PM
When you join:

(http://img505.imageshack.us/img505/7836/sshot159zq8.jpg)

=========

I have basic votes going:

(http://img299.imageshack.us/img299/1820/sshot155nq0.jpg)
(http://img299.imageshack.us/img299/673/sshot156ck3.jpg)
(http://img299.imageshack.us/img299/8435/sshot157hx3.jpg)
(http://img299.imageshack.us/img299/2209/sshot158ju6.jpg)

=========

I am currently investigating how reliable these messages are.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: Cobo on December 23, 2007, 04:09:25 PM
Nice, how did you make it work without modifing the game source tho? Or did you mean you modified the client but not the server code?
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: sk89q on December 23, 2007, 04:26:35 PM
Connectionless print UDP packet. But, not all the messages get through the server, since the packet isn't coming from the server's port (and clearly I can't bind to it), I don't know how well firewalls/routers are "poking a hole" in themselves for the packet, but then again, it might be because of the client that's dropping the messages.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: XtremeBain on December 23, 2007, 06:19:42 PM
Use one of the existing functions to print that text to the client.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: sk89q on December 23, 2007, 06:33:11 PM
I'm not aware of any function that prints text to the client from the server, without modifying the source. :3
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: XtremeBain on December 23, 2007, 06:40:30 PM
Oh wait.... this is all being done externally.  You're allowed to modified the server's source as you please, it doesn't have any kind of checksuming on it that prevents it from being listed in public.  All the PBCup servers I ran hade modified source (for things like auto-record, and specinvites) without any problems.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: Justinph5 on December 23, 2007, 07:05:22 PM
thats pretty cool, it'd be cool if you could make a !specinvite for spec'ing members of your team...      (altho I don't know what it would do) I just thought of it cuz Bain mentioned it   ;D
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: sk89q on December 23, 2007, 07:25:31 PM
As much as I can modify the source, I can't get it compiled and running on my server. It appears compiling for amd64 has been a headache for me, and compiling it on i386 and using compatibility libraries for amd64 requires I sync lib versions with my development system, and that's a pain.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: Hades on December 23, 2007, 08:50:26 PM
Did you enable tripping on your server?  Bain and I were playing on Shreds and even though I lag out every 15 seconds everyone else was having the problems .  There was constant hiccups all over the place on that map.  Dunno about others cause have shown it the cold shoulder since that experience.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: sk89q on December 23, 2007, 09:11:13 PM
I wasn't sure if that was just with me or something. Earlier, I was experiencing too -- jumps were hitting some "ceiling" that did not exist. The odd thing was, at least on ub_rooftop, going towards a ramp from one side had no problem, but going towards it from the other side gave the issue consistently. Tripping is off; I checked it earlier.

==

EDIT: It appears to happen with b20 for me. B19 doesn't have this problem on my server.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: KnacK on December 23, 2007, 09:24:39 PM
its an issue wit hthe new nix 20 code.  SOmething about math fucntions being fubard.

Jits is aware of the issue.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: sk89q on December 23, 2007, 09:26:11 PM
Yeah, I read =( Oh well.

I downgraded the public server to b19.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: Cobo on December 23, 2007, 10:48:48 PM
I once wanted to do something like this with dp2 through the source, I wasnt able to do it back then.
I'm pretty sure I could do it now tho, since I was able to make a server filter out a list of custom words defined in a file from the chat messages, which is similar to what I wanted to do. And since I didnt had acces to the server code, all of this had to be done through the client code... Even though it would be so much easier to do through the server code...
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: lekky on December 26, 2007, 07:42:03 PM
very nice sk89q :)
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: sk89q on December 26, 2007, 11:54:59 PM
Well, the project is a bust. I cannot get the messages to send reliably, and I do not know why. Packet sniffing on my computer does not show that my computer gets these messages, and this problem appears for other people. I was working on some C code to do the personal messages via the server code itself, but it will not compile and run correctly on my server, so I can't do that either.

However, since it seems to work most well right when you first join, my server still says HAPPY NEW YEAR or something when you connect :D, and I changed the after-game K/D, top streak, etc. info to use regular console messages.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: jitspoe on December 27, 2007, 01:54:14 AM
Not sure if this helps: The packets include a "qport" - a random number assigned so that the q2 engine knows what packet goes with what client when the network starts screwing with the addresses and ports.  If you read that out of each packet, you should be able to keep track of what ip/port goes to a specific client.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: sk89q on December 27, 2007, 02:33:36 AM
I can get the IP/port from when they connect, so that's (mostly) not a problem, but sending a connectionless print message to that IP/port is not working out too well.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: DaRkNeSS on December 27, 2007, 11:13:50 PM
Nice work, reminds me of the commands you can use in Counter-Strike servers.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: coLa on December 27, 2007, 11:23:43 PM
also in warsow. i'd love to see these implemented.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: DaRkNeSS on December 28, 2007, 12:31:17 AM
As would I cola.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: WarWulf on December 31, 2007, 05:13:57 AM
i allways like it when someone makes something useful for dp :)

spectacular job :)
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: KnacK on December 31, 2007, 08:32:14 AM
sk89q,

THe k/d bug is pretty consistant that we talked about earlier. It's more like a d/k ratio.  Maybe your division is backwards?
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: sk89q on December 31, 2007, 09:25:50 PM
Well, the K/D returns correctly. It comes from my StdLog parser class, and I already went through the game you reported, KnacK, and the numbers appear to be correct. However, I haven't tried debugging the code that considers someone's play time.

Here's the code, albeit a little messy:

Code: [Select]
$best_play_time_per = 1;

foreach($game['players'] as $name => $info)
{
    $play_time_per = $game['play_time'] ? $info['play_time']/$game['play_time'] : 0;
    if($play_time_per > $best_play_time_per)
        $best_play_time_per = $play_time_per;
}

// [...]
               
$top_k_d = array();

foreach($game['players'] as $name => $info)
{
    if($info['k_d'] >= $top_kd['k_d'] && $game['play_time'] && $best_play_time_per && $info['play_time']/$game['play_time']/$best_play_time_per > .05 && $info['kills'] > 1)
    {
        $this->debug(sprintf("(debug) K/D= %4s %4s %s", round($info['k_d'], 2), round($info['play_time']/60, 1), DigitalPaintServer::clean_funname($name)));
        $top_k_d = array('name' => DigitalPaintServer::clean_funname($name),
                         'k_d' => $info['k_d']);
    }

// [...]

}

I have to fix a file-pointers-not-closing problem in my script before I can tackle this.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: KnacK on December 31, 2007, 09:40:00 PM
/me grabs some aspirin while attempting to read the code.

Keep up the great work sk89q.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: sk89q on December 31, 2007, 10:42:20 PM
Bug should be fixed.

$top_k_d vs. $top_kd

Now hopefully rewriting file_get_contents and file using just fopen will prevent the file-pointers-not-closing bug from triggering. We'll see... :/

P.S. Happy New Year!

(http://img183.imageshack.us/img183/3734/sshot184dr4.jpg)
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: jitspoe on January 01, 2008, 01:14:59 AM
Nice. :)
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: DaRkNeSS on January 01, 2008, 01:22:30 AM
It would be cool if you made some in-game lookup to see someone's registered names so you don't have to go to dplogin.com to see who is talking trash to you.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: KiLo on January 01, 2008, 01:28:00 AM
It would be cool if you made some in-game lookup to see someone's registered names so you don't have to go to dplogin.com to see who is talking trash to you.

I 2nd that.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: sk89q on January 01, 2008, 01:11:56 PM
Can't, since there's no way for me to send a private message to someone.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: QueeNiE on January 01, 2008, 01:30:46 PM
you could have a command like !GLID <in-game ID#>, and it would just shout out to the server that persons first three names or something else related to the account.
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: sk89q on January 01, 2008, 01:56:34 PM
I don't think shouting out to the server is a great idea :/
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: DaRkNeSS on January 01, 2008, 02:52:58 PM
How do the counter-strike servers make it so it only shows up for that player?
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: Cobo on January 01, 2008, 03:06:37 PM
How do the counter-strike servers make it so it only shows up for that player?
They use source modification ;)
Title: Re: !vote, !rules, and other commands on my server -- custom console commands
Post by: KnacK on January 01, 2008, 03:17:25 PM
sk89q,

Looks like that fixed the problem.

Good Job.