proposed alien vision change

roxxkattroxxkatt Join Date: 2014-12-28 Member: 200431Members
edited January 2015 in Ideas and Suggestions
was talking to obraxis about a few changes, and sent some stuff to some CDT team members, but didnt get a response from them, and got a "not until 272 is out", and then a "not until 273" from obraxis, and he suggested i make a forum account and post in the meantime, so i made this topic.

i got into ns2 when i saw it in a humble bundle about a year ago iirc.
i have been programming for about 15-20 years now, and created my first shader last month after looking in ukes av and wanting more.
other people wanted more as well, so i made a few different av shaders, which then hit first page of steam workshops months most popular in a day, 3 months most popular in a week, and 6 months most popular in a month, and am currently page 2 and 3 of years most popular.
i basically only play alien team, so this is especially important to me.

there were a few things i wanted to implement in the shaders that were not possible within the constraints set by the lua.

my proposal: move some control out of the lua and into the shader, and into the hands of the modders (more easily)

this is not a request to change how the alien vision LOOKS, but how it WORKS, and it gives more control to the people making custom av.
it does this by passing more information about the world to the shader.

proposed changes:
Alien_Client.lua line 540
    if isLocal and self:GetIsAlive() then
        local darkVisionState = self:GetDarkVisionEnabled()
        if self.lastDarkVisionState ~= darkVisionState then
            if darkVisionState then
                self.darkVisionStartTime = Shared.GetTime()
                self.darkVisionEndTime=0
                self:TriggerEffects("alien_vision_on")
            else
                self.darkVisionStartTime=0
                self.darkVisionEndTime = Shared.GetTime()
                self:TriggerEffects("alien_vision_off")
            end
            self.lastDarkVisionState = darkVisionState
        end
        local useShader = Player.screenEffects.darkVision
        if useShader then
            local teamInfo = GetTeamInfoEntity(kTeam2Index)
            local bioMass = teamInfo and teamInfo.GetBioMassLevel and teamInfo:GetBioMassLevel() or 0
            local maxBioMass = teamInfo and teamInfo.GetMaxBioMassLevel and teamInfo:GetMaxBioMassLevel() or 0

            useShader:SetActive(alienVisionEnabled)
            useShader:SetParameter("on",darkVisionState and 1 or 0)
            useShader:SetParameter("time",Shared.GetTime())
            useShader:SetParameter("starttime",self.darkVisionStartTime or 0)
            useShader:SetParameter("endtime",self.darkVisionEndTime or 0)
            useShader:SetParameter("alive",self:GetIsAlive() and 1 or 0)
            useShader:SetParameter("health",self:GetHealth()/self:GetMaxHealth())
            useShader:SetParameter("armor",self:GetArmorAmount()/self:GetMaxArmor())
            useShader:SetParameter("energy",self:GetEnergy()/self:GetMaxEnergy())
            useShader:SetParameter("speed",self:GetSpeedScalar())
            useShader:SetParameter("shield",self:GetHasMucousShield() and 1 or 0)
            useShader:SetParameter("bio",bioMass/maxBioMass)
        end
        self:UpdateRegenerationEffect()
    end

the cdt teams trello has a lot of items regarding av, and this is a good move, as it allows people making av to instantly convey more information to the (alien) user, with no negative consequences, and it is a small, easy change to make and the change is completely invisible to the user.
however, it may be only be appreciated by people trying to make complex av shaders, of which there are really only a few, and for those who arent very good, i am more than willing to release a proof of concept example shader.
«1

