.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Half-Life 1 SDK (http://forums.bots-united.com/forumdisplay.php?f=33)
-   -   NEW STEAM: Failure on detecting round, how do YOU do it? (http://forums.bots-united.com/showthread.php?t=748)

botmeister 16-02-2004 22:16

Re: NEW STEAM: Failure on detecting round, how do YOU do it?
 
Quote:

Originally Posted by Pierre-Marie Baty
Regarding ServerActivate(), yes, it is called everytime a new map boots in. Actually a new map means a new server ; each time you change level (even in single player with level transitions), or force a level restart, in whatever manner you want, you will force a call to ServerDeactivate() immediately after the last StartFrame() in which the command was triggered, and a call to ServerActivate() immediately before the first StartFrame() of the new map.

<facultative>
Why I'm reluctant to using HLTV messages is that HLTV is an "external" application using a not-so-well defined protocol, that changes very often. And the purpose of HLTV messages is not for notifying players of a round change, actually if this code is specific to a round change in CS it's pure coincidence ; and on the contrary, notifying clients of a change in the round timer is exactly the point of RoundTime messages...
</facultative>

I see your points, but in my case I need to know about round starts no matter if there are players in game or not, so my options are limited to those that do not depend on players being in the game.

I do think that HLTV would need to know about round starts even if there are no players in the game - no?

Lazy 16-02-2004 22:35

Re: NEW STEAM: Failure on detecting round, how do YOU do it?
 
If you're looking for round events try looking in pfnAlertMessage.

The at_logged event should have something like...
"world" triggered "Round_Start", ect.

Unfortunately, the site that hosted information about logs and the standard format is gone so I'm going by memory on this.

botmeister 17-02-2004 00:02

Re: NEW STEAM: Failure on detecting round, how do YOU do it?
 
Quote:

Originally Posted by Lazy
If you're looking for round events try looking in pfnAlertMessage.

The at_logged event should have something like...
"world" triggered "Round_Start", ect.

Unfortunately, the site that hosted information about logs and the standard format is gone so I'm going by memory on this.

The log message looks like this:
L 01/01/2004 - 01:25:55: World triggered "Round_Start"

You can also look for this one:
L 01/01/2004 - 01:25:55: World triggered "Game_Commencing"

and this
L 01/01/2004 - 01:26:21: World triggered "Round_End"

Thanks Lazy for this idea :)

Pierre-Marie Baty 17-02-2004 00:09

Re: NEW STEAM: Failure on detecting round, how do YOU do it?
 
It works ! I side with this method too.

If you're interested I have updated my PMTools plugin to make it hook pfnAlertMessage()s and send them directly on the listenserver's HUD.

botmeister 17-02-2004 01:26

Re: NEW STEAM: Failure on detecting round, how do YOU do it?
 
Quote:

Originally Posted by Pierre-Marie Baty
It works ! I side with this method too.

If you're interested I have updated my PMTools plugin to make it hook pfnAlertMessage()s and send them directly on the listenserver's HUD.

Looks like a simple and reliable method. I'll give it a try. Will get the updated PMTools of course - can't live without it :)

Terran 17-02-2004 10:00

Re: NEW STEAM: Failure on detecting round, how do YOU do it?
 
That's funny, I always thought that you're aware of this message and simply don't reply upon it because of some timing issues :-)

botmeister 17-02-2004 10:02

Re: NEW STEAM: Failure on detecting round, how do YOU do it?
 
Bah! I'm back with the HLTV method. Take a look at this test log.

Code:

00:42:00 2004 :: World triggered "Round_End"
00:42:05 2004 :: THE ROUND HAS REALLY STARTED
00:42:12 2004 :: World triggered "Round_Start"

Look at the times above, the "Round_End" pfnAlertMessage happens just before the round really ends. It is issued as soon as the round timer goes to zero, but the round does not switch to a new round until about 5 seconds afterwards. The pfnAlertMessage "Round_Start" does not happen until the countdown delay completes. In other words, it gets issued a few seconds after the round really starts (the delay is 7 seconds in the example).

This may work fine for other people, but it is no good to me as I need to know exactly when a round really starts.

*edit*

Quote:

That's funny, I always thought that you're aware of this message and simply don't reply upon it because of some timing issues :-)
LOL just saw your message after I posted - yes, this is funny because I can't use it because of the timing issues!

*edit*

FYI: the Round_End message gets sent only when a round times out. It will not get sent if the round is cut short by other means.

Terran 17-02-2004 10:16

Re: NEW STEAM: Failure on detecting round, how do YOU do it?
 
The Round_Start message is send when the "freezetime" is over? In that case you could use for other purposes :-)

botmeister 17-02-2004 22:13

Re: NEW STEAM: Failure on detecting round, how do YOU do it?
 
OK, I've finally settled on a solution that works great for me. For those who are interested, I've done the following:

1. Hook onto pfnServerActivate. This tells me when a new round has starting after a map load. I set a bool flag indicating that a round is just about to start: RoundStart = true;

2. Hook onto message "HLTV". If the two bytes in the message are both zero, then this tells me a round has just started. RoundStart = true; Note: This message is sent ONLY after a round is ended and at the same time the new round has started - there's no delay between the message and the start of the new round. It will get sent no matter how the round has been ended, and not just when the round times out.

3. Optional: Hook onto pfnStartFrame
Code:

If (RoundStart)
{
        RoundStart = false;
        // round has started - do whatever is needed;
 
}

This hook is optional because you could simply activate your round_start code in both the "HLTV" message hook, and in the pfnServerActivate hook.

Austin 17-02-2004 23:28

Re: NEW STEAM: Failure on detecting round, how do YOU do it?
 
Quote:

Originally Posted by botmeister
OK, I've finally settled on a solution that works great for me. For those who are interested, I've done the following:

Clean!
Cool!

Botmesiter, you said:
"Hook onto message "HLTV". If the two bytes in the message are both zero, "

Could you please post some sample code on how to do this?
Thanks...


All times are GMT +2. The time now is 02:31.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.