Page 161 of 215

Re: [Blade of Agony] Drivable Tanks! | p160

Posted: Thu Mar 29, 2018 2:29 am
by Marisa the Magician
AFADoomer wrote:
Marisa Kirisame wrote:ZScript is also prone to breaking if you aren't careful. I see you got a save error there.

I guess it'll go away after I export F3DFloor.
I think it's because the FLineTraceData struct contains the F3DFloor entry (here), despite it not being exported... Interestingly enough, the TraceResults struct has the F3DFloor piece commented out.
That error specifically is because you're using it as a class variable, rather than a function variable. In cases like that I'd recommend marking the FLineTraceData variable as "transient" just so it doesn't get serialized (same workaround as with CVar structs). I'm pretty sure ZZYZX decided on commenting it out because it's not exported, but from the way my trace function is designed, that variable does need to be there, since the ffloor variable is useful to check for in some cases (e.g.: if it is non-null then the line/plane hit is part of a 3d floor, and such).

Re: [Blade of Agony] Drivable Tanks! | p160

Posted: Thu Mar 29, 2018 3:57 am
by Tormentor667
Marisa Kirisame wrote:That error specifically is because you're using it as a class variable, rather than a function variable. In cases like that I'd recommend marking the FLineTraceData variable as "transient" just so it doesn't get serialized (same workaround as with CVar structs).
I feel like reading an ancient language...

Re: [Blade of Agony] Drivable Tanks! | p160

Posted: Thu Mar 29, 2018 6:31 am
by HAL9000
@ Tormentor667
Interesting, thanks for the explanation.
One more question, are tank md3 parts animated or static model?
I wanted to do something similar for my AT-ST, but his body/legs must be frame animated while moving, can your Zscript tank logic handle frames?
For example..AT-ST walking (md3 frames from X to Y) while rotating upper body/turret and shooting.

Cheers

Re: [Blade of Agony] Drivable Tanks! | p160

Posted: Thu Mar 29, 2018 9:47 am
by AFADoomer
Nash wrote:AFADoomer - can you tell us more about the tank physics and aligning the tank to sloped terrain? Are you sampling from 4 points of the tank and calculating the pitch and roll from there? Is that what the line traces are doing?
Yes, I'm sampling at the four corners of the tank model using GetZAt, calculating the relative offset from floors, then using those values to calculate pitch and roll.

Code: Select all

    // Handling for terrain-based pitch/roll calculations...
    void SetPitchRoll(Actor mo)
    {
        if (!mo) { mo = self; }

        double points[5], minz = 0x7FFFFFFF, maxz = -0x7FFFFFFF;

        points[0] = mo.floorz;

        // Get the relative z-height at the four corners of the tank
        points[1] = mo.GetZAt(Radius, Radius) - points[0];
        points[2] = mo.GetZAt(Radius, -Radius) - points[0];
        points[3] = mo.GetZAt(-Radius, Radius) - points[0];
        points[4] = mo.GetZAt(-Radius, -Radius) - points[0];

        for (int i = 1; i <= 4; i++)
        {
            if (points[i] > MaxStepHeight) { points[i] = 0; } // Ignore the point if you can't climb that high
        }

        // Use those values to calculate the pitch.roll amounts
        double pitchinput = (points[2] + points[1]) - (points[4] + points[3]);
        double rollinput = (points[2] + points[4]) - (points[1] + points[3]);

        pitchinput = atan(pitchinput / (Radius * 2));
        rollinput = atan(rollinput / (Radius * 2));

        mo.pitch = clamp(mo.pitch, -30, 30);
        mo.roll = clamp(mo.roll, -30, 30);

        // Interpolate to the new values
        if (mo.pitch > -pitchinput) { mo.pitch = max(mo.pitch - 1, -pitchinput); }
        if (mo.pitch < -pitchinput) { mo.pitch = min(mo.pitch + 1, -pitchinput); }

        if (mo.roll > rollinput) { mo.roll = max(mo.roll - 1, rollinput); }
        if (mo.roll < rollinput) { mo.roll = min(mo.roll + 1, rollinput); }
    } 
Still needs to be cleaned up and optimize, but that's the code as it stands now.
HAL9000 wrote:@ Tormentor667
Interesting, thanks for the explanation.
One more question, are tank md3 parts animated or static model?
I wanted to do something similar for my AT-ST, but his body/legs must be frame animated while moving, can your Zscript tank logic handle frames?
For example..AT-ST walking (md3 frames from X to Y) while rotating upper body/turret and shooting.

Cheers
It handles basic animation right now... The treads move when the base of the tank moves. For a proper walking animation, there would probably need to be some added handling for smoothly moving from standing to walking and back, but the core code would still work.

Re: [Blade of Agony] Drivable Tanks! | p160

Posted: Fri Mar 30, 2018 5:44 am
by nazakomu
I've gotta say, the ZScript work that AFADoomer has done is impressive.
We're seriously starting to see some of the much greater possibilities due to ZScript.

Re: [Blade of Agony] Drivable Tanks! | p160

Posted: Fri Mar 30, 2018 4:06 pm
by Tormentor667

Re: [Blade of Agony] Tank Battlefield Screens! | p161

Posted: Fri Mar 30, 2018 6:32 pm
by Blue Shadow
Reminder for next time: viewtopic.php?f=48&t=57325

Re: [Blade of Agony] Tank Battlefield Screens! | p161

Posted: Sat Mar 31, 2018 12:21 am
by Captain J
...Large Image Derp aside, that tank scene looks Tankin' Amazing!! Hope the control isn't so bad, tho! :D

Re: [Blade of Agony] Tank Battlefield Screens! | p161

Posted: Sat Mar 31, 2018 11:53 am
by GeneralDelphox
Is there going to be some sort of First Person/Gunner views for the tanks?

Re: [Blade of Agony] Tank Battlefield Screens! | p161

Posted: Sat Mar 31, 2018 4:42 pm
by TDG
Oh cool, new screenshots of BOA. How is far is the progress on map building?

Re: [Blade of Agony] Tank Battlefield Screens! | p161

Posted: Sun Apr 01, 2018 11:00 am
by Ozymandias81
@GeneralDelphox - It is not planned, but never say never

@TDG - You can spoil yourself checking github development :wink:

HAPPY EASTER EVERYBODY, and in case you wonder I am the dude who ripped models for that Sherman tank, from CoD2 with slightly edits and adjustments on a total of 6 model parts for main actor and 4 model parts for destroyed one.

Re: [Blade of Agony] Tank Battlefield Screens! | p161

Posted: Sun Apr 01, 2018 12:36 pm
by CeeJay
Will the next chapter be more run-n-gun action and less stealth and rescue-mission oriantated than the previous one?

Re: [Blade of Agony] Tank Battlefield Screens! | p161

Posted: Mon Apr 02, 2018 2:54 am
by Tormentor667
Yes ;)

Re: [Blade of Agony] Tank Battlefield Screens! | p161

Posted: Thu Apr 05, 2018 5:56 am
by Wiw
How much of Chapter 3 would you say is done at this point?

Re: [Blade of Agony] Tank Battlefield Screens! | p161

Posted: Thu Apr 05, 2018 3:23 pm
by Tormentor667
About 25%, it’s still a lot of work left