Ready / Map reset

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

Fri Dec 07, 2007 10:59 pm

  • Looking at the qc source, it occurred to me that it "could" be simple to use the code from reset_map in arena mode and use it for ReadyCount. I have no idea what I'm doing, I just figured it could work since there is nothing in that code that seems specific to arena.

    So here's what I did, used some arena code pasted over parts of ReadyCount:

    Code: Select all
    void ReadyCount()
    {
       local entity e;
       local float r, p;
       FOR_EACH_REALPLAYER(e)
       {
          p += 1;
          if(e.ready)
             r += 1;
       }
       if(p && r == p)
       {
       self = nextent(world);
       while(self)
       {
          if(self.classname == "droppedweapon"      // cleanup
                || self.classname == "gib"
                || self.classname == "body")
          {
             remove(self);
          }
          else if(self.flags & FL_ITEM)         // reset items
          {
             self.model = self.mdl;
             self.solid = SOLID_TRIGGER;
             setorigin (self, self.origin);
             self.think = SUB_Null;
             self.nextthink = 0;
             self.effects = self.effects - (self.effects & EF_STARDUST);
          }
          else if(self.flags & FL_PROJECTILE)      // remove any projectiles left
          {
             sound(self, CHAN_BODY, "misc/null.wav", 1, ATTN_NORM);
             remove(self);
          }
          else if(self.isdecor)
          {
             removedecor(self);
          }
          else if(self.flags & FL_CLIENT)         // reset all players
          {
             if(self.spawned)
                PutClientInServer();
             else
                PutObserverInServer();
          }
          
          self = nextent(self);
       }
    }


    Would it work?

    Basically, what would happen is that when players type "Ready", map would reset like in arena mode instead of restarting the map, and hopefully players would stay in the team slot they were (no need to reselect a team). I am not sure about the teams part, as arena doesn't use teams. If not, maybe force suicide to all players so they respawn all fresh?

    If this does work, then all that needs to be added is a countdown before the actual map reset (it would wait for countdown to be finished before reseting), and something that sets current game time back to 0 (or add 15 minutes to timelimit if not possible, tho that would be a bit messy I guess) and fragcount for all players back to 0.
    nifrek
    Alien
     
    Posts: 208
    Joined: Fri Sep 22, 2006 6:43 am

Sat Dec 08, 2007 12:17 am

  • Yes, it probably does work (however it would be better to modify reset_map() a bit and use that instead of copying the code). btw: the code already does respawn all players (self.spawned can only be true in arena so everyone would become spectator).

    The reason i didn't do that myself yet is, that there's no way to reset time and currently the map time is only displayed in the scores screen, so it'll be hard to tell when the timelimit is over.
    However the new HUD in 2.4 might solve this issue, since it displays the remaining time...
    User avatar
    KadaverJack
    Site admin and forum addon
     
    Posts: 1102
    Joined: Tue Feb 28, 2006 9:42 pm

Sat Dec 08, 2007 12:30 am

  • Fast response, thanks!

    As a temporary solution for timelimit problem, is there a way to find out what is the current game time and at add 15 minutes to current timelimit?
    nifrek
    Alien
     
    Posts: 208
    Joined: Fri Sep 22, 2006 6:43 am

Sat Dec 08, 2007 12:41 am

  • nifrek wrote:As a temporary solution for timelimit problem, is there a way to find out what is the current game time and at add 15 minutes to current timelimit?

    Yes: cvar_set("timelimit", ftos(cvar("timelimit")+(time/60)))
    User avatar
    KadaverJack
    Site admin and forum addon
     
    Posts: 1102
    Joined: Tue Feb 28, 2006 9:42 pm

Sat Dec 08, 2007 1:00 am

  • Awesome, thank you KadaverJack.

    I just need someone to help me a bit, I'm new to this, I know how to compile but that's about it. Right now it won't compile and I have no clue what needs to be fixed. If anyone feels like helping, I'm pretty much on #nexuiz all the time.
    nifrek
    Alien
     
    Posts: 208
    Joined: Fri Sep 22, 2006 6:43 am

Sat Dec 08, 2007 1:25 am

  • nifrek wrote:Right now it won't compile and I have no clue what needs to be fixed. If anyone feels like helping, I'm pretty much on #nexuiz all the time.

    I'll do & commit the changes tomorrow. It's not much work, but it's 2am here and i don't wanna code any more tonight...
    User avatar
    KadaverJack
    Site admin and forum addon
     
    Posts: 1102
    Joined: Tue Feb 28, 2006 9:42 pm

Sat Dec 08, 2007 1:35 am

  • Thank you again, it is hugely and immensely appreciated. You are my new hero.
    nifrek
    Alien
     
    Posts: 208
    Joined: Fri Sep 22, 2006 6:43 am

Sat Dec 08, 2007 2:52 pm

Wed Dec 12, 2007 6:51 pm

Wed Dec 12, 2007 8:27 pm

  • is there a delay built into it? I cannot test it right now, that's why I am asking. It would be a bit brutal if it restarted instantly after everyone was ready
    IRC quote:
    [kojn] I've been coming a bit more recently
    [kojn] she took it the dirty way
    GreEn`mArine
    Forum addon
     
    Posts: 1509
    Joined: Tue Feb 28, 2006 9:33 pm
    Location: Germany

Wed Dec 12, 2007 9:36 pm

Thu Dec 13, 2007 5:41 pm

  • Fantastic, I will make sure it gets tested and will give feedback here. Thank you.
    nifrek
    Alien
     
    Posts: 208
    Joined: Fri Sep 22, 2006 6:43 am

Thu Dec 13, 2007 11:19 pm

Fri Dec 14, 2007 2:36 am

  • you need a very recent fteqcc to build nexuiz-svn. get it here http://www.fteqw.com/fteqw-nightly/
    HOF:
    <Diablo> the nex is a "game modification"
    <Diablo> quake1 never had a weapon like that.
    <Vordreller> there was no need for anything over 4GB untill Vista came along
    <Samua>]Idea: Fix it? :D
    <Samua>Lies, that only applies to other people.
    User avatar
    tZork
    tZite Admin
     
    Posts: 1337
    Joined: Tue Feb 28, 2006 6:16 pm
    Location: Halfway to somwhere else

Sat Dec 15, 2007 11:43 am

  • Thanks tZork, that did the trick.

    I've tested it and it works great, I couldn't find any bug or anything wrong with it. Thanks a lot for implementing it.

    On my own side I've been playing with the code I originally posted and wanted to suggest another feature that would be great with this one. I made a cvar called "teamlock", that lock teams at map reset. Basically it stops observers from joining a team once a match is started with the message "Cannot join, match is already started, xx:xx left until next map (or something like that)". That way it would allow more serious matches/pickup games to be played without having to fill the sever up to maxplayers and without random players joining, unbalancing the teams after match is started. That means If server isn't full, people can still connect to server and observe the match / wait for next map to join. Of course this feature should be optional (that is something I don't know how to do). Is this something that could be also added?
    nifrek
    Alien
     
    Posts: 208
    Joined: Fri Sep 22, 2006 6:43 am

Sat Dec 15, 2007 2:08 pm

  • Idea: make it not a cvar, but a handler in GameCommand(). Then you can do "sv_cmd teamlock" which sets a lock flag on every player, and a global lock flag so anyone who joins can't enter the game. Then, add an alias:

    alias teamlock "sv_cmd teamlock"

    and it is easily made optional: those who want it make the command votable, others won't.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Sun Dec 16, 2007 12:14 am

  • Sounds good. I have no idea how to approach this tho. What I did was simply bypass/show an error message at the "join" and "selecteam" stuff when teamlock is set to "1" (autojoin must be disabled by server). It gets enabled when everyone is ready and disabled when map ends. I will take a look at how to make it work using you idea, thanks.
    nifrek
    Alien
     
    Posts: 208
    Joined: Fri Sep 22, 2006 6:43 am

Wed Dec 19, 2007 12:39 am

  • Oh well, I don't think I can do this, I can't code from scratch, I basically just look at existing code and take bits that I think is what I need and modify it. :( To tell the truth I don't even know what an "handler" is hehe. :oops: I'm gonna try to learn but until then this will have to wait.

    But anyway, I've been thinking about it, and there's something else that would need to be addressed before this feature can be used for real. Right now observers cannot use teamsay at all, correct? Messages are just sent as regular messages. Which means unless they shut up during matches they can't talk with each other without bothering the people playing (they already have to read team communication, random comments between them would be annoying). Actually this is something I always found a bit annoying when there are several observers on a server, I end up not reading messages at all and also miss team communication. Is there an easy way to fix this? Maybe the messages could be sent to people with -666 as score?
    nifrek
    Alien
     
    Posts: 208
    Joined: Fri Sep 22, 2006 6:43 am

Sat Dec 22, 2007 1:43 am

Sat Dec 22, 2007 7:03 am

  • Hey oz, yes I like your idea. But for this particular situation it think it would be too much effort from the user to setup this correctly, unless it's set by default or course. But I think observers should simply be considered a "team" by teamsay. But say/teamsay seems to be engine stuff. I guess in quakec it would be possible to automatically put observers in an unused team like "yellow" but still be observers, but that would need to be a mod. I still haven't been able to find someone who would like to help make a tournament mode so I'm suggesting features to the devs that would make nexuiz to be able to play more serious matches without the need for one but also not be in the way of regular games. I don't think this is going to happen in 2.4, they have too much on their plates already.

    But if I find a way to fix spectator talk then I can already make a progs.dat for servers that want the teamlock feature. Maybe I'm wrong but admins don't seem too keen on running mods on their servers and ladder servers couldn't use this because it's against the rules to have spectators during matches, so I don't know. I'm hoping to find about 3 US server admins willing to run it so they can be used for the Nexuiz League I'm trying to get going once 2.4 is out. Everyone that has shown interest in those features at first all kinda disapeared, I don't understand this community :(
    nifrek
    Alien
     
    Posts: 208
    Joined: Fri Sep 22, 2006 6:43 am

Sat Dec 22, 2007 8:31 am

  • What is your problem with spectator talk? Do you want spectators to only talk to other spectators, and players only talk to other players? Or do you want spectators to read everything, but players not read what spectators say?

    That would be very easy to do... I could do that in main Nexuiz, and make a cvar for it (or two).
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Sat Dec 22, 2007 11:04 am

  • Err, I forgot that "say" and "say_team" were aliases for "messagemode" and "messagemode2" :shock:

    But basically, spectators should be able to use messagemode2 to talk to each other so they don't bother players, the same way that teammates can talk to each other with team messages. In an ideal world, there could be a cvar to disable spectators from talking publicly, so that when they use messagemode it automatically sends the message as messagemode2 (useful along with sv_ready_restart, ie: once map resets, the cvar is enabled, and disabled when next map starts).
    nifrek
    Alien
     
    Posts: 208
    Joined: Fri Sep 22, 2006 6:43 am

Sun Dec 23, 2007 8:51 am

  • nifrek wrote:Err, I forgot that "say" and "say_team" were aliases for "messagemode" and "messagemode2" :shock:
    ...
    (useful along with sv_ready_restart, ie: once map resets, the cvar is enabled, and disabled when next map starts).

    This is indeed a very good idea. Because this way spectators can talk to the players while the match has not been reset yet and then can't anymore, once the match has been restarted.

    And the reason why I disallow spectators in the ladder rules is not because I don't like spectators, but because until now you cannot prevent spectators from joining the game, which means that they can ruin a running game by doing bullshit.

    Once there is a properly working spectator thing, I wouldn't mind changing the rules accordingly. It's then up to the individual ladder server admins how many extra slots they want to provide for spectating, as I wouldn't force them to provide any.
    IRC quote:
    [kojn] I've been coming a bit more recently
    [kojn] she took it the dirty way
    GreEn`mArine
    Forum addon
     
    Posts: 1509
    Joined: Tue Feb 28, 2006 9:33 pm
    Location: Germany

Sun Dec 23, 2007 12:43 pm

  • Sounds good GreEn`mArine, I think we should have a talk on irc soon. I already have the teamlock feature working which stops spectators from joining, but it would have to come in form of a mod, that is, a custom progs.dat.
    nifrek
    Alien
     
    Posts: 208
    Joined: Fri Sep 22, 2006 6:43 am

Sun Dec 23, 2007 4:14 pm



Return to Nexuiz - Development




Information
  • Who is online
  • Users browsing this forum: No registered users and 1 guest