[Code] Chasecam

Post your example zscripts/ACS scripts/etc here.

[Code] Chasecam

Postby The Zombie Killer » Fri Oct 03, 2014 6:52 am

This is a third person camera (compatible with most mods) that allows quite a few neat features, including angle-independent third person (the camera rotates, but the player doesn't).

Update (31/05/2016): Large update, now almost identical to built-in chasecam. Completely re-written
Update (04/10/2014): Camera no longer gets stuck on anything

Commands:
chase_active [1, 0] enables/disables third person view
chase_back [0, 30000] equivalent to chase_dist
chase_up [-1000, 1000] equivalent to chase_height
chase_type [0, 1]
  • 0: The player and camera will rotate (the default ZDoom chasecam)
  • 1: The camera will rotate, but the player won't
You do not have the required permissions to view the files attached to this post.
Last edited by The Zombie Killer on Tue May 31, 2016 2:46 am, edited 4 times in total.
User avatar
The Zombie Killer
King of the Kangaroos
 
Joined: 14 Jul 2011
Location: Gold Coast, Queensland, Australia
Discord: Zombie#1795

Re: [Code] Angle-Independent Third Person

Postby Nash » Sat Oct 04, 2014 7:11 am

Wow, really smooth! Finally no more 35 FPS bullshit! :D

One bug though: using ]kill monsters totally wrecks the script.

Also, I like how the camera doesn't get stuck anymore (I remember the old version you posted with the MLP player model, the camera always got stuck in that one) but it seems to be going through walls now. How about using hitscans to trace the camera positioning point? As far as I know, that's how ZDoom does it internally too... just fire a limited-range hitscan and position the camera at the end of the trace. If a solid object or wall is in the way, the view will "snap" to the collision point - again, exactly as how ZDoom is doing it. I'm using the same technique in my real-time weather engine to trace the sun from the player (to draw the lens flare on the screen). I also use this technique for the flashlight in my mod.

Use LineAttack to fire hitscans directly in ACS.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: [Code] Angle-Independent Third Person

Postby The Zombie Killer » Sat Oct 04, 2014 8:17 am

Nash wrote:One bug though: using ]kill monsters totally wrecks the script.

Fixed by adding "+NODAMAGE" to the "ChaseCam" actor

Nash wrote:How about using hitscans to trace the camera positioning point?

Funnily enough, that's exactly what I was planning to do for the next version, however there are some issues I've come up against when using LineAttack.
  • You cannot disable the bullet impact decal that LineAttack will place on a wall (afaik it uses the current decal defined by the player's current weapon)
  • You cannot define a TID for the puff (although there are workarounds for this)

EDIT: Here's the latest version, using LineAttack and with all the latest fixes and changes. Notice how it leaves decals everywhere.
New features:
  • Removed option to disable camera smoothing
  • Camera changes according to "chase_dist" and "chase_height"
  • Now uses LineAttack
  • Identical to the built in chasecam
  • Code cleaned up a little
You do not have the required permissions to view the files attached to this post.
User avatar
The Zombie Killer
King of the Kangaroos
 
Joined: 14 Jul 2011
Location: Gold Coast, Queensland, Australia
Discord: Zombie#1795

Re: [Code] Angle-Independent Third Person

Postby Nash » Sat Oct 04, 2014 10:54 am

I haven't downloaded it yet (I'm coding something ATM) but I wanted to pop in before I forget;

chase_rotateplr 2 will not behave as expected if the player is playing with a gamepad or joystick because BT_FORWARD/BACK does not register with them. You need to check for raw forward/backward input.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: [Code] Angle-Independent Third Person

Postby Nash » Sat Oct 04, 2014 11:40 am

Ran through this real quick. Some issues:

- Camera gets stuck in front of monsters/solid objects. Try putting PUFFONACTORS? EDIT: actually upon checking with ZDoom, it seems the camera trace completely ignores monsters and goes right through them. +THRUACTORS would help maybe
- Turning is very stuttery... even worse than the 35 FPS behaviour (which is a different thing). Can anything be done about this?
- And then of course the decals... I made a feature suggestion. If that gets no'd, then I'm sure there are some other workarounds/hacks.

EDIT: For reference, here's the DECORATE for my sun hitscan. One of these flags ought to work

Code: Select allExpand view

Actor Z_SunScannerPuff 
: BulletPuff
{
    // Any visual-related props/flags are for testing purposes only
    Radius 4
    Height 8
    RenderStyle None
    Alpha 1.0
    VSpeed 0
    Mass 0x7FFFFFFF
    Scale 4.0
    
+NOGRAVITY
    
+NODAMAGETHRUST
    
+PUFFONACTORS
    
+PUFFGETSOWNER
    
+ALWAYSPUFF
    
+BLOODLESSIMPACT
    
+DONTSPLASH
    
+NOTIMEFREEZE
    
+SOLID
    
+FORCEXYBILLBOARD
    
-ALLOWPARTICLES
    
-RANDOMIZE
    States
    
{
        Spawn:
            TNT1 A 1
            Stop
        Crash
:
            TNT1 A 1 Thing_ChangeTID(0, ACS_NamedExecuteWithResult("Script_GetSunScannerTID", 0))
            BON1 A 1 Bright ACS_NamedExecuteAlways("Script_DrawSunGlareFlat", 0)
            TNT1 A 1
            Stop
    
}
}
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: [Code] Angle-Independent Third Person

Postby IMX » Fri Oct 10, 2014 7:08 pm

Bookmarked topic successfully.
User avatar
IMX
Just a spoke on the wheel.
 
Joined: 11 May 2013
Location: Frogland, Mexico

Re: [Code] Angle-Independent Third Person

