Announcement

Collapse
No announcement yet.

[CODE] Gears of War-style camera and cover system

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    I've managed to get the camera working - what doesn't seem to be working is the muzzle flash graphics, a reload option or most crucially the cover system. I think I've put everything where it ought to be but I'm sure I've missed something crucial. If anyone has any pointers that would be fantastic. I haven't tried utilising the AI yet.

    Once again, great work, I'm finding it very helpful to learn about how UnrealScript works.

    Leave a comment:


  • replied
    Hi cover doesn't seem to work at all. I have this in a fresh install of udk. I added a StartAim onrelease StopAim to DefaultInput.ini
    Do I need to do something else?

    Also does anyone know where the bWorldGeomtry checkbox is? never heard of it before and can't find it anywhere.

    Leave a comment:


  • replied
    This is excellent.

    Is it too much of a noobish request for some pointers as to where to put all the classes? I am about as beginner as it gets when it comes to coding but I'd love to see something like this in action in my own build.

    Leave a comment:


  • replied
    I have no desire to make a Third Person Shooter (or stealth game for that matter) but your code in both cases have helped me tremendously in learning how to script....Thank you so much for Sharing!!

    Leave a comment:


  • replied
    Hi DemoMan2,

    You don't need anything special for the minute, you just need an actor to be set to bWorldGeometry=true for the player to take cover behind it. By default I think this is all static mesh actors and BSP geometry. It may also work with kActors, but don't quote me on that. In the example level I show in the video, those crates are just the static meshes I dragged in from the editor, I didn't do anything else with them. The code will run traces to "feel" where cover is and determine if the pawn needs to duck or stack left or right, it isn't actually aware of what object the player is covering behind, so in theory you could have dozens of tiny individual bricks stacked on top of each other and the code will treat it like one big wall.

    Leave a comment:


  • replied
    Great work!. One question. Do you have to do anything special to your game levels to incorporate this cover system? If so, could you provide a simple two room example map?

    Leave a comment:


  • replied
    You might wanna change Projectiles(0)=class'StealthFrameworkProjectile_Ri fle' at TPSWeapon_Rifle (line 38) to something else.

    Leave a comment:


  • replied
    If the cover the pawn is sliding into is actually BSP geometry (not a static mesh) then that might explain why he slides towards the middle of the map, as he's actually heading towards the worldinfo origin (Vector 0,0,0).

    An actor's location is determined by its centre, so for the default player pawn, it's somewhere inside his hips, for a square cube it would be the dead centre of the cube, for a BSP brush it will be the world origin (0,0,0) etc. This means that if you slide the pawn into a hit actor's location variable, then he will always head towards the centre of whatever object the player wanted to cover behind rather than the spot where the player was looking at when they pressed the cover button. This is why it's better if you run a trace, store the location at which the trace hit the actor (or BSP brush) and set that as the pawn's destination rather than HitActor.Location.

    The idea behind sliding them until they hit something is that if something gets in the way of the pawn while they're sliding (such as an enemy or another player, bit of debris etc) then it will cause the slide to abort automatically, rather than they just get stuck in the sliding state until they reach their destination (which could be never if the blockage won't move). Generally speaking, unless something is in the way, their speed should not drop until they hit the piece of cover they're sliding towards since you update the velocity each tick.

    Hope this is a bit clearer! Would like to see a video of what you've come up with

    Leave a comment:


  • replied
    Thanks for your tips, Neoptolemus!
    So you mean the Pawn doesnt move to a specific point in the world but in a specific direction until he hits something?
    When i tryed to store the HitActor.Location in GetCoverNorm and use that as targetvector my Pawn always slides to the middle of the map, doh.
    I will look into that tonight. So i still suck at 3D-Math i thought i could avoid it
    I have a State for the slide but not implemented the Tick so my Pawn instantly slides at given speed to the wall.

    Again, thank you very much!

    P.S. will try to record a short video, maybe you wanne see how your code is used?

    Leave a comment:


  • replied
    Hi, thanks for the feedback so far!

    FastFertig, my thoughts would be something like this. Alter the GetCoverNorm so that it also stores the location at which the trace from the pawn's location hit the world geometry, then subtract the vectors to retrieve the direction the pawn needs to slide in. Then you can create a new state called "SlidingIntoCover" or something, where the pawn's velocity is updated each tick in that direction until their VSize(Velocity) is below a certain threshold, at which point it drops into cover. See the code I use for sprinting where I check to see if the pawn's speed has dropped below 20, which means it must have hit something. That should allow the pawn to slide to the point the player was "aiming" at, rather than the actor's location which could be off to the side.

    Leave a comment:


  • replied
    great Work, thanks for sharing!

    Have integrated this into my code and played a bit around, really cool stuff.
    I would like to improve this with a "slide to cover" machanic like in Gears. I use your GetCoverNorm-Function to get an Actor(Mesh), then i increase Pawn.Groundspeed and Pawn.Velocity and use MoveToward(Actor). Than Takecover() will be triggert. It works (kind of) but only in the direction my Pawn is facing at Levelstart.

    Maybe you have any suggetions on how to approach this machanic? Or am i completely off the track?

    Thanks a lot and sorry for my english

    Leave a comment:


  • replied
    Holy **** yeah man a cover system is a thing I have been failing at.
    You = awesome

    downloading now and will use it too!
    thank you

    Leave a comment:


  • started a topic [CODE] Gears of War-style camera and cover system

    [CODE] Gears of War-style camera and cover system

    Hi all,

    I've put together some code to create a cover and camera system similar to gears of war for people to use. It works by firing a series of traces to determine if the pawn is fully behind cover, partially behind cover, whether they need to crouch and what angle they need to rotate to put their back flat against the cover. It also contains a Gears of War style reloading system, with timed reloads and damage boosts for getting the timing right.


    Video:




    Features:

    - Full cover system. Player will crouch automatically behind low cover, stack left or right when they reach an edge and can pop in and out to fire
    - Player sprinting
    - Walking, aiming, stacking and sprinting camera
    - Very simple AI which will stand and shoot at the player when they're in sight (to be expanded upon!)
    - An ugly, clunky HUD for displaying ammo and the reload process in a similar way to Gears of War (replace with your own, less ugly version)

    Missing Features / Known Issues:

    - Vaulting not supported yet. I want to do this with root motion.
    - Similarly, running out from cover is not supported
    - Switching from cover to cover not supported yet
    - Cover system sometimes gets confused with curved convex surfaces, will tighten up the tracing to handle it better
    - The pawn currently teleports in and out of cover when aiming from the stacking state. Would like to use root motion for nice smooth animation.


    Anyway, I thought I'd release what I've got so far in case someone finds it useful, otherwise watch this space for updates! As always, feel free to rip the code apart and do what you want with it.


    Download link here:

    https://dl.dropboxusercontent.com/u/...r_20140119.zip

    Hope someone finds this useful, and please pass on any feedback or bugs you find
Working...
X