Proving Ground - Vanilla NS2 and whitelisting server mods

KKyleKKyle Michigan Join Date: 2005-07-01 Member: 55067Members
edited October 2018 in Modding
Hello, I am writing regarding an Object Oriented Concept based around addition of spectator angle done automatically on a timer and check. Basically what this allows is TV quality entertainment of competitive gameplay. For anyone interested in competitive gameplay and watching commentator quality scenarios. This server side work in progress exclusive plugin to my own server management (unless rebraned with a plus sign without permission).


While primitive at the moment, it works. IT does the job, and improvements may be made. Who to target, how long between interval, toggles between camera view for clients to manage via radial menu.

I bring gifts. I'm not empty handed. I want this post to share the source being ran on the current Proving Ground server, using the mod with no intended gameplay changes. This has to be whitelisted, in beta phase for hive skill after all. At the moment I am discussing Director, and not Team Queue. Team Queue is another post on this thread.

Here is what I want to discuss in this first post. The current status of director.



https://github.com/KyleAbent/-Shine-Proving-Ground/blob/9.23.18-safety-net/lua/shine/extensions/director/server.lua

With shine I am finding a target VIP using for loops in seperate categories. Down the line I want for loops gone and replaced with better performance as who to choose. Possibly GetNearest. Then dynamic choosing of existing round condition.


https://github.com/KyleAbent/-Shine-Proving-Ground/blob/9.23.18-safety-net/lua/Spectator_Director.lua

In this version I have the Director as a child class of Spectator. From importing this Director Concept from Siege 2017, into Skynet mod server, into Proving Ground server. I've always used 'AvocaDirector', and got it working just good enough to get rounds of full server gameplay. What I do with the class is ovverride parent methods and hook to call the original much like shine does. I do two things: I make sure im a certain distance behind my target much like third person camera and much like mac behind player to weld. I also update my angles to match the target otherwise the input move direction will go haywire.

in Proving Ground I removed the delay between target dying and next target choosing. AS you can see in this 45 minute gameplay video of two rounds on ns2_caged 12v12 for 45 minutes with r_gui 0 and voice volume 0.



My next post: Briefly discuss Node, Linked Queue, Team Queue, Linked List. JAVA to LUA language conversion and how it's so much easier to convert JAVA to LUA than write into LUA from scratch. Such as UML diagrams.

