For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

Best way to start mutator timer after game start

The section related to UnrealScript and modding. This board is for coders to discuss and exchange experiences or ask questions.
Post Reply
User avatar
gopostal
OldUnreal Member
Posts: 1005
Joined: Thu Jul 31, 2008 9:29 pm

Best way to start mutator timer after game start

Post by gopostal »

I can't find a direct example for this and there doesn't seem to be a good variable to use as a check. I have a custom game mode that loads a mutator class. The mutator controls the course of the game. Ideally after the players load and begin there should be a 30 second countdown to the start of the actual things that happen in the game (spawning of the collapsing zone for example).

What is the best way to check for actual game start from within mutator? Would I need to go back to the actual gametype and insert a bool into StartGame and then check for that or is there a better way that I just don't see? Thank you guys.
I don't want to give the end away
but we're all going to die one day
User avatar
Feralidragon
OldUnreal Member
Posts: 239
Joined: Thu Jul 24, 2008 6:57 pm

Re: Best way to start mutator timer after game start

Post by Feralidragon »

A quick look into the source code doesn't seem to be there any flag to check.
The closest method to know when a match starts is in the DeathMatchPlus class and is called "StartMatch", however all seems to indicate that from the game point of view the game already started, so DeathMatchPlus is actually just keeping players spectating and then restarting them once the match really starts, but the rest of the game isn't remotely aware of this.

And while it has a boolean bStartMatch which it sets to true, at the end it's reverted to false, so it seems that it's only meant to be used as a flag during the starting of a match, not to indicate it actually started.

Having that said, what you're developing here is a gametype.
Even if you're using a mutator, in the end, it's a full gametype by itself and I think it should be developed as such, as I don't imagine CTF, AS or other gametypes using this kind of "mutator", so I feel that you're using a mutator for something it's not supposed to be used.

But still, if you want to still keep developing it as a mutator, I can imagine some hack-ish ways of detecting the match real start.

For instance, you can check when at least 1 player is not spectating, or not hidden.

Or you can create a Bot subclass and spawn it, given that it has a StartMatch function which doesn't seem to be implemented at the Bot level, and which you can implement to call something else and destroy the bot afterwards, although I am not sure if this influences the bot count at the end.

I only gave a quick look at it though, so I may have missed something.
Last edited by Feralidragon on Wed Mar 07, 2018 4:30 pm, edited 1 time in total.
User avatar
BobIsUnreal
OldUnreal Member
Posts: 805
Joined: Mon Apr 12, 2010 12:34 am

Re: Best way to start mutator timer after game start

Post by BobIsUnreal »

can you use the functinality of mutaterepawn player, (+?prelogin) etc in mutator in connection with a simply playercount to determine if all players that connected have spawned , if they have spawned there ready to play i would guess
User avatar
gopostal
OldUnreal Member
Posts: 1005
Joined: Thu Jul 31, 2008 9:29 pm

Re: Best way to start mutator timer after game start

Post by gopostal »

I spent some time playing with this last night and got it to work by adding a boolean into my mutator class like this in the timer function

Code: Select all

      if (!AllReady) return;
Then I added this to the gametype to force the switch in the mutator

Code: Select all

function StartMatch()
{   
   local UTBG B;  (my mutator class)

    B.AllReady = True;
It seems to work OK but I think I'll just dispense with the mutator class completely per your suggestion and add everything into the gametype. Honestly I've coded mutator class so long that it was my default instead of just doing this correctly.

Still, I'm kind of surprised there isn't a global "ok so the game has really started" variable. Seems like many normal timers should not start until the actual match starts.
I don't want to give the end away
but we're all going to die one day
User avatar
Feralidragon
OldUnreal Member
Posts: 239
Joined: Thu Jul 24, 2008 6:57 pm

Re: Best way to start mutator timer after game start

Post by Feralidragon »

Still, I'm kind of surprised there isn't a global "ok so the game has really started" variable. Seems like many normal timers should not start until the actual match starts.
I never looked into the gametype classes that much (GameInfo and the like), so if you didn't create this topic I would have assumed that something like that existed as well.

On the other hand, playing the devil's advocate for a bit, how many cases are there where this is actually needed though?
In the default game it's not a flag needed anywhere as far as I know, and there aren't many use-cases for it, so at the same time it's understandable why it is so, given that by default a gametype already "started" by the time InitGame is called, and DeathMatchPlus simply tries to hack around it by forcing the players into spectators at first and restarting them once the match starts.
Last edited by Feralidragon on Thu Mar 08, 2018 11:27 am, edited 1 time in total.
User avatar
gopostal
OldUnreal Member
Posts: 1005
Joined: Thu Jul 31, 2008 9:29 pm

Re: Best way to start mutator timer after game start

Post by gopostal »

I was thinking more towards the other end. It's super common to see mutators still chugging along after the game is over. I've been guilty of that myself. Some variable that is only true while the game is actually playing would be nice to have. I know you can check for bGameEnded but it would seem to be better if there was something that was useful on both ends.

Anyway thanks for setting me straight on the code move to gametype.
I don't want to give the end away
but we're all going to die one day
Post Reply

Return to “UScript Board”