Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

On Rails Shooter Game Template

Discussion in 'Assets and Asset Store' started by puppeteer, Oct 14, 2016.

  1. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    No, it's not a project specific thing. The imported animations are usually read-only until you duplicate or copy their content and create a unity animation clip from them.

    Can you send me one of the animated models to see if I can duplicate it into a unity-editable clip?
     
    Nottingham1stBlood likes this.
  2. Area51audiovisuales

    Area51audiovisuales

    Joined:
    Jul 26, 2018
    Posts:
    2
    Hello friends, please I need help. Buy this asset and I want to implement it in a small game of augmented reality. I want to create a button to shoot and that the crosshair remains fixed in the center of the screen, in this way I will aim at the targets moving my cell phone. I can not make the crosshair remain fixed in the center and when I press the shoot button the crosshair fires in the same place where the button is located, please someone to tell me where I should edit the code since I can not find anything related to this, thank you very much
     
    puppeteer likes this.
  3. ecarter

    ecarter

    Joined:
    Jan 3, 2013
    Posts:
    21
    hello, are you going to release a new version? the last one is from is released on Jun 18, 2018
     
    puppeteer likes this.
  4. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    I'm trying to think of a way to approach this, first thing you should look at ORSGameController, which in turn controls the aiming position of the player.

    upload_2019-3-25_17-4-56.png

    So here you want to prevent the player from aiming where the mouse/tap point is and instead just aim at the center of the screen constantly. Something like this might be a good start:

    Code (CSharp):
    1. player.aimPosition = new Vector2(Screen.width * 0.5f, Screen.height * 0.5f);
     
  5. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    I did try to push something of a renewed demo for the project as an update, though it kind of fell through ( was too much modeling work for me and the result wasn't good ). I do want to make another push for an update, or at least that 1.3 weapons update that also didn't go through, I'm already very invested into this project and love it alot and want to see it improve more.
     
    Ale_alejandro and rrahim like this.
  6. TenFiddy

    TenFiddy

    Joined:
    Sep 28, 2017
    Posts:
    21
    I just bought your asset last week. I like it and have already converted in to work in VR. Now I am using it as the backbone to my new project. It will save me so much time. I am using OpenVR / Vive and Windows MR.

    Questions / Problems:

    1) Demo Slowdown - The giant worm at the end makes everything crawl. I removed your script on the worm prefab, but I still get the same effect...is it hidden somewhere else or...?

    2) Demo Firing Weapon - When I fire the weapon I am firing a projectile from the weapon muzzle. Works well, but there seems to be a delay when moving the weapon. Or in transition via waypoints. I move the weapon quickly when firing the vector that the projectile is instantiated from appears to be a little off. So, as I'm writing this, I didn't check your particle yet...maybe there is a delay.

    3) Demo Ghost in Transition - While moving in transition via waypoints there seems to be a ghosting effect with anything I am carrying in VR. Like a weapon or just the controller itself.

    i am just looking for any help / direction so that I don't have to write things over again. Trying to get maximum fps, performance and simplicity before building more levels.

    Also - I am interfacing with your code via playmaker. I did make some alterations in order to communicate with it, but it seems to work well.

    BTW - I like your code. Clean and simple. And fun to dissect.
     
    Proto-G and tng2903 like this.
  7. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Thanks for the purchase!

    1) The slowdown script is attached to waypoint (16) and is activated when reaching it. It has a timer of 2.5 seconds ( multiplied by timeScale ) and then it resets back to normal time scale.

    upload_2019-4-6_15-4-25.png

    I think 2) and 3) are related to performance in a VR environment. Does the ghosting and delay in shooting ( projectile that seems to come out of the muzzle point in a previous frame ) happen at the same time?

    Try to put the whole game into an empty scene that has no environment in it, and see how it performs in VR, and then see what can be done to improve it.
     
  8. TenFiddy

    TenFiddy

    Joined:
    Sep 28, 2017
    Posts:
    21
    Thanks for the fast reply - I figured out the slow down script...and where it was, right after I wrote the last message - lol

    The ghosting does not seem to be performance induced (I am running it on a GTX1080). It may be the way I am interfacing with your script. I changed "fire" button into a another bool variable and then passed it along to your code. I think I will just call the method instead. Maybe that tiny bit of time will effect it. I will experiment. (update: No difference with the call method) It's probably a rendering setting... I will investigate.

    Now more questions:

    What is involved in making more projectiles? I mean I have the projectiles, but want to introduce them into your controller.

    And, I am using projectiles instead of raycast (that's why I like your script..) I want to be able to dodge shots, shoot others and block some in VR. So, I will set up a different aiming script for enemies in VR. I will probably just make another head camera move the transform around the player randomly. I will make the motion/accuracy dependent on the VR players' movement. Then your script will aim at that transform point. Right?

    And are the projectiles hitting a collider on the player? Or just raycasting?
    If so, then I will use the of the hitpoint from the projectiles to decal my hud.

    Can I shoot myself? hmmm...

    I will post a little video soon.
     
    EN_Games likes this.
  9. TenFiddy

    TenFiddy

    Joined:
    Sep 28, 2017
    Posts:
    21
    Here is a quick video of ORS in VR. Work in progress.

     
    Last edited: Apr 23, 2019
  10. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Wow looks amazing!

    BTW, I just had a weird ghosting experience with a new laptop I got. It was set by default to 60Hz on Win10 and I had to change it to 144 to prevent that issue.

    What are you planning next for the project?
     
  11. TenFiddy

    TenFiddy

    Joined:
    Sep 28, 2017
    Posts:
    21
    Thanks -

    I plan on working more with this ORS game and making it into a real thing:

    Adding:
    -More Enemies; Animated and IK and Bosses
    -Deflecting shots with a shield then being able to make the deflected projectile explode by shooting it - causing AOE to the enemies
    -Sniper Weapon
    -New Levels - Underwater, Mayan Forest, Frozen Castle
    -Secret Areas
    -Weapon Animations
    -Night Levels with flashlight
    -Attachment and weapon perks

    And I will make some videos in the next couple of weeks to show people how I made the VR version of ORS. A bunch of people have reached out to ask questions.

    Thanks for the ghosting tip and the awesome template.
     
    Last edited: May 1, 2019
  12. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Deflecting shots sounds like an great idea. Don't know how you plan to do it, but the way I would approach it is in two parts:

    1. Shield script+collider detects enemy shot.
    2. Remove the shot script, add a rigidbody+AOE+Enemy(not projectile) components, and throw it in a meaningful way away from the player and towards the enemy that shot it so that the player gets a chance to shoot it in time and explode it.
     
  13. TenFiddy

    TenFiddy

    Joined:
    Sep 28, 2017
    Posts:
    21
    Did it...

    I will post a new short video to show it off.

    Basically - I tried to deflect using colliders - but fast moving object can screw up collision detection. I didn't want the cpu to mess with physics (because of slowdown in VR). I looked at the way you were detecting player hits by just measuring the transform distance of the player from the projectile. I used a similar method. I attached a script to each projectile to look for the "shield" object (my left hand/controller) and measure the distance from the transform and then explode when close enough. No slowdown!

    I made another version that, when blocked, sends shots back to their starting position/NPC and explodes.

    I also added a small raycast of .5f to the the forward direction of the projectile. It looks for the tag of the collider it is hitting. And then send the applicable data to the object. Like, a barrel you use for cover. It looks for cover tag. Gets close enough, explodes, sends a hit message to your script and deducts from the heath. So now NPC's can explode cover items.

    To bring a cover item to you I made a script that uses a short 5.0f raycast from the left hand controller. If it detects a "cover" tag while the trigger is pressed. It shakes and starts to be pulled toward a spot in front of the player. (Like a jedi force). Then you can physically duck behind it. The bullets ricochet off.


    Tonight - I am working on blocking rockets from one of my NPC's using the same technique, but, instead of exploding, I am instantiating a similar object that will use gravity. I wrote a script that will pick a random spot on the ground. Then measure the distance from the new instantiated object. Then, a random time to reach the spot. Then I calculate the angle and force required to get it there. Add force to the object and flies in an arch to the spot. The object has your destroyable script on it. So it can be shot causing damage from AOE.

    And I made working VR hands that react to blocking, pull cover (magic) and hold the guns / pull triggers.

    Next I plan on:

    1) Adding secret branching paths by placing 3 paths in your script. But hiding the arrow and collider for 1...Then if you pull a switch (using the powers) or hit something... the arrow and collider appear. Would that work?

    2)Adding a switch as an enemy to your script and then a player cannot progress without activating the switch. (like a door will open) as the "death" action.

    3)Pulling NPCs toward the player when "dizzy" and then switching weapons to a melee weapon by reaching behind your back/head - then pummeling the NPC ...

    Cheers... thanks for the input and inspiration.

    Tutorial vids coming soon

    -Fiddy
     
    Last edited: Apr 30, 2019
  14. TenFiddy

    TenFiddy

    Joined:
    Sep 28, 2017
    Posts:
    21
    Demo 2



    Projectiles are blocked by calculating the speed of the VR controllers... then using the speed as a variable incorporated into the deflected projectile formula. So the deflection feels natural and the interaction is dynamic. Basically- hit it harder and it takes less time to reach a predefined point on the ground, then physics takes over.

    I am having a strange problem. Some of my characters don't respond to AOE from my blocked projectile. Secrets? And when I instantiate the new blocked projectile, it can hit enemies, but does no damage on contact. I can hack that, but what are your thoughts as to why?

    And if anyone is asking "how do you duck behind cover" - Well, it's VR and I am actually doing the ducking by bending my knees -lol.

    Any comments are appreciated - thanks

    NEXT:

    -Pulling in enemies that are dazed to pummel them with my fist or a melee weapon.
    -Pulling switches from a distance
    -Opening doors from a distance
    -Sniper Rifle
     
    Last edited: May 1, 2019
  15. captremi

    captremi

    Joined:
    Feb 8, 2019
    Posts:
    3
    Hello,

    I am very sorry as I imagine it is certainly obvious, but I have trouble opening the project in unity. I have created a new project, and importing of assets worked, but nothing appears in the Scene window.

    Not sure if it is related, but among other errors I get "Lighting data asset LightingData is incompatible with the current Unity version. Please use Generate Lighting to rebuild the lighting data. Realtime Global Illumination cannot be used until the lighting data is rebuilt."

    Any help with how to open this asset in Unity 2019 would be great.

    thanks a lot,
     
    puppeteer likes this.
  16. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    These warnings are related to the lighting info in the current scene. You can regenerate the lighting by going from the top menu to Window > Rendering > Lighting Settings and pressing Generate Lighting again. The process takes some time depending on the complexity of the scene.


    upload_2019-5-8_22-0-27.png
     
  17. captremi

    captremi

    Joined:
    Feb 8, 2019
    Posts:
    3
    Thanks a lot for your help and prompt answer, it worked great.

    thanks
     
    puppeteer likes this.
  18. Serious_Adam

    Serious_Adam

    Joined:
    Dec 1, 2014
    Posts:
    8
    Hey!
    I found a slight issue when trying to make the camera "Look at Enemies" with the checkbox.
    I get the following error when i check or uncheck the box
    upload_2019-6-29_10-54-2.png
    upload_2019-6-29_10-53-40.png

    Is there any updated information or way to get around this issue?

    Im pretty much trying to get the camera to adjust when an enemy becomes active on the screen.

    Thank you
     
    puppeteer likes this.
  19. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Does the error happen at runtime or does it stop the game from running? ("must fix all errors before running")
     
    Serious_Adam likes this.
  20. Serious_Adam

    Serious_Adam

    Joined:
    Dec 1, 2014
    Posts:
    8
    THis happens before runtime but only when i hit the check box

    It also does not stop the game from running
     
  21. Serious_Adam

    Serious_Adam

    Joined:
    Dec 1, 2014
    Posts:
    8
    To be specific about steps
    Enter AlienBlaster.unity scene
    upload_2019-6-29_11-58-36.png

    Secondly go to Waypoint 6 in the scene view and you will see 3 enemies
    upload_2019-6-29_11-59-6.png

    After selecting waypoint 6 go to the inspector and check / uncheck the box Look At Enemies\
    upload_2019-6-29_12-1-5.png

    You will see the errors happening in the console
    upload_2019-6-29_12-1-28.png


    The other issue i see is that the result of this makes the camera very jittery when it tries to look at the enemies on the screen during runtime
     
  22. Serious_Adam

    Serious_Adam

    Joined:
    Dec 1, 2014
    Posts:
    8
    also!
    I have tried the asset in unity versions
    2017
    2018
    2019

    to try and rule it out but no luck on that front.
     
  23. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
  24. Serious_Adam

    Serious_Adam

    Joined:
    Dec 1, 2014
    Posts:
    8

    Thank you for the respone it solved the error but it is still not focusing and following enemies.

    It appears that it is Fighting to look at another position.
    This is my setting currently for the waypoint and enemy.
    upload_2019-6-29_16-51-36.png


    Click this image below its a gif if it in action its low frame rate but you can see it seems to be jittering
    gu6ej5Xc1Z.gif

    I have attached a gif showing what it looks like during gameplay
    And here is the setup of the waypoint
    upload_2019-6-29_16-54-20.png
     
  25. Serious_Adam

    Serious_Adam

    Joined:
    Dec 1, 2014
    Posts:
    8
    I have gone and done a new scene and noticed these warnings at the beginning , not sure if this helps!
    upload_2019-6-30_10-6-35.png
     
  26. Serious_Adam

    Serious_Adam

    Joined:
    Dec 1, 2014
    Posts:
    8
    SOLVED for the moment!!!
    I realized that in your Script ORSGameController.cs LINE 277
    There is a line commented out in the camera code to look at the players was commented out for some reason.
    upload_2019-6-30_10-33-53.png

    I've uncommented and now it is working properly!!!

    Woooooo!!!!
    I did not comment this out it seems to be part of the Unity asset store package.

    let me know if it was a mistake or there is reason for it! but for now it seems to work !
     
    puppeteer likes this.
  27. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Awesome, glad you solved it!

    What this actually does is make the camera look at the center point between multiple enemies so that they are all kept within the camera view, but I'm not sure why using the head as the source of point of reference would make it jittery like that.

    I'll try to see if I can make it work both ways without the jitter.
     
    rrahim likes this.
  28. Serious_Adam

    Serious_Adam

    Joined:
    Dec 1, 2014
    Posts:
    8
    Awesome Thanks!

    Cant wait to find out more :D
     
  29. J0linar

    J0linar

    Joined:
    Dec 12, 2013
    Posts:
    83
    @puppeteer
    Am trying to make some sort of game in a game and atm am Puzzling/Struggling with something... Since you know your own product best ...

    I got the OnRailShooter Running on a render to texture, my issue is i cant get the crosshair to be visible and controlled on the render to texture. Imagine you play a fps where you end up at an Arcade and you actually play a game on it... well thats what am trying to do.
    Any idea how to accomplish this with render to texture?
     
    puppeteer likes this.
  30. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,418
    @TenFiddy do you sell your VR integration? I need that so bad :(
     
  31. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Do other UI canvas elements appear on that texture correctly? If so, then I would guess the issue is related to the translation of the mouse position to a crosshair position on the canvas.

    First place to try it is in the code here in the Aiming function inside ORSGameController:

    upload_2019-8-17_22-46-45.png

    Here there are two things to look for, first look at player.aimPosition which sets where the crosshair will be looking, and then player.crosshair.position = player.aimPosition; which sets the final crosshair position.

    As a test try to set aimPosition to the exact middle of the screen and see if it appears on your texture. If it happens as expected, then you can start playing with the range of positioning on that texture until you can get aiming to match the width/height of the texture as if it was the actual screen.
     
  32. the_cerberus

    the_cerberus

    Joined:
    Aug 20, 2019
    Posts:
    10
    I like your Asset. Its wonderful. Creating a game without coding is a dream.

    I think there is one thing that realy is missing. Arms and Legs. I think ingame sequenses, where player interact with npc (witch arms and legs) will improve the storytelling. This is only one example. Cutszenes like HOTD, where you can see you charakter in a cutszene, slows down the gameflow and is not immersive as it could.

    And an option, that allows you give enemies a target, to attack. So you can improve the ingame sequence.
    For example: A friendliy helicopter attack the enemy squad, or an carchase and the enemy shoot at your car.

    Something like this. Its not 1990´s, storytelling in a Lightgun Shooter can be the next big thing.

    And maybe a (simple) quest system. Like in many mobile games.
    Kill all enemies with headshot, finish the level under ...time., collect all rabbits. somthing like this.

    Sorry for my bad english. Greetings from Germany
     
    puppeteer likes this.
  33. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Good ideas, thanks for the suggestions. I think maybe it's time I try Cinemachine as a way to manage some of the events happening in the game. And being able to pit units against each other can make the experience more engaging for players.
     
    DrOcto likes this.
  34. the_cerberus

    the_cerberus

    Joined:
    Aug 20, 2019
    Posts:
    10
    I'm looking forward to the release of the next version.
    Will the release of the new version take place at the end of september?
     
    puppeteer and DrOcto like this.
  35. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    There should be an update ready end of month. I'll post some screens tomorrow!
     
  36. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    OK, starting with something small. I'll be adding friendly targets which should not be shot or you'll lose score. It was possible before btw, but wasn't part of a demo.

    FriendlySolider.gif
     
    rrahim likes this.
  37. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Another thing from the list for the new update, auto charging weapon that reloads one ammo every X seconds ( like an energy weapon that refills ).

    ORSChargerWeapon.gif

    If you set the weapon Auto Refill value to higher than 0, it will add 1 ammo to the weapon every X seconds.

    upload_2019-9-16_18-10-42.png
     
    rrahim likes this.
  38. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Another feature in the upcoming update, you can now set multiple muzzles for each weapon. This allows you to have weapons that shoot from a different corner of the screen, as well as gattling gun style weapons that shoot in sequence ( or randomly ) from several muzzle points.

    ORSMultipleMuzzles.gif
     
    rrahim likes this.
  39. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Adding homing shots to this update too.

    upload_2019-9-27_19-58-26.png

    If you set the homingSpeed value of a projectile to higher than 0, it will automatically look for the nearest active enemy at a waypoint and rotate towards it.

    ORSHomingShot.gif
     
  40. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Next update is ready and submitted, hope it gets approved soon!



    1.30 (01.10.2019):

    - New energy weapon type, that autofills ammo over time.
    - New homing weapon type that rotates towards the nearest target.
    - You can set a path for enemies, and they will walk along it in a loop.
    - Friendly soldiers that must not be shot or you’ll lose score.
    - Weapons now use muzzles, so you can have multi-barreled weapons.
    - Removed dead body rotation from Enemy script, added standalone rotation script instead.
    - If we pick up a weapon it fills the next available empty slot in the player weapons array.
    - Removed collider and rigidbody from Blaster weapon.
    - If no attacks are assigned to Enemy, it will not try to attack. (Used for friendlies)
     
    the_cerberus, NathanG and rrahim like this.
  41. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Here's a short vid showing how you can add a path to an enemy:

     
    rrahim and the_cerberus like this.
  42. Shortay91

    Shortay91

    Joined:
    Nov 15, 2012
    Posts:
    25
    *** I found the answer just lined out the respawn code for max health in ORS Game Controller ***

    Hi Guys,

    I'm stuck on a problem,

    So I have set my Enemies to Spawn = True(so they are already spawned before player reaches waypoint)

    Is there a way that the player can shoot the enemy and decrease it's health before it reaches the waypoint?

    As it doesn't seem to do damage until it reaches the waypoint.

    Thanks,
     
    Last edited: Nov 4, 2019
    puppeteer likes this.
  43. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Good find! I think you can also prevent the disable of the collider so it gets hit before we reach it too.
     
  44. JamieVRcade

    JamieVRcade

    Joined:
    Oct 21, 2012
    Posts:
    32
    Hey there,

    I am looking to create a Starfox style shooting experience. However, in the demo project, my shots do not line up with my reticle in editor. My aim is always significantly off from where I am pointing.

    Assuming I get past this problem, I would like to explore how to get firing working in VR. Does the projectile emit from the muzzle and would it be as simple as controlling the muzzle's position with a tracked VR controller and remapping fire to the controller button? I want the reticle to project onto a surface in front of the player to give them a visual reticle of where they are pointing.

    Thanks!

    Update: changing the target eye to none in the camera settings and turning off camera shake fixed the problem.

    Now I need to be able to point the aiming reticle with a Touch controller. It seems that even moving the muzzle with the touch controller doesn't actually affect how or where it fires. What would be the best way to be able to aim these weapons in VR?
     
    Last edited: Dec 2, 2019
    puppeteer likes this.
  45. OribeWareGames

    OribeWareGames

    Joined:
    Jan 25, 2015
    Posts:
    24
    Finally got a chance to check this engine! really excited to play with it!
     
    puppeteer likes this.
  46. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    This is something I really want to get into ( bought a Quest recently ) but I just can't find the time. I know others have done it already with this template, but I'm not familiar with the intricacies.

    For aiming the weapon, take a look at this video with a "3rd person" controller which is basically making the weapon object rotate to aim and having the muzzle ( where the shots come out of ) inside the weapon object. If you assign this as one of the controllers, would it help?

     
  47. Shortay91

    Shortay91

    Joined:
    Nov 15, 2012
    Posts:
    25
    Hi Guys,

    Have another little issue, I noticed that when I'm moving to a waypoint the camera path doesn't fully finish it's rotation, it finishes after all the enemies are killed.

    Is there a way I can get the camera rotation to finish first before the enemies are active on the waypoint, I mean I can speed up the rotation but it's not the desired the effect as it's slightly fast and not as smooth.

    Thanks
     
    puppeteer likes this.
  48. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Right now the player will move and rotate until one of two things happens: He gets within 0.5 point distance to the target, or he gets within 1 degree rotation to the target. I think you can make sure both these things happen before enemies appear by changing the || to && so that he keeps moving until he is both close enough in distance and angle.

    upload_2019-12-11_10-57-2.png
     
  49. Shortay91

    Shortay91

    Joined:
    Nov 15, 2012
    Posts:
    25
    When I put the && it just snaps to the target waypoint without a smooth transition, I worked around this by putting waypoints in the middle to compensate the look towards the waypoint for better transition! thanks anyway!
     
    puppeteer likes this.
  50. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Good solution, you can also try to change the turnSpeed value to make the player not snap too quickly to match the target waypoint.

    upload_2019-12-15_11-4-28.png