Comments

  • roxxkattroxxkatt Join Date: 2014-12-28 Member: 200431Members
    edited December 2014
    tl;dr version:
    • makes no changes the user can see
    • only helps modders
    • allows av to show hp levels
    • allows av to show energy levels
    • allows av to show speed levels
    • because of above, can play with HUD off as alien
    • stops lua from forcing fade effect on modders (moves fade from lua to shader)
    • gives more fade control to modders
  • roxxkattroxxkatt Join Date: 2014-12-28 Member: 200431Members
    edited December 2014
    second topic:
    the second reason I am making this topic is because I have never used lua before, and I would like to implement ALIENSPEEDPERCENT ALIENHEALTHPERCENT ALIENENERGYPERCENT by myself, which is not the real way of doing it in lua, so i can send the cdt team 100% finished code so that way the cdt team, which is apparently very busy, do not have to do it themselves, thereby lightening their load, and learning some lua and ns2 object structure in the process.


    third topic:
    a frequent idea brought up by players is a night vision goggles item available in the proto lab.
    the code to make this happen already exists in the alien vision shader support, and would be easily ported by simply adding an item and another hlsl file.
    would this be possible?
    it seems the only negative would be people that argue that it could be overpowered.

    forked to http://forums.unknownworlds.com/discussion/136383/marine-night-vision-goggles


    fourth topic:
    it seems that the vertex shader in the alien vision hlsl file is not used at all.
    is there an example of its use anywhere?


    fifth topic:
    have some free av shaders
    Original
    Minimalistic
    Blue+Green
    Black
    Black: Red
    Black: Green
    Black: Blue
  • roxxkattroxxkatt Join Date: 2014-12-28 Member: 200431Members
    edited December 2014
    and in response to your preempt, this change can be added without any visual changes whatsoever
    (response to deleted post)
  • SamusDroidSamusDroid Colorado Join Date: 2013-05-13 Member: 185219Members, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Gold, Subnautica Playtester, NS2 Community Developer, Pistachionauts
    edited December 2014
    It's not a matter of how many votes gets it's about when we can get to doing it. I sent to the other programmers so they can look at it.

    Ps you can use
    the code block to put things so they  are easier to read
    
  • roxxkattroxxkatt Join Date: 2014-12-28 Member: 200431Members
    edited December 2014
    im aware of the process, obraxis was very clear about the approval process, this is only one part



    i just made it a poll for shits and giggles, would be interesting to gauge how people feel about it
    (response to edit)
  • roxxkattroxxkatt Join Date: 2014-12-28 Member: 200431Members
    edited December 2014
    also, send them to this topic so they can talk about things here and i dont have to chase them down with emails anymore please
    good for transparency and etc

    tried to get a trello box for this earlier and got beat down with the usual "approval process and etc" thing
  • roxxkattroxxkatt Join Date: 2014-12-28 Member: 200431Members
    also if anyone votes no, feel free to state why so things can be improved, otherwise people will just think you are trolling
  • roxxkattroxxkatt Join Date: 2014-12-28 Member: 200431Members
  • roxxkattroxxkatt Join Date: 2014-12-28 Member: 200431Members
    also:
    it might be a good idea to add an armor percent variable as well


    and if anyone knows where to find the shader for the batman arkham origins detective mode, that would be very helpful
  • NordicNordic Long term camping in Kodiak Join Date: 2012-05-13 Member: 151995Members, NS2 Playtester, NS2 Map Tester, Reinforced - Supporter, Reinforced - Silver, Reinforced - Shadow
    As a non coder, I am unable to vote not knowing what the code does. I do really like your alien visions and use the black and red one.

    Also, you can edit your posts, instead of making a new post every 20 minutes.
  • roxxkattroxxkatt Join Date: 2014-12-28 Member: 200431Members
    sixth topic:
    it would be nice to have a av changer similar to the one in ns2+ to be able to change to a specific av without having to reload map, possibly populated by hlsl files in a folder
  • NotPaLaGiNotPaLaGi Join Date: 2014-05-29 Member: 196291Members
    Pretty sure this shouldn't have been made into a forum topic or post lol. I am not even sure what this guy is asking for. Some backend coding change so modders can have more flexibility with AV? Sounds great I guess. I'm sure if CDT can do it, they will do it. And if they can't, they can't. But hardly seems like a top priority.

    OP even said it himself:
    roxxkatt wrote: »
    however, it may be only be appreciated by people trying to make complex av shaders, of which there are really only a few

    Making a community poll for this gave me a good chuckle.
  • ZeroEarThZeroEarTh Singapore Join Date: 2014-07-01 Member: 197126Members
    YES >>>> Its awesome :))
  • clankill3rclankill3r Join Date: 2007-09-03 Member: 62145Members, NS2 Map Tester, Reinforced - Shadow
    I like the idea.
    I would like to see one more, the biomass level.
    I think it would be nice if we start with a not so nice alien vision, like the current one and that each biomass level makes it look prettier.

    One thing for sure, NS2 should really get a nice alien vision back so I don't have to play with those human eyes anymore.
  • roxxkattroxxkatt Join Date: 2014-12-28 Member: 200431Members
    thats actually a great idea that i would never have thought of
  • roxxkattroxxkatt Join Date: 2014-12-28 Member: 200431Members
    edited December 2014
    i suspect SELF.ALIENHEALTHPERCENT should be replaced by Player:GetHealth()/Player:GetMaxHealth()
    and SELF.ALIENARMORPERCENT by Player:GetArmorAmount()/Player:GetMaxArmor()
    and SELF.ALIENENERGYPERCENT by Alien:GetEnergy()/Player:GetMaxEnergy()
    and SELF.ALIENSPEEDPERCENT by Player:GetSpeedScalar()
    and SELF.ALIENBIOMASSPERCENT by AlienTeamInfo:GetBioMassLevel()/AlienTeamInfo:maxBioMassLevel()
    and SELF.ISALIVE by Player:GetIsAlive()


    is anyone who actually knows lua able to verify this?
    do i have to use Player and Alien, or can i just use self? probably not for AlienTeamInfo?
    does lua use ":" like java uses "."?


    i added the SELF.ISALIVE for when the player is dead and spectating other people, will GetIsAlive() still return false while spectating someone else that is alive?
  • SamusDroidSamusDroid Colorado Join Date: 2013-05-13 Member: 185219Members, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Gold, Subnautica Playtester, NS2 Community Developer, Pistachionauts
    edited December 2014
    That is correct. You can just use self: in Alien_Client. For the rest try searching for PlayerUI_ as there are functions to get the things you are looking for.
    Also https://docs.google.com/document/d/1ZRUSV-Ajv_o4SGIe2t3X0nvsObBm2SRubDaeWd8Aroc/mobilebasic this is the lua conventions for NS2
  • roxxkattroxxkatt Join Date: 2014-12-28 Member: 200431Members
    edited December 2014
    all the functions in PlayerUI_ in Player_Client.lua start with a line of
    local p=Client.GetLocalPlayer()
    and then do
    p:GetHealth()

    1) is doing Client.GetLocalPlayer():GetHealth() valid?
    2) is doing Player:GetHealth() valid?
    3) is Player a reference to a class of some kind?
    4) is ~= in lua same as != everywhere else?
    5) in the context of Alien_Client.lua, what does self in self:function() refer to? where can it be found?
    6) i updated the main post, is it still correct, are all the values still percentages, and will dead remain the same while spec?
    8) what needs to happen to get the trello box moved to the "needs approval" column?
    7) lol a typo in a function name: GetMuscousShieldAmount()
  • YojimboYojimbo England Join Date: 2009-03-19 Member: 66806Members, NS2 Playtester, NS2 Map Tester, Reinforced - Supporter, Reinforced - Silver, Reinforced - Shadow
    Sounds like a good idea, wish you best of luck to it.

    P.S. edit your existing posts and put extras at the bottom, no need to clog the thread up to generate discussion, the thread will do that itself.
  • roxxkattroxxkatt Join Date: 2014-12-28 Member: 200431Members
    as you can see, pretty much all my posts have edit red text on them, and some are in response to posts that no longer exist
  • YojimboYojimbo England Join Date: 2009-03-19 Member: 66806Members, NS2 Playtester, NS2 Map Tester, Reinforced - Supporter, Reinforced - Silver, Reinforced - Shadow
    roxxkatt wrote: »
    as you can see, pretty much all my posts have edit red text on them, and some are in response to posts that no longer exist

    Try to use quotes as often as possible then as this breaks up the screen more nicely and makes a more pleasant reading experience :smile: , anyways enough of forum etiquette, hope this gets put in eventually.
  • cooliticcoolitic Right behind you Join Date: 2013-04-02 Member: 184609Members
    edited December 2014
    Any change will probably be good, considering the fact I never seem to use AV.
  • turtsmcgurtturtsmcgurt Join Date: 2012-11-01 Member: 165456Members, Reinforced - Supporter
    can it be changed so that it only shows what you voted for in your first reply to the thread, or be made smaller and less obnoxious some how? it would fit better somewhere up here i think. it doesn't need to be color coded, just use the same font and prefix it with "Voted Yes".
  • roxxkattroxxkatt Join Date: 2014-12-28 Member: 200431Members
    this forum does a lot of strange things
  • roxxkattroxxkatt Join Date: 2014-12-28 Member: 200431Members
    edited January 2015
    so i tried my hand at lua and made a mod with the proposed changes and then made a proof of concept shader with the new variables
    http://steamcommunity.com/sharedfiles/filedetails/?id=368314529

    so as it turns out, doing something as simple as adding a few copies of a variable to a shader goes very deep into the game engine and causes lots of problems
    i finally managed to get it running, but i suck at lua, so it is currently usable, but unplayable, as it has the curious effect of causing fps to slowly go down until it reaches < 1
    however it still shows that it is possible, even if all the percents are ints instead of floats for some reason, and it doesnt turn off after turning on, even after switching to marine team
    while in use, cpu and gpu use remain low/unchanged, so i am fairly certain the problem is in the lua somewhere
    the only time metric i know about doesnt have enough granularity for me to do any worthwhile benchmarking to find the bottleneck
    someone who knows what they are doing is going to have to go over this and figure out whats going on here
    like why is Alien:UpdateClientEffects() run twice a frame instead of only once?
    why does this thing stay active?
    how does it stay active even after changing to marine team?

    tl;dr it works and looks good, but something is horribly wrong, and its not done yet
  • roxxkattroxxkatt Join Date: 2014-12-28 Member: 200431Members
    samus pointed out that i was actually creating a new shader object every frame, and after removing some remedies for launchpad not working properly, everything now works 100% as intended at full fps $$$

    however since servers check all lua files, i have not been able to see how it looks at 12 biomass instead of only 1, as the effects stack with biomass

    ...and i still suspect some floats are still ints



    so if anyone reading this is a server owner, feel free to run this mod on your server to test it out and let me know
    it doesnt affect gameplay at all
    link again http://steamcommunity.com/sharedfiles/filedetails/?id=368314529
    or Mod ID: 15f408a1
  • roxxkattroxxkatt Join Date: 2014-12-28 Member: 200431Members
    edited January 2015
    13CCD147A678616C1429A2D7849C4FB15C0F4AF7
    14DC2B062EB10392905A49690D0A24943CEE7B92
    FA5097F5D468A4E53BA8080718E978CFDC3896CC
    B8E1608F49AB5B5C4F9D5F09A52FADFB0329C6CD


    top 2 screenshots are at biomass 1 of 12, which is about 25% maximum effect, bottom 2 are at biomass 9, which is about 75%
  • roxxkattroxxkatt Join Date: 2014-12-28 Member: 200431Members
    its not too pretty, and its bio 1 of 12 and not very strong, but it works, and now CDT doesnt really have to do anything extra to add it
  • clankill3rclankill3r Join Date: 2007-09-03 Member: 62145Members, NS2 Map Tester, Reinforced - Shadow
    I think it's time for a alien vision contest :)
  • roxxkattroxxkatt Join Date: 2014-12-28 Member: 200431Members
    edited January 2015
    and just a reminder that since biomass has been added and now is a factor, the people making alien vision shaders can now do things like make parts of the alien vision activate after a certain number of hives are built, or make already unlocked features have a stronger effect
Sign In or Register to comment.