Search Unity

Top-Down Shooter - True Line of Sight - Dynamic Splitscreen

Discussion in 'Works In Progress - Archive' started by Marrt, Feb 19, 2012.

  1. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    Hi,
    This thread shows how i am progressing with the first game i ever started, a Top-Down shooter featuring several uncommon game mechanics

    Web-Player (~30MB)

    GameMechanics:
    - Top-Down Shooter
    - True Line of Sight
    - Dynamic-Splitscreen-Aiming (Right mouse button)
    - directional shields
    - different weapon types: auto/semi/burst/charge with default/bouncing/seeking/ray projectiles
    - and a lot more to discover

    S1.jpg
    S2.jpg S3.jpg S4.jpg
     
    Last edited: Apr 12, 2015
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    nice!
    havent seen the original game, but i think just the controls seems to be too sensitive / fast..
    like going backwards or sideways could be much slower?

    what kind of "AI" you are planning to do for mobs..?
    (i saw one mob was running away from the ship : )
     
  3. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    Agree, increased the movement as i tested the zooming stuff and never reseted it to default... for dogfights its really to fast, such movement speed would would favor a strafe and spray playstyle, which i dont want. but the Speed or gamevariable tweaks are object of interest when the game has an UI and all the stuff.

    Also i dont want to make the moving speed depending on direction, that would make arcade movement (which lots of people prefer) somehow messy. even now the movent is flawed, holding "A+W" creates a squrt(2) times faster Vector that "A" alone, but i know how to change that...

    -"(i saw one mob was running away from the ship : )"
    LOL, i didnt notice that, the mob has its origin moved, now the attached ship model rotates around because the origin has lookAt(player)... interesting that it seems like its an escape AI... DAMN! i base this rotation on cursorPosition (origin looksat cursor) and BAM: simple-ass targeting evasion of enemies, ingenious!

    To be honest, enemy AI really isnt something that interests me right now, im aimin totally on pvp and before i implement an ai skript i will try to have it working with at least 2 players and lan... so it will be an simple preskripted movement + lookAt until then.

    but thats all so far away, next step is to add
    -ScreenAspect recognition for the automated zoom
    -HP, Shields
    -much more Weapons
    -Gadgets
    -Time.delta on the timing variables, if framerate breaks it would mess up the zoom and camera split timing
    -some ship models which i didnt draw with sketchup (shame on me)


    Im SO excited that i was able to bring the game to this status within a week, with YOUR help of course :D. I thought it would take me months to achieve the splitscreen and shadowing.
     
    Last edited: Feb 20, 2012
  4. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    Version 0.50 is ready, make sure you check out the Laser-Charging by holding Space and the Reticle detachement with RMB
     
  5. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    seems to have quite a lot of new stuff,
    does that multiplayer already work?
     
  6. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    -I'm already diggin in pvp multiplayer stuff. It seems its really the hardest part to achieve a fluent multiplayer gameplay. I just started to implement RPC calls and some transform/rigidbody synchronization. So for now you can have a few ships in the lobby and shoot. But only if i disable some stuff in my scripts so it wont work with the uploaded version. for shooting i only synchronize the weapontriggering, the instantiation of the massive amount of rigidbodys for the bullets is handled on every client separately ...with different random spread values from client to client... Also im pretty much sure the tractorBeam and moveable cover blocks would not work very well over network :'(

    -also i am changing your raycastShadow2 script a little, to get some different effects like a different range limit at the back 90 degreeCone of the ship

    -i will add some reticle recoil and camera shake on hit for better look and feel

    -At the time i try to understand this script :
    http://www.unifycommunity.com/wiki/index.php?title=NetworkView_Position_Sync
    its from the creator of "mars explorer" which has a fluent multiplayerOverInternet experience.

    -seems my free webhoster doesn't want to play .unity3d files anymore...
     
  7. ironbelly

    ironbelly

    Joined:
    Dec 26, 2011
    Posts:
    597
    top down co-op or pvp style games represent a seriously under developed nich if you ask me.. Not saying we don't have a few to choose from but they definitely are some of the funnest multiplayer experiences to have in a casual way. Concept is looking great, can't wait to see this developed further
     
  8. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Looks cool. Reminds me a buit of Frozen Synapse.
     
  9. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    Uploaded a networking version, u can have 2 webplayer open and use one as Host. for now there is no network inter- or extrapolation magic in it, simple dull and buggy rigidbody sync + synchronization of the plasmagunTrigger (default LMB weapon on startup) with unsynced recoil spreads.

    added improved weapon usage feel (only PlasmaGun and LaserSniper yet) :
    -i removed the random spread and added random recoil, so basically its a spread with feedback (like cod does it)
    -you can choose if you want the game to automatically realign the reticle with its previous aimpoint -ResetRecoilAuto ON
    -or not, so the player can manually respond to the recoil -ResetRecoilAuto OFF

    QUESTION:
    im not sure if:
    -i should leave the current SMOOTH-REALIGN (Lerp) of the Reticle with initial aimpoint
    -or use a CONSTANT-REALIGN-SPEED (MoveTowards) instead (cod has constant-realign-speed afaik)
     
    Last edited: Apr 10, 2012
  10. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    v0.78
    -Added Loadout menu
    -Implemented GenericWeaponscript to create all main guns out of a table
    -reticle customization

    v0.79
    -added muzzle flash, shooting feels much better now...
     
    Last edited: Apr 19, 2012
  11. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    v0.80
    -added some testing sounds, colored damage text, red:hull, violet:hulldamage from back 60 degree, blue: shield, yellow: selfdamage
     
  12. ncst

    ncst

    Joined:
    May 28, 2011
    Posts:
    207
    Nice work: I tried out the single player test mode, and I like the look of the game quite a bit. I didn't care for the WASD movements (in that they seemed to be relative to the ship's orientation, and not relative to the world: I spent too much time trying to figure out which key to press to move in the direction that I wanted).
     
  13. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    yeah, its not very "user friendly" at the current state, but i wanted to try out everything to know what feels best. so just to clarify:

    press 'x' to cycle between 3 movement modes (current mode is stated on top, green text):

    Regular: wasd-directions relative to ship
    Arcade: wasd-directions relative to camera - THIS is what you would prefer i guess
    RotateWithShip: kinda unpolished 3rd person
     
  14. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    v0.81

    -changed the singlePlayerTestLevel to look a little bit more like what i am aiming for.
    -added very basic roaming AI
    -added RightMouseButton Aim selection in Options (Toggle or Hold)
     
  15. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    -replaced DontGoThroughThings with my IntervalRaycastScript for Bullets - better impactAngle Detection

    -added random enemy Loadout (one of 3 random weapons, one of the 9 shields)

    -SinglePlayerTestLevel is pretty hard now, avoid the open, use cover and all your guns. You are outnumbered but have 4 times the firepower of a mob
     
    Last edited: Apr 23, 2012
  16. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    V0.82

    -added first Gadget: AimAid (default enabled)

    Press 'E' when reticle is on an enemy to activate targeting. Circles are shown to mark the area in which you have to shoot to hit the enemy based on their movement (and yours if you have inertia-affected weapons activated). Up to 4 circles are shown if you have 4 different weapon velocitys in your set.
     
  17. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    V0.84

    -added Tweak System (is essentially a attributes system for a gunship)
    choose your playstyle in each of the 4 disciplines
    OFFENSE: DMG or HitChance
    DEFENSE: Agility or Durability
    VIGOR: NrgRecovery or NrgCapacity
    CERTAINTY: ShieldRegeneration or MaxShielpPoints

    -added WeaponUpgrades
    change stats of Weapons, but there is always a drawbag by adding an Upgrade, so no upgraded weapon is overall better that its stock version (silencing, and hiding bullets isnt implemented yet, but the stats are updateable)

    -changed default movement mode as some people complained about movement
    Default is now - WASD relative to camera (Arcade Mode)
     
    Last edited: Apr 28, 2012
  18. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    v0.85
    -added Gadgets
    --PortalGun
    --PortModule
    --Xray
    --Gravity Generator
    --ScoutDrone
    --Marker

    -added Perks
    --TeleDodge
    --DragonflyVision
    --HeavyBackPlate
    --Bomber
    --SustainedFire
    --Pathfinder
     
  19. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    V0.86 -few changes, not noteworthy

    looking for some feedback concerning:
    -ship control (prefered mode, cycle through modes with 'x')
    -feel of shooting (Recoil handling)
    -weaponswitching (switchspeed, should i disable while switching)
    -Loadout (Gadgets usage, Reticles, balance of Tweaksystem)

    i know the game is not very user friendly as i have no symbols, refined layout in the menus or decent graphics/leveldesign, this is subject of change so please dont rate that now.
     
  20. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    V0.87d

    some neat little features added:
    $Capture.jpg
    -instant FOV-slider
    --see the difference immediately
    --or change to orthogonal projection

    -ghostReticle
    --toggle to show recoil only on the ghostly reticle for less camera shake
    --second mode shows a custom simulated ping as a delayed ghostly reticle

    tweaks
    -better loadbalancing for th simpleAI-Scripts
    -rotateWithShipCamera Movementmode improved
    -fixed a few bugs, created a lot of bugs
     
  21. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    V0.88f
    Added a Boss to the SinglePlayerTestLevel.
    I wonder if some people are able to beat him.

    $Untitled.jpg
     
  22. Khada

    Khada

    Joined:
    Feb 12, 2012
    Posts:
    5
    Hey Marrt,

    Game looks awesome! It also has a visibility system very similar to something I want to do for my next game. Any chance you would be willing to point me in the right direction for achieving a similar result? Doesn't look like it's done with built-in lighting. Certainly don't want/expect you to hand over your own work, just put me on the right track if it's not too much trouble?

    Game looks really good!

    Many thanks,

    Khada Kuraki.
     
  23. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    Of course i will give you the script as i have no intent to make money out of this game, i just want it to exist :D
    But some parts involve no scripting and the raycast script is from unityCoder:

    -the visibility polygon is achieved via a modified version of this:
    http://unitycoder.com/blog/2012/02/15/raycast-realtime-visibility-2-0/

    -but there are more solutions posted in my inital question thread:
    http://forum.unity3d.com/threads/123143-Cone-of-Sight-Visualization

    -there are solutions that use shader but all of the ones i've seen don't support a good resolution on distant objects.

    -ivkoni's solution was to draw a shadow for every vision obscuring object but that involved a lot of draw calls, so i sticked with the raycast thingy.

    the raycasts are very expensive and its the main thing that limits my fps but at least its a constant load, depending on how much objects it has to test against, so make a OWN layer for the walls.
    script i use, remember its basically a modified version of unityCoders script in the above link:
    View attachment $VisibilityMeshGenerator.cs

    But how to achieve visibility that hides objects?
    Culling masks! a brief overview (it took me 4 hours to set the inspector stuff right until it finally did what i wanted):
    -create 2 cameras (3 if you want a skybox)
    -these cameras have to have the same position/rotation/frustrum#
    -one camera only sees the skybox and has a low camera depth e.g. 59 in my case
    -one camera only sees everything but the skybox and has a higher camera depth, its drawn above the skybox cam, e.g. 60
    -the last camera is culled out by the visibility polygon and only draws the black areas, but above the other cameras depth 61, so its a bunch of cut out camera viewports that form the final picture, easy, i will add some editor pics...

    btw: if you have a splitscreen you need 6 cameras, all with different camera depths culling masks and you need to have SetRenderQueue from unify community on the visibility stuff...

    $editorVisi2.jpg

    i think you can scrap the skybox-camera if you dont use splitscreens, just experiment around a bit with culling masks.

    Did you beat the Boss?

    EDIT:
    only 4 cameras are needed, the skybox cameras can be scrapped if you set the clear flag of tha main camera to skybox too
     
    Last edited: Aug 21, 2012
  24. Khada

    Khada

    Joined:
    Feb 12, 2012
    Posts:
    5
    Hey Marrt,

    Thanks heaps for all that info! I have quite a bit of source material to work with now :D
    Afraid I didn't beat the boss - I always get my ass handed to me by 10 smaller ships :p
    Are you still working on this game? Polish could turn it into a really cool title!
     
  25. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    Yes, im still working on this game, but the last stuff i added was not really visible in-game:

    -lot of options
    -instant view of FOV changes + camera distance compensation
    -ping simulation reticle
    -a manable test Tank
    -and lots of litte tweaks that improve my functions (e.g. some of my generated directional shields were bugged)

    it really doesnt look like much now, but the i put 90% of the work on things that are hard to perceive:
    -shipLoadout with Gadgets and each gun can hold 2 upgrades, everything is generated from template scripts, to add a weapon e.g. i have to add a column of values and some effect prefabs
    -reticle that moves with the ship or can be detached on aiming, is limited by far range and can receive recoil without jumpingAround instantly, thats a hell of vector additions
    -limited shiprotation with a constant max rotation speed (smooth-rotation needs time to align, mine doesnt and is still not an ugly lookAt)
    -camera manipulation: autozoom, perfect fit on merge/split for splitscreens, camera never jumps instantly

    but the game was aimed to be a multiplayer game from the very beginning, as i finished my master thesis i will start to complete the multiplayer capability, then add some models/textures and i'll start calling this a game
     
  26. Khada

    Khada

    Joined:
    Feb 12, 2012
    Posts:
    5
    Awesome, it's certainly coming along! I played earlier and got up to the boss - got owned T__T

    The stuff you posted me was really helpful and I'm pretty close to having the lighting setup, but I've spent all day stuck on one point.

    Basically, how did you make the visibility mesh (from http://unitycoder.com/blog/2012/02/1...isibility-2-0/) ALLOW drawing instead of STOPPING it?

    I'm using the depth mask shader to only draw depth info into render target, but that stops anything from being rendered which means I need the inverse of the mesh I have (see image below). I tried to figure out how you're doing it but didn't get anywhere. At the moment I'm trying to pull out the render texture, invert all the depth info and override it, which seems more complicated/convoluted than it should be.



    Could you offer any further insight? :3

    Many thanks!
     
  27. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    you're doing right! the visibility mesh STOPS drawing, the key is that your darkness camera is cut out at the areas where your visibility polygon resides, therefore a viewport underneath your darknesscamera can shine through! just take a look at this veryveryvery early version of my game where i got it somehow working for the first time:

    pls don't judge the code, i have been scripting for the first time in my life 3 weeks before this version:
    View attachment $SpaceNoxV0.42.7z

    In case you cant open it:
    -un7zip it
    -in unity go to open project
    -select the unziped folder and press "select folder" button
     
  28. Khada

    Khada

    Joined:
    Feb 12, 2012
    Posts:
    5
    OHHHHHH MAAAAAAAAAAANNNN!!! /facepalm

    Thanks dude! I finally get it, haha. It's all in a working now :D

    I'm going to refractor it a bit (already have quite a bit >.>) and throw it on here (if It's any good).

    You've been a massive help! Thanks heaps for sending me your old build too!

    Actually, do you mind if I use your little ships as temporary placeholders? I'll never claim that they're mine etc :)

    Will post some results in the next day or two (bed time now and teaching from 9am till 9pm tomorrow).
     
  29. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    i wont mind, i have drawn them in 5 minutes in sketchup and they suck. use whatever you want from the code i posted, everything in there is totally outdated compared to my current build. :D
     
  30. Paintbrush

    Paintbrush

    Joined:
    Apr 1, 2009
    Posts:
    23
    Hey Marrt,

    I found this writeup very useful, thanks for posting it! I'm actually curious about another part of the visibility polygon implementation - object obscuring. Looking at VisibilityMeshGenerator.cs, I see that you check a raycast's target collider and call FadeIn on said collider's gameobject's VisibilityFader component. I'm actually wondering how you then get these gameobjects to fade out when no rays are hitting them? I can only imagine some sort of polling going on, but that feels very inefficient.

    Would appreciate any help!

    Thanks,
    Jay
     
  31. MagnusZane

    MagnusZane

    Joined:
    Feb 13, 2012
    Posts:
    147
    where'd you get your music? I use nosoapradio.com for all my demos. it has some music that would fit this game perfectly. music reminds me of their library.
     
  32. MagnusZane

    MagnusZane

    Joined:
    Feb 13, 2012
    Posts:
    147
    ah, that's where you got it
    :D just heard one of the songs I have used.
     
  33. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    When the Ray hits a Collider of my wall objects it calls a FadeIn()

    in if(RaycastHit)...
    Code (csharp):
    1. if(i%4==0){//only every 4th ray to reduce calls
    2.     if(hit.collider.gameObject.GetComponent<VisibilityFader>()){
    3.         hit.collider.gameObject.GetComponent<VisibilityFader>().FadeIn();
    4.     }
    5. }
    On startup of a level i add a Visibility Fader to each game Object that is tagged as wall, this is the fader, its a kind of polling, i dont know it any better yet

    the lower darkness is used because i have 2 different visibility modes, 'pitch black' and 'dark tint' - in which i only darken the objects a small bit and use a transparent dark tint to darken invisible areas

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class VisibilityFader : MonoBehaviour {
    5.    
    6.     private Material thisMaterial;
    7.     private Color color;
    8.    
    9.     private bool visible = false;
    10.     private float visibilityFactor = 0F; //smooth fadeout
    11.     private float lowA = 0F;    //lower alpha
    12.    
    13.     //check if color is already correct to save some calculation time for not visible objects
    14.     private bool finishedBlack = false;
    15.     private bool finishedWhite = false;
    16.    
    17.     private void Start () {
    18.         thisMaterial = this.renderer.material;
    19.         color = thisMaterial.color; //get the color of the material
    20.         thisMaterial.color = Color.black;   //apply the set alpha to the material
    21.     }
    22.    
    23.     private void Update () {
    24.        
    25.         //smooth color transition
    26.         if(visible  !finishedWhite){
    27.             visibilityFactor+=Time.deltaTime*5F;//fadeIn fast
    28.             if(visibilityFactor>1F){
    29.                 finishedWhite = true;
    30.             }
    31.             finishedBlack = false;
    32.             visibilityFactor = Mathf.Clamp(visibilityFactor,lowA,1F);
    33.             thisMaterial.color = Color.Lerp(Color.black,color,visibilityFactor);
    34.         }else if(!visible  !finishedBlack){
    35.             visibilityFactor-=Time.deltaTime*1F;//darken slowly
    36.             if(visibilityFactor<lowA){
    37.                 finishedBlack = true;
    38.             }
    39.             finishedWhite = false;
    40.             visibilityFactor = Mathf.Clamp(visibilityFactor,lowA,1F);
    41.             thisMaterial.color = Color.Lerp(Color.black,color,visibilityFactor);   
    42.         }visible = false;
    43.     }
    44.    
    45.     public void FadeIn(){
    46.         visible = true;
    47.     }
    48.    
    49.     public void SetBlackness(float blackness){
    50.         lowA = blackness;
    51.     }
    52. }

    yes, there is a link in the menu of the game, [about] then [Composer] on bottom
     
    Last edited: Nov 12, 2012
  34. Gorlog

    Gorlog

    Joined:
    Jan 20, 2011
    Posts:
    201
    damm its nice! but controls are too difficult :/
     
  35. Paintbrush

    Paintbrush

    Joined:
    Apr 1, 2009
    Posts:
    23
    @Marrt - thanks! that's actually a lot more elegant than I was planning, haha.
     
  36. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    You can try different control modes, cycle them with 'x'
    i prefer 'regular' (active mode can be seen on top) but lots of people like 'arcade' so i made it default...

    If you have suggestions pls let me know, it seems like i can't get the controls right, so some feedback would be nice :D
     
  37. 8 Bit Warlock

    8 Bit Warlock

    Joined:
    Nov 19, 2012
    Posts:
    30
    There are some cool ideas here but I found the whole thing to be quite noisy and felt myself getting a headache. I think if you worked on colour coding things that would help. I really like the visibility feature but when I first started playing I didn't know where to go because it looked like I was in an enclosed space.
     
  38. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    Yeah, I never did anything in terms of design, just some coloring/transparency for distinction purposes, everything is just placeholder graphics, even now.
    Has also been quite some time since i dug into the code, a lot off stuff is taking my time recently...

    but before i start the eye candy stuff and reducing the informational Load of the current build, i want my network-stuff working.

    for the enclosed place deception, maybe i should reset to the "Soft" Visibility instead of pitch black as default, can also be set in the DEBUG tab of the Option menu...
     
  39. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    Update V0.89

    -solved a view bugs
    -added weaponswitch cooldown
    -changed music
    -introduced a few conditions
    -added DPS to weaponstatsView
    -changed less noteable things
    -added selective Reload, hold R then press the Trigger of the gun to Reload
     
  40. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    -added audiostreaming
    -added first missile approach, default on weaponset2, press 'E' to lock target
    -added cumulative Damage figures

    EDIT:

    -added MissileTestLevel:
    --space: shoot
    --rightclick: pan
    --mousewheel: zoom
    --1-6: target
    --GUI-Controls: various Parameters of the homing modes
    $Untitled.jpg
     
    Last edited: Dec 10, 2012
  41. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    Added a 3D-Skybox (1/32 scaling)
    -was pretty hard to get it working combined with the splitscreen masking
    -at the edge of the map, some glitches may appear on certain zoom levels and camera angles
    -orthogonal camera mode is now completely fu****-up


    -looking forward to do a tutorial level...
     
  42. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    V0.9d:
    -added costum Rigidbody-smoothing for smoother camera follow (without the annoying lerp delay), Unity's Rigidbody inter/extrapolation wasn't working as expected
    see (http://forum.unity3d.com/threads/162694-SmoothMovementTest-should-help-eliminate-Hiccup-sources) for code

    -added DampeningTestField, decreases projectile speed to 20%

    -added 6s destruction Timer to projectiles

    -eliminated some bugs in the shieldscript
    -added physics materials and ship-collisions (no damage on collision is intended to encourage faster movement)
    -removed distance based RecoilCap

    Edit:
    -addet bullets bouncing off walls a limited amount of times (1x plasmaburst 3x cannon)
    -addet missile lock-on, hold reticle above target
     
    Last edited: Dec 24, 2012
  43. mktwo

    mktwo

    Joined:
    Dec 23, 2012
    Posts:
    10
    I've got to say, this is pretty cool!
    I especially like the detaching of the reticle, keep up the good work! :D
     
  44. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    -added Interpolation of shotInstantiation, now i can have firing rates that greatly exceed the framerate without having it capped by the frame rate:
    http://forum.unity3d.com/threads/14...his-simple-tip?p=991545&viewfull=1#post991545
    --however, if more than one shot is instantiated within one frame, concurrent shots within this frame won't be affected by recoil, i neglect that for now but i make a note...
    -fixed some bugs
    -refined missile lock-on, reduced lock-on time
    -changed some boss weapons (keep strafing or you are done)
    -started to reduce the redundancy in some scripts for better maintainability
    -added some weapons

    as always Webplayer can be found on first post...
     
    Last edited: Jan 6, 2013
  45. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    -improved the fireReady-bar (beneath each ammo-bar, bottom left)
    --fireReady-bar now correctly shows the time between bursts of burst-firing weapons
    --if the ammo-type of the weapon is belt or cooler, it also shows the time needed to cool the weapon or close the belt again if it is overheated or the belt ran out
    --simply put: if the bar is full, the weapon can be fired!

    -refined the interpolation, now the movement/camera transition should be completely hiccup free and feel absolutely smooth, even without camera smoothing enabled
    --(camera smoothing is just useful if you don't like the camera's direct response to mouse-input)

    smaller stuff
    -added a single muzzleflash texture, more to come
    -improved some scripts, solved some bugs

    ...looking forward to do a tutorial level, since the game is pretty packed now
     
    Last edited: Jan 7, 2013
  46. RCraig

    RCraig

    Joined:
    Jul 10, 2012
    Posts:
    9
    Hi Marrt! First off thanks for the sample of your code (the old SpaceNox linked earlier). I was using it to learn how you partially/fully culled enemies using the depthMask.

    Using your game for the depthMask setup and FOV2D http://forum.unity3d.com/threads/169476-Field-Of-View-2D-Based-On-Ray-Tracing-Free-Package for the mesh generation, I have it setup vertically (x/y instead of x/z) with two cameras and I use the FOV mesh as a mask against a transparent shadow plane. The shadow plane is properly culled by the FOV mesh. Areas the player can see look normally lit, while "hidden" areas are shaded darker with the shadow plane (this is working great!). I have the "cullable" objects on their own layer (like your EnemyObjects). The main camera (depth -1) draws everything but the FOV mesh shadow plane. The depth cam (depth 0) draws everything except the cullable objects.

    The problem is the "cullable" objects are always invisible (culled) no matter if the player can see them or not. I've tried moving them in front/behind the shadow plane/FOV mesh, no luck. I know I'm somewhat close with having the FOV working and producing those lovely pseudo-shadows.

    Am I just missing something simple? Should I be asking Dima instead? I can provide any of the code if you'd like to see it.

    Thanks!
     
  47. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    -Be sure that the camera behind the culled camera is able to see the hideable objects by checking "HideableObject"(or whatever it is called in your build) in the Editor (Culling Mask on the camera object)
    -Here is my current build (reduced sound sizes to make it only 6MB), it is far from finished, a lot of stuff in the code is still from my first programming tries, so please don't judge...

    SkyNoxSourceV0.90h
    View attachment $SkyNoxV0.90h.unitypackage

    To Start it:
    1. Import the Package into an empty project
    2. Add all scenes to the build (the order should not matter)
    3. open the Scene "GameMenuInit" and press play
    4. A layer error will appear, ignore this, it's due to the exportation of the package

    you always have to start from this scene since it carries the persistent game object that is instantiating everything the player needs
    Don't redistribute it, it is not finished and i don't want it to be reviewed by non-developers while it's half finished
     
    Last edited: Mar 13, 2013
  48. RCraig

    RCraig

    Joined:
    Jul 10, 2012
    Posts:
    9
    Hi Marrt! I greatly appreciate everything, and rest assured nothing will be redistributed by me. I'm simply trying to get my depthMask/object culling working properly.

    I will look at the new build you provided to see if I can spot what I may be missing. If I still can't get it functioning properly, I'll do a stripped-down prototype that is only for getting this to work (two cams, a floor, a few obstacles, the FOV mesh, the shadow plane, and "hideable" objects), and I'll get it to work on the X/Z plane first before transitioning to X/Y.

    Got lots to do now... Thanks again for your help!
     
  49. RCraig

    RCraig

    Joined:
    Jul 10, 2012
    Posts:
    9
    Hello again. I finally figured out at least part of the issue. I switched to your ShadowRayScan2 script to generate the visibility mesh instead of using Dima's FOV2D mesh. As soon as I did that, everything worked properly.

    I'll have to dig deeper to figure out the differences in the meshes.

    Either way, it works now and I can properly cull unseen enemies. :D

    I have no plans on releasing anything, but if I ever do, do you have any licensing on your visibility/shadows? The only work of yours I am using is the ShadowRayScan2.js script (from SpaceNox 0.42) and the concept of how to setup the two cameras + depthmask for culling. Though I've translated refactored the code into C# as my prototype is currently pure C#.

    Thanks yet again!

    (ps: Your game is looking awesome. Do let me know if you ever release it and I'll be sure to grab a copy!)
     
  50. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    Hi, ShadowRayScan2 is from mgear, please ask him (i think i noted that in the script didn't i):
    http://unitycoder.com/blog/2012/02/15/raycast-realtime-visibility-2-0/
    the newer version of my game also has a C# conversion of his scipt, with some special features i needed for particular effects like the confusion condition that narrows your pseudo field-of-view

    the raycasts are nice, but if you have unlimited range using splitscreen aiming the resolution(ray amount) has to be very high.
    therefore i am currently trying to get a geometric approach working
    http://forum.unity3d.com/threads/165283-2D-Dynamic-Shadows?p=1138484&viewfull=1#post1138484
    it would be cheaper and more accurate on distant objects. I am also aiming to make a prism out of the visibility mesh in order to create an 2.5D- like shadowmesh that will obstruct the sight. Then i can scrap that viewport culling because it renders parts of the screen that are later overwritten which is a waste of processing power