Postby Hornetzero » Sun Oct 12, 2014 12:17 am

two things about this.

1, Would it allow for a given set of sprites representing the topdown view ala RTS perspective? Like instead of getting flatter as the camera moves straight on top of the player, it instead changes to an RTS/Topdown perspective sprite?

2, When I have the camera face the player from the front, and than press the fire key, he turns his back and shoots the opposite direction. Was this intended? If its a free view, it shouldn't interfere with the player's direction.
User avatar
Hornetzero
 
Joined: 05 Dec 2012
Location: Twighlight zone

Re: [Code] Angle-Independent Third Person

Postby Nash » Sun Oct 12, 2014 3:58 am

Regarding (2), in Skyrim that's kind of how it behaves (in attack mode, the camera will always go behind the player so you can't "shoot the screen" so to speak)... but in the GTA games, I believe you can shoot the screen... anyway, it's just a matter of removing the fire button check from the relevant part of the code so it's easy to custom tailor it for your project's needs.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: [Code] Angle-Independent Third Person

Postby The Zombie Killer » Sun Oct 12, 2014 5:14 am

Sorry for the slight inactivity on my part in this thread, so to make up for it, have a new version!

  • Doesn't get stuck on actors
  • Camera faces player when spawned now
  • Player won't rotate when dead
  • chase_height can be ignored with a cvar (chase_enableheight) at the moment, because it is imperfect at this time
  • New player rotation setting "3", identical to 2, but won't rotate the camera if you are only firing

UltimateThirdPerson.pk3


Hornetzero wrote:1, Would it allow for a given set of sprites representing the topdown view ala RTS perspective? Like instead of getting flatter as the camera moves straight on top of the player, it instead changes to an RTS/Topdown perspective sprite?

So do you mean having rotation sprites for the top and bottom of the player, in addition to the sideways rotations? If so, then yes, this should be possible, but it'd require a few hacks.

Hornetzero wrote:2, When I have the camera face the player from the front, and than press the fire key, he turns his back and shoots the opposite direction. Was this intended? If its a free view, it shouldn't interfere with the player's direction.

Pretty much what Nash said. I've added a third camera rotation setting that won't rotate when firing now.

Nash wrote:Camera gets stuck in front of monsters/solid objects.

I did notice this myself, +PUFFONACTORS fixes the whole stuck part, and I tried +THRUACTORS before but it didn't seem to make a difference :\

Nash wrote:Turning is very stuttery... even worse than the 35 FPS behaviour (which is a different thing). Can anything be done about this?

Sadly I don't think I'll be able to fix this, at least, I can't think of a way yet.

Nash wrote:And then of course the decals... I made a feature suggestion. If that gets no'd, then I'm sure there are some other workarounds/hacks.

Took a look at your suggestion, I reckon a better method would be some flags for bulletpuffs though
+NODECALS - Disables impact decals for puff
+FORCEDECAL - Forces the puff to use its defined decal, instead of being overridden by the decal defined in the player's current weapon
You do not have the required permissions to view the files attached to this post.
User avatar
The Zombie Killer
King of the Kangaroos
 
Joined: 14 Jul 2011
Location: Gold Coast, Queensland, Australia
Discord: Zombie#1795

Re: [Code] Angle-Independent Third Person

Postby Nash » Sun Oct 12, 2014 5:42 am

The Zombie Killer wrote:So do you mean having rotation sprites for the top and bottom of the player, in addition to the sideways rotations? If so, then yes, this should be possible, but it'd require a few hacks.


Kind of out of scope of this library in my opinion, has the risk of making the codebase overly complicated and unclean. Plus it will never work right in multiplayer (if you alter a sprite for one player, other players will see it too and it would just look wrong).
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: [Code] Angle-Independent Third Person

Postby The Zombie Killer » Mon Oct 13, 2014 2:00 am

Oh of course, I don't intend to program such a thing, let alone attach it to this library :p. I was merely stating its possibility.
User avatar
The Zombie Killer
King of the Kangaroos
 
Joined: 14 Jul 2011
Location: Gold Coast, Queensland, Australia
Discord: Zombie#1795

Re: [Code] Angle-Independent Third Person

Postby Nash » Mon Oct 13, 2014 3:13 am

All in all, this is good stuff and I definitely see myself using the library (with your permission of course!)... as soon as you figure out ways to combat the jittery rotation and the decal thing. I'm sure you'll pull through.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: [Code] Angle-Independent Third Person

Postby The Zombie Killer » Mon Oct 13, 2014 7:01 am

Nash wrote:I definitely see myself using the library (with your permission of course!)

You don't even need that :p
The rule I have with everything I produce (ZDoom-wise) is that it's 100% free to use without permission or credit, unless I explicitly specify otherwise
User avatar
The Zombie Killer
King of the Kangaroos
 
Joined: 14 Jul 2011
Location: Gold Coast, Queensland, Australia
Discord: Zombie#1795

Re: [Code] Angle-Independent Third Person

Postby jazzmaster9 » Tue Oct 21, 2014 4:17 am

There seems to be a glitch with the camera, it's making decals on the wall.
User avatar
jazzmaster9
you guys should definitely play Abysm 2
 
Joined: 19 Apr 2012

Re: [Code] Angle-Independent Third Person

Postby The Zombie Killer » Wed Oct 22, 2014 2:25 am

jazzmaster9 wrote:There seems to be a glitch with the camera, it's making decals on the wall.

Someone didn't read the thread before posting :p
User avatar
The Zombie Killer
King of the Kangaroos
 
Joined: 14 Jul 2011
Location: Gold Coast, Queensland, Australia
Discord: Zombie#1795

Next

Return to Script Library

Who is online

Users browsing this forum: No registered users and 0 guests