Search Unity

No Heroes - A realistic multiplayer FPS

Discussion in 'Works In Progress - Archive' started by eskovas, Jul 12, 2011.

  1. Crystalline

    Crystalline

    Joined:
    Sep 11, 2013
    Posts:
    150
    @eskovas The way you have animated ,textured and assembled the game mechanics look very very similar to BF, you cant deny that, or can you?
    Also, as I said, I don't want to be rude, that not my purpose, the game looks fantastic. Just had to throw my thoughts in :D. Don't get it wrong.
    I wish you best luck with it, I will definitely try it once it hits steam and convince myself of the differences .

    @Terminator75 It was meant to be a compliment initially, so don't worry :).
     
  2. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    @Crystalline

    Sorry but it didn't sound like a compliment and yes i can deny it. You called the game a "perfect clone" of battlefield and asked "What's the difference?", sounding like literally everything i made was basically copying everything from Battlefield, which is 100% wrong.

    Making animations and game mechanics similar to what you can do in Real Life isn't copying another game. I didn't base anything off battlefield, but based off videos and images of real-life. Just because many games share some similar attributes, does not mean they are a copy of each other. And how is using real-life textures for the environment copying battlefield? i can't understand that really...

    That's like saying, Call of Duty is a clone of Battlefield because it's a first person shooter, or Battlefield 3 is a complete copy of Mirror's Edge because it copied the vaulting mechanics and both are FPS.
     
    hergo97 likes this.
  3. Crystalline

    Crystalline

    Joined:
    Sep 11, 2013
    Posts:
    150
    Its interesting how you just deny the fact that it looks very similar to BF though. Like why not accept that? I didn't said it looked like mario..
    Also, if realism is the main thing you follow, then you gotta tweak quite a few actual things.

    Anyway, good luck with the game. Not going to ruin the thread with my thoughts. ( soon I ll get under attack haha ).
    Bye.
     
  4. nxtboyIII

    nxtboyIII

    Joined:
    Jun 4, 2015
    Posts:
    229
    Yeah it looks like Battlefield 4, especially that last GIF you posted, which is why it is so awesome!!
     
  5. ANTMAN0079

    ANTMAN0079

    Joined:
    Mar 16, 2013
    Posts:
    277
    I've looked at this project for long enough and have my own thoughts about it. But just to give some advice when developing a game such as this: When somebody gives a criticism that you as the developer feels "Your choice of words to describe it is a little strange."... you'll probably wish you never responded directly to that kind of criticism. It's usually followed up with an equally strange explanation that leads the developer to think "What is this person talking about?"

    If you think anyone's response to your game is "... a little stranger", knowing full well that your game design has a basis in reality AND they think you're copying another game with the exact same basis in reality... then you can assume that is person is actually strange and has no idea what they are complaining about, nor can they grasp the concept of developing a game in a genre with a particular setting.

    eskavos, you've been working on this game for this long. And only now does somebody give you that kind of 'strange' criticism. I'm sure you know it's ironic and ridiculous.
     
  6. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    @ANTMAN0079

    When i made that comment, i was referring to him saying that he thinks a game is a perfect clone of another one because it had similar type of animations, camera style and graphics style. it was even stated that the way i textured the game made it look very very similar to battlefield. ( which until now, i used real-life textures for environments and i made all the weapons/attachments textures based off their real counterparts by looking at images of those )

    I'm not saying he's strange, but the choice of words to describe something as a "perfect clone" is completely wrong. How many types of games have those exact same types of features and are extremely different?

    Anyway, i don't really want to continue to talk about this in this thread, since it's not its purpose.
     
    stephanvdw likes this.
  7. stephanvdw

    stephanvdw

    Joined:
    Jul 24, 2013
    Posts:
    20
    I'm super amazed by this game can't wait to play it
     
  8. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Trying out non-centered aiming. The projectiles will go the direction the weapon is actually pointing at.



    Making the aiming system non-centered, actually gives lasers a big advantage, but can also give away the position. This also makes things a little more immersive and dynamic.
     
    georetro likes this.
  9. nxtboyIII

    nxtboyIII

    Joined:
    Jun 4, 2015
    Posts:
    229
    Doesn't that mean you can't have a crosshair in the middle of the screen since it won't be accurate?
     
  10. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    There won't be crosshairs in the game.
     
    chingwa likes this.
  11. nxtboyIII

    nxtboyIII

    Joined:
    Jun 4, 2015
    Posts:
    229
    o my :eek:
     
  12. joni-giuro

    joni-giuro

    Joined:
    Nov 21, 2013
    Posts:
    435
    This project is awesome! My only critique would be that you've been working on this quite some time now and a lot of the last updates are undoing and redoing parts of it (animations, lighting, ...) and I think you'll never finish this if you keep doing so. I understand that you want it to be perfect and you're getting better while you create the game and so you feel unsatisfied with things you did a while ago, but still, I'd try to bring it to the finish line.
     
  13. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Well, since i've seen many comments ( here and other places ) about me remaking a lot of things for the game and saying i should stop remaking things because it would never end, i'll try to explain better the situation.

    This is a long post :D , but it should clarify why all this remake is happening.

    Let's go back to the beginning.
    So, when this project started, i was into my 2nd year of Uni for computer science, with no former experience in programming, so basically i had about 2 years of programming knowledge. Needless to say that i didn't have much experience with programming and with good programming practices, etc.

    So when the game started, i was basically constructing everything on top of everything else, making classes with thousands of lines and methods with hundreds of lines of code.
    It kept that way for a long time, making each time i modified/added code, it just became more messy, less extensible, and overall worse.
    A couple of years later, i started to try to improve the code by changing it, but still keeping the same practices i was using.
    For example, until the current 'Big Remake', every single weapon was constructed together with the same classes. It was horrible to say the least. The overall multiplayer system was really poor, using peer-to-peer, etc. The information was very specific and every client had control over everything.
    The UI was really badly constructed, the scene system was poorly made, making gamemodes was a mess, etc.


    So at the beginning of this year, i took a step back, re-evaluated the whole game and all classes, and now that i had much more experience and more knowledge over a large array of concepts and techniques for good programming practices, i looked at the whole project and said "no, not like this".
    The game was BADLY constructed.

    - There was almost no concept of object oriented programming... No interfaces, no class inheritance, etc.
    - Everything was hard-coded.

    - If i wanted to make a new type of weapon, i would have to modify dozens of scripts and make them even more complex.
    - If i wanted to add a new gamemode, i had to change things that should not be changed.
    - If i wanted to add more weapons and attachments, i would have to change dozens of places for it to support those items.
    -...

    Simply put, if i wanted to do something, i would have to make everything more complex than it already was, and limit it even more. It was beginning to feel like i couldn't do anything with the game or add content to it easily.

    So this year (before update #45), when i decided to make the game from scratch again, i started by designing the different parts of the game in separate modules. There was the UI, the Item property system, unlocking system, Level system, gamemode system, item system, player system, server/client system, multiplayer system, gameplay system, etc etc etc. Each of these modules would be separated modules and mostly independent from each other. Naming convention was also used and forced over the whole project.
    Each menu of the UI system was broken into smaller independent classes. The item property system defines every item's properties (name, prefab name, skins, unlocks, attachments, images path, etc) and makes it easy to find the information of specific items ( using serialized files on disk to initially load all data ). Multiplayer is now authoritative. The weapon system is now a tree-based inheritance system, where different weapons inherit common logic that is used by other types of weapons. Attachments now have their own logic that commands what a weapon can do and weapons also have their own logic that commands what the player can do (instead of the player having to check every single thing every weapon can or can't do).
    The gameplay system was broken into independent systems, like movement system, weapon system, animation system, network system. and each of these was broken into even smaller independent modules. Making changes and additions much easier to make.

    For example, now if i want to add a new attachment or weapon to the game, i just add the weapon id to the Weapon's Enum file and That's literally it on the code side. Comparing to the old way of adding new content, this is 1000x faster and i don't have to mess with the code.
    If i want to add a new type of weapon that behaves in a different way, i just need to extend the weapon class, and create its own logic. No more things need to be changed as opposed to how it was made.

    Right now, the game is much more professionally made, both visually and not visually. Good programming practices were used. With much more knowledge of programming, the whole game is better constructed.
    Everything is also well documented.
    Needless to say that performance has seen a huge boost due to a better constructed code base and smarter algorithms.
    Right now, the game is advancing very fast and getting much better results than it was before.

    Last week or so, i also deleted every single old file from the project, leaving only the new 'big remake' in the project.


    So, when i say ' i remade x stuff ', it basically means that something new was added to the game and NOT that i remade something that i already redid that was a remake of something else.


    The whole game is new and 10000x better than it was.


    Sorry for the long post :p but i hope i explained better what happened and what is happening.
    If you have any questions, feel free to ask :D

    PS: I also wish i could work on this full-time, but i'm on my last year of my masters degree and i also have a full-time job as a researcher/software developer, so the little time i can take away from my free time, i try to spend it on this game. Some people seem to think that i work full-time on the game.

    I like what i'm doing with this game, and my ultimate goal is to make something fun and challenging for everyone :)
    I'm also making the game free for everyone ( as i see this game as a hobby and a learning project of mine ), and for those who want to support the development and the work done for the game, they will be able to make a cheap one time purchase of a supporter account when the game is released, where the user will get access to exclusive cosmetic items. ( more info on the game's steam page )
     
    Last edited: Sep 10, 2015
  14. LazyPoet91

    LazyPoet91

    Joined:
    May 20, 2014
    Posts:
    35
    That sounds great (and very logical)

    I do not have any knowledge in programming, but this is exactly how I imagine that a game should be built. Many games today look like they are developed as a full finished work, and adding or changing stuff is almost impossible because it would require massive changes in code.

    Thumbs up for your great work. Why did you never go to Kickstarter with it? I do not know any "Indie" Shooter atm with such great potential. Okay, there is Cyclops and Line of Fire (maybe you saw them here on the forum) but both do not have this depth I see in your game. Can't wait to play it :)
     
  15. nxtboyIII

    nxtboyIII

    Joined:
    Jun 4, 2015
    Posts:
    229
    Yeah I agree I think he should make a Kickstarter
     
  16. georetro

    georetro

    Joined:
    Jan 18, 2013
    Posts:
    218
    I've been following this games progress for a very long time now, you can probably find me somewhere in the early posts lol

    I really like the non centred aiming system, it's a very original concept in my opinion. I think you should keep it!
     
  17. nxtboyIII

    nxtboyIII

    Joined:
    Jun 4, 2015
    Posts:
    229
    How did you handle the destruction in this game? For the big buildings, is it all premade animations?
     
  18. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    okay
    I think this is the closest i've ever gotten to get this working properly.

    Behold, the dual-camera first person rendering :eek:
    one_camera.jpg
    dual_camera.jpg

    no zoom: 11.jpg zoom: 12.jpg
    Environment stays the same, only the weapon perspective changes. (This image looks weird, but the environment has the same FOV and the first person objects have a small FOV.

    Here's the FOV that only affects the environment:
    fov.jpg

    This technique is so simple that i'm surprised i never thought to try something like this before...

    So, how?

    First of all, we have 2 cameras.

    First camera renders everything except the player layer - char, weapons, attachments that are on the player and have the layer "Player".
    Second camera renders everything.

    This requires NO shaders modifications as opposed to other techniques i tried before.

    So the technique is simple. Have every object that has a renderer to subscribe itself to a list of objects the second camera will use. This is very simple and fast for environment objects, since you can use only 1 script on the parent object of all of the environment and have it run on start, and automatically get all renderers of all children. For every instantiated object, the script has to be attached to the object. The objects also need to be un-subscribed if they are ever destroyed.
    If you switch objects from world to player and vice-versa, you need to change the layer of those objects too and add/remove those from the container.

    Code (csharp):
    1.  
    2. //CODE Simplified
    3. public class FirstPersonCamera_WorldObject : MonoBehaviour
    4.     {
    5.         public void Start()
    6.         {
    7.             Renderer[] rends = gameObject.GetComponentsInChildren<Renderer>();
    8.             for(int i = 0; i < rends.Length; i++)
    9.             {
    10.                 Player_FirstPersonCamera.renders.Add(rends[i]);
    11.             }
    12.         }
    13.     }
    14.  
    Now, for the Camera script, it's very simple.
    First of all, the camera needs to have its clipping planes to something small, [0.01, 2] for example.
    OnPreRender() will simply iterate that list of objects and set the shadow caster to shadows only.
    OnPostRender() will revert it back to what it was.

    Code (csharp):
    1.  
    2. //CODE Simplified
    3. public class Player_FirstPersonCamera : MonoBehaviour
    4.     {
    5.         public static List<Renderer> renders = new List<Renderer>(1000);
    6.         void OnPreRender()
    7.         {
    8.             for (int i = 0; i < renders.Count; i++)
    9.             {
    10.                 renders[i].shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.ShadowsOnly;
    11.             }
    12.         }
    13.         void OnPostRender()
    14.         {
    15.             for(int i = 0; i < renders.Count; i++)
    16.             {
    17.                 renders[i].shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On;
    18.             }
    19.         }
    20.     }
    21.  
    And... That's it for that part.

    Post process effects still work, but since you need to clear the depth buffer for the second camera, you need to merge the two together if you want depth based post-process effects to affect both cameras. Or if you only want the environment, copy the depth buffer from the first camera to the last camera before the post processing effects start. Should be fairly simple.


    So, the good stuff with this method:
    - No more clipping for first person objects,
    - High quality shadows for first person objects (since the clipping plane is so small),
    - Independent FOV for environment and first person objects.
    - No shader modifications

    The bad stuff:
    - Every object needs to be subscribed and unsubscribed from a container,
    - Scenes with tens of thousands of renderer objects on the scene needs to be updated every single frame. Might be heavy on weaker systems. It can be improved by checking if the renderer/object is actually active,
    - Depth buffer needs to be merged or removed from 1 camera before post processing effects if really needed.
    - World particles can be messy to work with this method. better to remove it from the second camera by putting them into a seperate layer.

    Do you have any ideas that could improve this method?
    Go ahead and try to improve it yourself too please :D . For now, i'm very happy with the results i'm getting. :)
    I discovered, created and setup this method in about one hour btw, so it's not perfect.

    Hope this can help a lot of people trying to do this in their games too :)

    EDIT:
    I know it can still be improved a lot, but it's a good start that i hope others will pickup and improve on.

    EDIT2:
    One improvement could be instead of subscribing each of the renderers to a single list, that list could be the actual scripts that are attached to the objects, and those scripts would have the list of the renderers of the children of the object.
    It would be easier to remove objects from the list.
    And maybe instead of a list, maybe a dictionary, so it's less heavy when removing objects from it. Thoughts?
     
    Last edited: Sep 18, 2015
  19. nxtboyIII

    nxtboyIII

    Joined:
    Jun 4, 2015
    Posts:
    229
    Cool. How do you always know what to do next in the game? Do you have some sort of list of things you want in the game or something?
     
  20. HolBol

    HolBol

    Joined:
    Feb 9, 2010
    Posts:
    2,888
    My issue with the dual camera setup is that first person objects only drawn by that camera won't receive shadowing from the environment.
     
  21. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    I usually just wing it.
    I try to focus on things that the game needs to work properly ( this dual-camera render was an exception :p )

    With this method, the first person objects WILL receive shadows from everything else. The second camera renders everything, but before rendering, turns every world object to a shadow caster, and since the first person camera has very small clipping planes, then the quality of the shadows will be practically pixel perfect :)
    Try this method out, it's very simple to set up.
    Also notice that there is a lot that can still be improved. The setup is simple, but for complex games, this needs to be further developed.
     
    Last edited: Sep 18, 2015
    shkar-noori likes this.
  22. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    The images above don't actually show it, but here's proof :D

    shadow test.jpg

    You can clearly see the first person objects don't clip through the object AND they receive shadows.
    I even made this image with shadows from speedtree trees and everything works perfectly!

    In this image, you can also notice the quality of the shadows that are hitting the "wall' on top, and you can see that the quality on the bottom is much higher, even though i didn't change the quality of the shadows.
     
  23. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,336
    Hey, I stumbled over your thread and just wanted to quickly chime in because what I see looks really exciting already! Contrary to what others have said I think that you actually are on the way to fill a niche in the overpopulated military shooter genre. For people that don't really play a lot of those games I'm sure they all will look the same but the level of immersion you are aiming for has to my knowledge never been implemented in such a game. The closest I know is Insurgency, which has off center aiming for hip firing weapons (and centered with aim down sights) and pretty immersive gunplay. If you haven't played that game a lot I urge you to catch up on that and analyze its shortcomings. The things that bother me and my friends the most in Insurgency are inconsistent hit registration and clunky movement. When running it is too easy to get stuck at a corner and many people trying to get through the same door is always a problem at the start of a round. But the hit registration is the biggest problem. The weapons in the game are all very deadly and when I have an AKM or a FAL with armor piercing ammo I know it is a one shot kill at close to mid ranges. Usually it works as it should but there are situations where enemies take 3 or more hits with a one-shot-kills gun until they drop and that gets us raging every time. If you want to make a solid multiplayer shooter I'd urge you to work out a rock solid system for this problem. I don't know a single Shooter that really has got that right so far. COD is unplayable for me with the p2p system (people come around a corner and shoot you before you even really see them on your end due to the lag or they shoot you when you already are in cover). CS:GO seemed a lot better to me but I haven't played that as extensively as Insurgency and I have read multiple times that it has the same problems with hit registration and that it is a problem with the Source engine.
    Best of luck with your game, I really hope to see this at the top of the shooter charts some day!
     
    eskovas likes this.
  24. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    @Martin_H
    Thank you very much for the comment :)

    Yes i've played Insurgency a few times before. I enjoy it very much but only in a few maps. I understand the clunkyness and movement problems you are describing.

    One of my primary goals is to have smooth gameplay. This goes for animations, transition between animations, weapon movement and aiming, environment collision etc etc.
    I constantly work on this. Always testing if it feels right.

    I also have a few features to implement that will give a very high level of immersion, so stay tuned :)

    Thank you for the kind comment and feedback :)
     
    Martin_H likes this.
  25. Swearsoft

    Swearsoft

    Joined:
    Mar 19, 2009
    Posts:
    1,629
    Do you mean first camera renders the environent and the second camera only the gun?
     
  26. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Technically no.
    The first camera renders everything that's not related to the player's Layer.
    The second camera renders every layer (except if you have some you don't want, like world particle effects, clouds, etc).

    However, the second camera turns every non-player renderers to 'shadow caster only' when doing the PreRender.
    This turns every object to a shadow caster that affects the player object.

    ----
    On a related note, i'm working on making a First Person Render package with this method, but more advanced and easier to set up and make it usable in a real game.
    I'm also going to give it away for free for everyone to use when it's done :)

    There might be better methods to achieve this (for example, implementing this directly in the rendering pipeline, or something), but this is the best one i've ever thought about. Biggest thing is that it doesn't require any shader modification and no need for duplicated objects in another layer :)
     
    Last edited: Sep 19, 2015
    Martin_H likes this.
  27. nxtboyIII

    nxtboyIII

    Joined:
    Jun 4, 2015
    Posts:
    229
    So what is left to do before the game releases?
     
  28. HolBol

    HolBol

    Joined:
    Feb 9, 2010
    Posts:
    2,888
    That's a really interesting way of working around the problem. I might have to steal that idea ;).
     
    eskovas likes this.
  29. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    No need to steal it :D i'll be giving away the FirstPersonView asset for free on the asset store when it's done :) You can then change/improve for your specific needs

    As i'm going to use this in my game, i'm going to make it game-ready. (at least until someone can invent a way to make a simpler and more performant system. Maybe incorporating it in the rendering pipeline or some magic i don't know :p )

    I'm making plenty of functionalities that will make the process as easy as possible. Same for transforming world objects to first person objects, adding objects to this system, automatic visible/invisible/enabled/disabled/OnDestroy handler.

    There are a few requisites for this to work with good performance, but hopefully it's not a problem for most of you.

    I'm making the package well documented and properly done :)

    Current tests i've made, i was able to have 1000 active renderer components in the scene and this system costed on average 0.8ms with my low voltage laptop
    As this is a CPU based system, here's my laptops CPU Specs: i5-4210U @ 1.7GHz.

    I already made a few improvements and performance improvements after this test and will be making more, so stats should get better. Things are looking pretty good :)

    EDIT:
    Just to update on this, i made a huge performance improvement. It now costs on average 0.4-0.5ms with 1000 active renderers in the scene. There are still some improvements i can do to this :D

    EDIT2:
    This performance improvement makes it so the system won't care about objects that are not rendered by the FPV camera, contrary to how it was before. This means that it will scale very well with large levels with a lot of renderers.

    What do you think? Is 0.5ms average on this kind of hardware good enough? :p
     
    Last edited: Sep 20, 2015
    MiniMe_ likes this.
  30. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    I think i'm getting closer and closer to something i can release :)

    Just tested on my desktop pc and i get average 0.2ms performance hit with 1000+ active renderers. It's currently generating 40B of garbage, but i'll fix that.
    This test was made with Unity's first person character prefab from the standard assets.
    fpv.jpg

    On my laptop i was getting ~ 0.4ms.

    EDIT:
    stress test with 10 000 active renderers = ~ 1.5ms
    stresstest.jpg

    EDIT2:
    Sorry for posting so many things, but, hum...
    fpv2.jpg
    Some more performance improvements.
    Same Stress test as earlier with 10k active renderers and it scored 0.65ms. Twice as fast as before :)
     
    Last edited: Sep 20, 2015
    dexxerg and LazyPoet91 like this.
  31. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,539
    That's interesting technique for the renderers, how about image effects are those working with your setup? usually any image effect that required depth buffer will be broken with 2 camera.
    EDIT: Oh nvm you already mention it that it need a workaround.
    I like the vaulting animation, are those mocap or keyframed?
     
    Last edited: Sep 21, 2015
  32. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Totally forgot about the image effects :D Thanks for reminding me. I'll implement the solution here too.
    I far as i remember, i'm positive i was able to translate the depth buffer between cameras before. For the merging part, it should also be possible, but a little heavier (since it's all done in the CPU). I'll make two options, where one simple replaces it and the other one merges it.
    Maybe someone knows of a better and faster way to do this? I would really appreciate

    I made the vaulting animation by hand in Blender. Every animation in the game was made by hand. :)


    EDIT:
    Seems like i don't know how to make the image effects render using the first camera's depth buffer. Does anyone know of a way to make it work?

    EDIT2:
    I don't think only using the first camera depth buffer will work because like that, the effects will draw depth based effects on top of the first person camera.
    Looks like both depths need to be merged for this to work.

    I also thought that using depth based image effects on the first camera would work, but the second camera simply removes them.

    EDIT3:
    Apparently i can make depth based image effects work when the first person camera is in forward mode and those effects are in the world camera component.
    But maybe using Forward rendering in the first person camera is a deal breaker for some?
     
    Last edited: Sep 21, 2015
  33. LargerEagle

    LargerEagle

    Joined:
    Aug 15, 2012
    Posts:
    59
    Crazy how much this project has changed and how you much you have improved. Keep it up can't wait to see how this turns out.
     
    eskovas likes this.
  34. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Just to update on the First Person View.

    I'm getting close to being able to release it for free on the Unity's Asset Store!

    FirstPersonView_feature.jpg

    FirstPersonView_environmentFOV.jpg

    FirstPersonView_environmentFOVFPV.jpg



    There is still one thing that is a limitation of this system, and that is being able to use depth based Post Processing Effects on the environment.
    If anyone knows a way to do this that supports most rendering options, or at least supports Deferred Rendering on both cameras, please let me know. I'll be releasing this for free for everyone soon :)

    EDIT:
    By the way, it took me less than 10 minutes to incorporate this into my game :)
     
    LargerEagle likes this.
  35. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    After battling with this for so many hours, searching every single google search and unity search for this, i finally found a way to make depth based image effects somewhat work with this setup :)

    depth.jpg

    Thanks to this thread @AlexBM : http://forum.unity3d.com/threads/postprocessing-issues-with-several-cameras.313903/

    I modified the script to this:
    Code (csharp):
    1.  
    2. public class PostProcessFilter : MonoBehaviour
    3. {
    4.     public Camera BackgroundCamera;
    5.     public Camera MainCamera;
    6.  
    7.     private RenderTexture mainRenderTexture;
    8.  
    9.     private int screenX;
    10.     private int screenY;
    11.  
    12.     // Use this for initialization
    13.     void Start()
    14.     {
    15.         screenX = Screen.width;
    16.         screenY = Screen.height;
    17.         CheckChangedResolution();
    18.     }
    19.  
    20.     void Update()
    21.     {
    22.         if(screenX != Screen.width || screenY != Screen.height)
    23.         {
    24.             CheckChangedResolution();
    25.         }
    26.     }
    27.  
    28.     void CheckChangedResolution()
    29.     {
    30.         screenX = Screen.width;
    31.         screenY = Screen.height;
    32.  
    33.         mainRenderTexture = new RenderTexture(screenX, screenY, 16, RenderTextureFormat.DefaultHDR);
    34.         mainRenderTexture.Create();
    35.  
    36.         BackgroundCamera.targetTexture = mainRenderTexture;
    37.         MainCamera.targetTexture = mainRenderTexture;
    38.     }
    39.  
    40.     void OnRenderImage(RenderTexture src, RenderTexture dest)
    41.     {
    42.         Graphics.Blit(mainRenderTexture, dest);
    43.     }
    44.  
    45. }
    46.  
    I also added automatic screen size change detection, so it updates the size of the render texture.
    Still haven't tested performance on this, but it's somewhat working.
    This script is put on a 3rd camera that doesn't render anything and all image effects (except for SSAO and a few others) are put after this script.

    EDIT:
    It works with Deferred Rendering on all cameras. I haven't tested other rendering setups yet.
     
    Last edited: Sep 22, 2015
    shkar-noori likes this.
  36. LazyPoet91

    LazyPoet91

    Joined:
    May 20, 2014
    Posts:
    35
    I would love Battlefield if it would focus on quality and details like NoHeroes does. DICE should be ashamed that they cannot do a real quality game with a 250.000.000$ and severeal teams.

    This game does have some things that Battlefield has - like destruction. But it does everything better and more uncluttered that Battlefield.
     
  37. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,539
    Oh wow what a coincidence , i was about to ask you to try using 3 camera, but i'm still worried about is there any overhead for using 3 camera rendering
     
  38. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Haven't seen any overhead yet.
    This is the final working code:
    Code (csharp):
    1.  
    2. public class FPV_ImageEffects : MonoBehaviour
    3.     {
    4.         public Camera WorldCamera;
    5.         public Camera FPVCamera;
    6.  
    7.         private RenderTexture mainRenderTexture;
    8.  
    9.         private int screenX;
    10.         private int screenY;
    11.  
    12.         //Render Texture Properties
    13.         //----- Change these properties for your specific needs -----
    14.         private RenderTextureFormat renderTextureFormat = RenderTextureFormat.DefaultHDR;
    15.         private int renderTextureDepth = 16; //Number of bits in depth buffer (0, 16 or 24). Note that only 24 bit depth has stencil buffer.
    16.  
    17.         void Start()
    18.         {
    19.             CreateRenderTexture();
    20.         }
    21.  
    22.         /// <summary>
    23.         /// Create the RenderTexture that will be used by both cameras.
    24.         /// </summary>
    25.         private void CreateRenderTexture()
    26.         {
    27.             screenX = Screen.width;
    28.             screenY = Screen.height;
    29.  
    30.             mainRenderTexture = new RenderTexture(screenX, screenY, renderTextureDepth, renderTextureFormat);
    31.             mainRenderTexture.Create();
    32.  
    33.             WorldCamera.targetTexture = mainRenderTexture;
    34.             FPVCamera.targetTexture = mainRenderTexture;
    35.         }
    36.  
    37.         void Update()
    38.         {
    39.             if (HasResolutionChanged())
    40.             {
    41.                 CreateRenderTexture();
    42.             }
    43.         }
    44.  
    45.         /// <summary>
    46.         /// Check if resolution of the screen has changed
    47.         /// </summary>
    48.         /// <returns></returns>
    49.         private bool HasResolutionChanged()
    50.         {
    51.             return screenX != Screen.width || screenY != Screen.height;
    52.         }
    53.  
    54.         /// <summary>
    55.         /// Set the active Render Texture to the mainRenderTexture
    56.         /// </summary>
    57.         void OnPreRender()
    58.         {
    59.             RenderTexture.active = mainRenderTexture;
    60.         }
    61.     }
    62.  
    I changed what to do with mainRenderTexture, but i suspect it's the same as it was before.
    Basically changed this:
    Code (csharp):
    1.  
    2. void OnRenderImage(RenderTexture src, RenderTexture dest)
    3.         {
    4.             Graphics.Blit(mainRenderTexture, dest);
    5.         }
    6.  
    to
    Code (csharp):
    1.  
    2. void OnPreRender()
    3.         {
    4.             RenderTexture.active = mainRenderTexture;
    5.         }
    6.  
    The resolution change and rendertexture update shouldn't be a problem, since it's a rare event. it should only be done when the resolution changes and not every frame.


    Here's one sure limitation of this system:
    - No support for tree shadows that are inside the terrain system. Trees outside of terrain works good.


    EDIT:
    One more big performance improvement.
    The algorithm no longer performs Camera.Equals(Camera) for every single object that the cameras will render. It now uses a Bool variable set by the First Person Camera when it's going to render and when it finishes rendering.
     
    Last edited: Sep 22, 2015
  39. Carve_Online

    Carve_Online

    Joined:
    Jun 28, 2014
    Posts:
    557
    That is a really cool approach to solving some of the camera issues.

    As far as the ´perfect clone´ comments. I will provide my insight. There are people out there who have only played one game in a genre... so when they see a second game that is in the same genre, they mistakenly think it is a clone, not realizing there are dozens if not hundreds of games in that genre.. all of which appear to be ´clones´ of whatever game that person happened to play first. And in most cases, their ´original´ game was probably just a derivative of something that came before it.

    You see it a lot with WOW, where everyone calls every MMORPG a wow-clone, when in reality, WOW is basically a clone of DAOC and EQ. But because WOW was their first MMORPG, everything appears to be a wow-clone to them.
     
    LazyPoet91 likes this.
  40. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    shkar-noori and SAOTA like this.
  41. MP-ul

    MP-ul

    Joined:
    Jan 25, 2014
    Posts:
    181
    You will be a Hero for this community man (y) Grate Job
     
    shkar-noori likes this.
  42. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Hello there,

    Just posting something that might be useful for those using dual camera setups.
    One common problem when using two cameras with different FOVs, is that the position/direction of things in First Person View and world view is not the same. You can actually see this problem in a few AAA games too, which i think it's strange.

    for example, if you have a laser on your weapon, and you use two different field of views, you will see that the two won't seem to be correctly placed.
    The solution i did was to use two points, one from the pivot of the laser and another one with pivot + pivot.forward).
    Then transform those points to the FPV Camera's screen coordinates ( WorldToScreenPoint ), and then transform those coordinates to World coordinates (ScreenToWorldPoint) by using the world camera.
    Then you just do (v2 - v1).normalized and there you have the new position and vector to perform raycasting or do other stuff correctly as you should see in the game.
    Here's a few images describing the problem. In the last image, i used extreme opposites FoV for both cameras to demonstrate that it is working.
    Haven't tested everything, but it's working :)

    2cameraproblem.jpg


    EDIT:
    I'll also add this solution to the First Person View asset :)
     
    Last edited: Sep 24, 2015
    shkar-noori, Magpul, MP-ul and 2 others like this.
  43. Swearsoft

    Swearsoft

    Joined:
    Mar 19, 2009
    Posts:
    1,629
  44. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Hello again :)

    Posting a few development updates

    Just like the laser problem i last posted, that problem also applied to the scope, which i also had to fix.

    I also made a comparison with using only one FoV and independent FoVs when aiming down sights:

    2cam vs 1 cam.jpg

    Makes quite a deference right? :p


    I also improved recoil and non centered aiming. here's a gif i posted on my twitter:
    https://twitter.com/Tiago11F/status/648558127890178048

    One other issue that i fixed was the precision of the bullets when aiming down sights, which was a big problem.

    Yesterday i decided that i wanted to have the very first High Quality asset in No Heroes because i was a little tired of the same very old assets, so i made a new reflex sight:
    reflex_sight.jpg

    I also already made the low-poly, baked every map and textured in Substance Painter, which i was very much impressed with the quality i got, and i only spent a few hours with it.

    It's not even close to AAA quality, but considering that i spent a few hours learning Substance Painter and painting the scope, i would say it's pretty good :D It's also good to see new models in the game with much higher quality than the ones i did a loooong time ago.

    sight.jpg

    Today i got a little time and implemented dual sight on scopes and easy switching between those.
    Here's a gif of it that i also posted on my twitter:
    https://twitter.com/Tiago11F/status/648974966101254144


    Besides all of this, i've also been working on the multiplayer front, making everything ready to introduce networked projectiles, player damage and more.


    EDIT:
    Just to elaborate a little more on the Scope problem and fix, here's an image describing it:
    scope.jpg

    In the second image, the weapon points at the window due to the non-centered aiming mechanic.
     
    Last edited: Sep 30, 2015
  45. MP-ul

    MP-ul

    Joined:
    Jan 25, 2014
    Posts:
    181
    Hey guis i need to show you this

    This is why you don't want to make the edges on a high rez sculpt of a model to sharp youre new model has the same problem that's in this image in the Left the edges are to sharp it maybe look smooth in Blender but on baking it wont be that smooth .
     
    Martin_H likes this.
  46. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    @Fenixake
    While it may look slightly better when it is very small, it needs to look good when up close. In my opinion, using smoothed edges makes the model look really bad, specially on hard surface models.
    The image with the texture above was taken inside Substance Painter and i never noticed any problems. I baked all maps using Substance Painter, which is miles ahead of blender (at least i got a much higher quality with SP).

    Here's a screenshot of it in Unity
    sight_edges.jpg

    Another angle inside Substance Painter (no AA)
    sight_2.jpg
     
    dexxerg likes this.
  47. Tiny-Man

    Tiny-Man

    Joined:
    Mar 22, 2014
    Posts:
    482
    Im afraid I have to do against it with looking better wit hthe hard edges. If you got on polycount everyone would scream at you for have those edges, its a big no no when making low poly assets. Also not a super big fan on the textures, there's no real material definition and just random noise for the sake of noise.
    Although I understand you're not a full time artist so can be hard to know all the practices and such.
    Thats just my critique ;)
     
  48. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,336
  49. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Yeah i'm not an artist, i'm a programmer :D
    I also haven't 3D modeled in awhile.

    I searched on the polycount forum and found models like this, which is similar to the level of edge smoothing i have:
    http://www.polycount.com/forum/showpost.php?p=2347700&postcount=617

    I think it looks much better like that than having it smoothed out.

    EDIT

    I looked through those images (looks great btw), and on 90º angles, the length of smoothing is very very small like the ones i did, or am i blind? :D

    EDIT
    Well, maybe the ones i did are a little bit smaller.

    Do you guys know of a few good examples of scopes, weapons on the polycount forums?
     
    Last edited: Sep 30, 2015
  50. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,336
    That guy has only 8 posts. You should look what experienced industry veterans like for example these guys do:
    http://www.polycount.com/forum/member.php?u=13650
    http://www.polycount.com/forum/member.php?u=13677
    ( http://www.polycount.com/forum/showthread.php?t=134116 )
    http://www.polycount.com/forum/member.php?u=19453
    There are many others, I just picked those because I remembered their names. Most of what I know about hardsurface modelling comes from their posts. I highly recommend checking out these threads:
    http://www.polycount.com/forum/showthread.php?t=81154
    http://www.polycount.com/forum/showthread.php?t=56014
    http://www.polycount.com/forum/showthread.php?t=107196
     
    eskovas likes this.
unityunity