Comments

  • KKyleKKyle Michigan Join Date: 2005-07-01 Member: 55067Members
    Node, LinkedQueue, TeamQueue, LinkedList.

    Hello and for the moment I want this post to be brief. Basically my idea is to import and translate java data structures into ns2 lua. Such as by creating nodes and queue and providing my own back end of how they work. I want no for loops. What I do is create map entities for: node, queue. Inside the player I've network var as to which is set.

    At the moment, work in progress. Let me not post any github link until ready. I have Beta version, and Live version. Beta is currently live on Proving Ground server. Live may be ready by the weekend. I have no ETA on my in dept technical discussion on the topic more than I have writing the actual mod. What I mean is, I have priority at the moment ;)
  • ArchieArchie Antarctica Join Date: 2006-09-19 Member: 58028Members, Constellation, Reinforced - Supporter, WC 2013 - Supporter
    edited September 2018
    Thanks Kyle, we've been waiting for years for something like this, appreciate the work and effort you've put into this, Do you know if this works just with [shine] so we can run it on our own servers? would be nice for a little project.
  • KKyleKKyle Michigan Join Date: 2005-07-01 Member: 55067Members
    edited October 2018
    Archie wrote: »
    Thanks Kyle, we've been waiting for years for something like this, appreciate the work and effort you've put into this, Do you know if this works just with [shine] so we can run it on our own servers? would be nice for a little project.

    I remember you asking me about the camera system a long time ago when I originally wrote it for siege. At this point I don't care who runs the director camera system. I can take the content and update the standalone mod. As of writing this, I've taken the director version from the proving ground mod and placed it into its own standalone mod found here.

    https://steamcommunity.com/sharedfiles/filedetails/?id=1419660682&searchtext=director

    I'd still like to use this thread for the topic because the Proving Grounds server is where I can use my code on a live server.


    I came here to post an update on the system. It turns out that NS2 already has "FollowMoveMixin" for spectators, which is basically a third person camera following system. But it appears to be disabled and not in use. When I enabled it, the angles wouldn't update, but the target choosing is fine. So what I did yesterday was wire in a toggle on demand to work with shine. I've also wired in for the angles to update, and another toggle to change the delay between interval changing between 8-24s. I changed the target choosing to be done on interval and not mouse click.

    All of the changes may be found here in my most recent version:

    FollowMoveMixin modified
    https://github.com/KyleAbent/-Shine-Proving-Ground/blob/10.5.18/lua/FollowMoveMixin_Director.lua
    local orig = FollowMoveMixin.__initmixin
    function FollowMoveMixin:__initmixin()
      orig(self)
      self.intervals = 9
    end
    
    function FollowMoveMixin:setIntervals(num)
    self.intervals = num
    end
    
    function FollowMoveMixin:getFME()
    return self.followMoveEnabled 
    end
    
     UpdateTarget function
    
      -- local primaryAttack = bit.band(input.commands, Move.PrimaryAttack) ~= 0
      --  local secondaryAttack = bit.band(input.commands, Move.SecondaryAttack) ~= 0
        local isTargetValid = self:GetIsValidTarget(Shared.GetEntity(self.followedTargetId))
       -- local changeTargetAction = primaryAttack or secondaryAttack
        
        -- Require another click to change target.
        -- NOT. That would be lame, yo. Let me watch a movie and commentate over it on demand.
        local changeTarget = not isTargetValid--(not self.changeTargetAction and changeTargetAction) or not isTargetValid
              changeTarget = changeTarget or ( not self.timeLast or self.timeLast + self.intervals < Shared.GetTime() ) --Lets not stay forever
              
        self.changeTargetAction = changeTargetAction
        
        if changeTarget then--and secondaryAttack then
            self:ChangeTarget(self, true) 
            self.timeLast = Shared.GetTime()
        elseif changeTarget then --?? 
            self:ChangeTarget(self, false)
    end
    
    
     UpdateView function
          if targetEntity ~= nil then
                 local dir = GetNormalizedVector(targetEntity:GetOrigin() - self:GetOrigin())
                 local angles = Angles(GetPitchFromVector(dir), GetYawFromVector(dir), 0)
                 self:SetOffsetAngles(angles)
    end
    

    (and more from that file)

    Client menu toggle settings:

    https://github.com/KyleAbent/-Shine-Proving-Ground/blob/10.5.18/lua/shine/extensions/director/client.lua
     Shine.VoteMenu:AddPage( "Intervals", function( self )
    		self:AddSideButton( "8 Seconds", function()
    		      Shared.ConsoleCommand( "sh_director_intervals 8" )
    		end )
    		self:AddSideButton( "12 Seconds", function()
    		      Shared.ConsoleCommand( "sh_director_intervals 12" )
    		end )
    		self:AddSideButton( "16 Seconds", function()
    		      Shared.ConsoleCommand( "sh_director_intervals 16" )
    		end )
    		self:AddSideButton( "20 Seconds", function()
    		      Shared.ConsoleCommand( "sh_director_intervals 20" )
    		end )
    		self:AddSideButton( "24 Seconds", function()
    		      Shared.ConsoleCommand( "sh_director_intervals 24" )
    		end )
    		self:AddTopButton( "Back", function()
    			self:SetPage( "Spectator" )
    		end )
    	end )
    		
    
    	Shine.VoteMenu:AddPage( "Spectator", function( self )
    		self:AddTopButton( "Back", function()
    			self:SetPage( "Proving Grounds" )
    		end )
    		self:AddSideButton( "Intervals", function()
    			self:SetPage( "Intervals" )
    		end )
    	end )
    
    	Shine.VoteMenu:EditPage( "Spectator", function( self )
    		self:AddSideButton( "Toggle Director", function()
    		--	Shared.ConsoleCommand( "sh_specvoice 1" )
    		    --local player = Client.GetLocalPlayer()
    		   -- player:setNoQueue(player)
    		      Shared.ConsoleCommand( "sh_direct" )
    			--self:SetPage( "Main" )
    			--self:SetIsVisible( false )
    		end )
    		
    		
    end )
    

    Server.lua very bottum here with the commands are the only thing in use and none of my for loops for target choosing are in use at the moment
    function Plugin:CreateCommands()
    
    
    
    local function Direct( Client )
        local Player = Client:GetControllingPlayer()
        if Player:GetSpectatorMode() ~= kSpectatorMode.FreeLook then Player:SetSpectatorMode(kSpectatorMode.FreeLook)  end
             if Player:GetTeamNumber() == 3 then
                       --Player.isDirecting = not Player.isDirecting
                       Player:SetFollowMoveEnabled( not Player:getFME() )
                       self:NotifyGeneric( Client, "Director Boolean is now %s ", true, Player:getFME() )
              end
    end
    
    local DirectCommand = self:BindCommand( "sh_direct", "direct", Direct, true)
    
    local function Director_Intervals( Client, Number )
        local Player = Client:GetControllingPlayer()
             if Player:GetTeamNumber() == 3 then
                       Player:setIntervals(Number)
                       self:NotifyGeneric( Client, "Intervals delay is now %s", true, Number )
              end
    end
    
    local DirectIntervalsCommand = self:BindCommand( "sh_director_intervals", "director_intervals", Director_Intervals, true)
    DirectIntervalsCommand:AddParam{ Type = "number", Min = 8, Max = 32, Round = true, Optional = false, Default = 8 }
    
    
    
    end
    

    https://github.com/KyleAbent/-Shine-Proving-Ground/blob/10.5.18/lua/shine/extensions/director/server.lua

    I may do some editing to who to pick as target, such as to include arcs/macs/drifters moving and/or set player to require incombat to make angles more interesting
    function Spectator:GetIsValidTarget(entity)
    
        local isValid = entity and not entity:isa("Commander") and (HasMixin(entity, "Live") and entity:GetIsAlive())
        isValid = isValid and (entity:GetTeamNumber() ~= kTeamReadyRoom and entity:GetTeamNumber() ~= kSpectatorIndex)
    
        return isValid
    
    end
    


    I also plan on updating the trello
    https://trello.com/c/UbOPPaRb/7-director

    Here are 4 hours of video using the current version. While the angles may be nauseating, it's still progress nonetheless








    Edit: I very much plan to extend support to this: Such as more client options of toggling interesting camera angles to view more of the round than default spectator.
  • KKyleKKyle Michigan Join Date: 2005-07-01 Member: 55067Members
    edited October 2018
    You know, it's not really fun to be on this forum while I cannot see my posts if logged out. For all I've done with NS2, this is the thanks I get. A shadowban.
Sign In or Register to comment.