Jump to content

SP new game styles (RPG - Space \ air dogfight battles)


Recommended Posts

Fixed effect of fighter classes today for weapons. because on my mod code every class have custom fx of shoot weapons, projectiles was invisible. now i can see what fighter shoot me.. lool

i believe it shoots rockets in the last days and instead was the antimatter concussion beam (stouker concussion rifle)

XDDDD

 

this modded version coded is really weird. apparently you get only a strong hit of HP. but after a ten of second you are cover by electrocution and get "poison damage" if health reach zero your body is disintegrated like disruptor and disapperar. cute molecular disgregation of jedi lol

 

now i can focus to weapon changing armament (like boba fett class) i want the more destructive weapons are used in the chasing manouvres and with ranged distances. the blaster weapons, instead, at dogfight shoot distance.

so if fighter is far you can be purchased by homing missile. if fighter is close... cannon blasters!

another bug is that fighter attack only if jedi is really close at moment. this is Stupid! i need a better enemy targetting detections. (or maybe is better in that way... because so you can freely script with icarus the targets of a fighter in the map...)

after theat i need to fix fly assets , origin bug and floating into the spawn and after the enemy AI is ended and i can think to the drivable fighter version.

 

i hope that, if have have success, should possible to someone to do some x wing alliance or rogue squadron 3d mod or remake...

i think should be nice : 3

Link to comment

I guess a mix of mission editor and original game props - the Death Star II was already in the game, so I think they just reused parts of it. I think.

 

eh, not only, i get a look on they forums and they add a music editor tracks, bypass the cap limit of ships and planets of XWA and also other things, i suppose they hacked the exe of game for avoid some graphic restrictions.  the death star, for what i had read, is a custom model. they also modded gfx effects of game... so... is a totally upgrade. a xwa upgrade project like our openjk and ja++

however, because the class_fighter is used by all generic fighters npc i think is better i not hack a custom bounding box on my code work for fix the compenetration of terrain of the fighter. i think today i will re rig the tie fighter for fix the problem. sure is caused by wroong position of origin pivot . i suppose is in center of ship instead of the base of the wings. 

Link to comment

Oh, well, for make good enemy tie fighter NPC... i got to re-rig the tie model on 3d max and rebuild with carcass

fighters with human skeleton. this fix the bug that fighter spawn on a terrain.

also, i fixed an AI bug and now fighter can purchase the players and they change and switch weapons! they can equip this kind of projectiles:

- blaster pistol

- blaster

- bowcaster

- demp2

- concussion

- rocket

- repeater (alt fire concussion bomb)

- flechette.

(works also with thermal but a fighter that shoot thermal detonator grenade is really silly to see XDD )

mmmm i think i need to check mark1 AI for fully understand how a fighter can manage multiple weapon shoots in a combat. because this solution spawn weaponmodels on the muzzle flash point of the fighter... not really much good to see.

 

however now i need to fix that:

- fighter bobbing when spawn (maybe answer rise in swoops code. i see that when you spawn a swoop he's bobbing if you set hover parameter into vehicle.)

- fighter movement like a seeker rocket. (this is nasty! i hope someone can help me! ç_ç )

- fighter weapon AI fix (against not shoot if i am too far shoot only when is close. is not good -.- )  .

- fighter resistance to force power (affected by force push \ pull \ lightning, drain, grip.. it's hilarous -.- )

 

after that i can pass to the other side of problem: a drivable fighter.

argh >.<

Link to comment

Pretty ambitious project,I wish you luck!

It would be interesting to see how you would nail the space parts of this project,flying ships in JKA is rather difficult because of small spaces and clunky controls.

Also,I think the force levelling in the first Jedi Knight is superior to that of JKA. You have your force points,you can distribute them anywhere you like at any time,in contrast to the "one force point per level" of JKA. Maybe you can incorporate a system that is similar to that of JK or at least a bit different than that of vanilla JKA.

Asgarath83 likes this
Link to comment

Pretty ambitious project,I wish you luck!

It would be interesting to see how you would nail the space parts of this project,flying ships in JKA is rather difficult because of small spaces and clunky controls.

Also,I think the force levelling in the first Jedi Knight is superior to that of JKA. You have your force points,you can distribute them anywhere you like at any time,in contrast to the "one force point per level" of JKA. Maybe you can incorporate a system that is similar to that of JK or at least a bit different than that of vanilla JKA.

 

LOL, for now is sufficient resolve the fighters dilemma... or however doing the best. i hope that if i fail some expert code bring up my code and conclude the works so all community can also enjoy a space battle combat game by JKA : 3

never played to JK, only to JO sorry :(

however i post some screenshot of a tie squadron of six that chase my jedi in noclip mode and shoot with disruptor weapon.

now the next step is to fix weapon combat \ switch system. i think the answer lie into MARKs droid code

Link to comment

Okay

Ai fighter news:

when i get sentry AI on the fighter, the fighter chase without shoot.

when i get mark AI the fighter shoot without chase. -.-

now i put bobafett AI. (like my sithtrooper on ecIV mod )

 done change weapon code + movement code (also if fighter fly silly and drunk like a rockettrooper -.- it's normal because for now the flight AI is of the rockettrooper. )

what i need to do know:

- create a new weapon system for generating missile directly by fighter, (like sentry and mark1 does) but using weapons like boba fett and using tacticts and changing weapons. (see the fighter with a rifle attacked to a blatser cannon of the cockpit is really ridicolous -.- )

 

- creating a new fly mode: need to chase enemy \ target flying forward quickly and when is near to fly around like a rocket missile alt fire... not easily to doo.

 

after that i can pass to other problem: the drivable player fighters.

- bobbing for fighter idle (mmm, i begin to think that maybe the floating movement of a rockettrooper can be a good step , maybe without movement forward \ back \ left \ right 

- drivable vehicles option for fighter of TEAM NEUTRAL maybe? become automatically TEAM_PLAYER when player go inside it.

- HUD and flyight movement like a tie-fighter vehicle when you fly. 

- Weapon system like Atst drivable.

 

If have success, after i'll share all the code of this stuff here, so people can easy use for their mods. : )

Link to comment

There is a little crush when Tiefighter use disruptor ray. strange.

however i need for moment to suspend the project for bad heal complications.

sorry. i will take on my hand when i'll fell better.

really, i want also starship's fights into Jedi Academy -.-

Link to comment

There is a little crush when Tiefighter use disruptor ray. strange.

however i need for moment to suspend the project for bad heal complications.

sorry. i will take on my hand when i'll fell better.

really, i want also starship's fights into Jedi Academy -.-

 

I wish you a lot of luck, hope you get better soon!

Link to comment

There is a little crush when Tiefighter use disruptor ray. strange.

however i need for moment to suspend the project for bad heal complications.

sorry. i will take on my hand when i'll fell better.

really, i want also starship's fights into Jedi Academy -.-

 

Best of luck, man.

Link to comment

I do a lot of progress @@Ramikad and @@Noodle

- removed ghouls2 models when fighter change weapons, now they shoot by their cannon the projectiles of weapons.

the weapons are the same of default game but have coded custom efx and sounds.

- fighter shoot by their cannons... i need a little work for allow him to alternative shoots by left and right cannon.

- Enemy fighter fly like a sentry now, and not a rocketrooper. a lot of strafing and evasion movement. they strafe when they fly to player but also when their are close and attack.

 

BUG: there is a crash with a weapon and i need again which cause it when multiple fighter shoot me at same time

after i fix AI enemy fighter is near to be closed and i can check the drivable  code

Noodle likes this
Link to comment

I do a lot of progress @@Ramikad and @@Noodle

- removed ghouls2 models when fighter change weapons, now they shoot by their cannon the projectiles of weapons.

the weapons are the same of default game but have coded custom efx and sounds.

- fighter shoot by their cannons... i need a little work for allow him to alternative shoots by left and right cannon.

- Enemy fighter fly like a sentry now, and not a rocketrooper. a lot of strafing and evasion movement. they strafe when they fly to player but also when their are close and attack.

 

BUG: there is a crash with a weapon and i need again which cause it when multiple fighter shoot me at same time

after i fix AI enemy fighter is near to be closed and i can check the drivable  code

 

Great! Sounds like you're achieving something quite fun!

Link to comment

I haven't read this topic from start to finish, but to me the concept is pretty clear: Getting actual dogfights working in Jedi Academy. I don't expect anything like Rogue Squadron or X-Wing Alliance, but at least something that is close to Pandemic's Battlefront 2, which had a decent flight control.

 

Whatever the results will be, I hope it will become something fun to play.

Link to comment

I haven't read this topic from start to finish, but to me the concept is pretty clear: Getting actual dogfights working in Jedi Academy. I don't expect anything like Rogue Squadron or X-Wing Alliance, but at least something that is close to Pandemic's Battlefront 2, which had a decent flight control.

 

Whatever the results will be, I hope it will become something fun to play.

eh, i dreamed about rogue squadron and XWA but really this need a TRUELY expert coder with vectors and AIs. i cannot attempt nothing to these levels. the unique way for do something like that in "easy way" is to get the fighter movement like the alt fire rocket projectile weapon when they are in some evasion modality and they are near to objective to destroy. but the code of a weapon is not muchn compatible with a code of an AI. so for moment i not know how to do that.

 

now i search a video about what you talking.

 

oh, impressive, i played the first battlefront but this is amazing! D:

however my tie fighter AI attacks like the shadows of the empire tie fighters of asteroid belt level (but with more strafing)

 

however yes, the goal is to get something more possible similar to:

on JKA.

 

i failed to apply a seeker movement to fighter when they purchase a enemy for moment. .-.

massive crash when they start to do that.

about spawn bobbing: i am thinking to give the fighters idles the BOTH_SWIM1 animation... should be funny floating

"we wait order" mode :D

 

the AI should work for ENEMY and PLAYER team fighter (so can do also a NPC teammates squadron)

the drivable fighter i think will be usable hardcoded TEAM_NEUTRAL that switch to TEAM_PLAYER when you use it.

the goal is to allow it to works like Atst drivable, but you can play like a tie fighter

 

 

the best goal i reached for now is that figher change weapons at second of circustamces (they prefear to use rocket launcher at distance and blaster and repeater alt fire bombs in close combat) and the death explosion. this is pretty funny because fighters when explode assume some silly position for a little moment. XD

Link to comment

Oh, okay, crash is caused by concussion weapon.

this is a good news.

a little fix to weapon system and combat ai is pretty near to close.

i checked the dogfight with a tiefighter enemy against a friendly tie... ,mmm they fight one against other like two rockettroopers of different teams... not exactly much good to see for fighters...

should be good maybe for cruisers or big starships...

but for fighters... it need really some big improvement about movement.

the unique think i have in mind is to give to fighter AI the boost movement forward of a swoop driven by a foe.

/if fighters attacks like swoop merc on t2_trip shold be good i guess. )

Noodle likes this
Link to comment

/if fighters attacks like swoop merc on t2_trip shold be good i guess. )

 

It's interesting to see how the swoop mercs on t2_trip follow the player on the vehicle. Is there something in the class of the human_merc NPC that allows them to give chase? 

Link to comment

It's interesting to see how the swoop mercs on t2_trip follow the player on the vehicle. Is there something in the class of the human_merc NPC that allows them to give chase? 

 

Not really in the AI of stormtroopers default called by human merc (they are stormtroopers, basically).

if you do a map and place a swoop near to every kind of humanoid enemy, trandoshan, weequay, stormies, mercs, rodians, etc. they automatically when player is near go to nearest vehicle and jump on it and become npc + vehicle that flank, chase and shoot the player.

in escape from yavin 4 the lost map the four and fifth level you can see trandoshan and also zabrak iridonian sith assassin that use swoop for chase players, so is not a behavour setted only for human merc. ALL humanoid npcs with a swoop near do that!

so is a common function for all AI.

tpday i see this behavour is setted on AI_vehicle.cpp

 

this is the code of AI of pilots on a swoops that use swoop for chase players.

 

////////////////////////////////////////////////////////////////////////////////////////
// Pilot_MasterUpdate() - Master think function for Pilot NPCs
//
// Will return true if the character is either driving a vehicle or on his way to get
// onto one.
////////////////////////////////////////////////////////////////////////////////////////
bool    Pilot_MasterUpdate()
{
    if (!NPC->enemy)
    {
        // If Still On A Vehicle, Jump Off
        //---------------------------------
        if (NPCInfo->greetEnt)
        {
            ucmd.upmove = 127;

            if (NPCInfo->greetEnt && NPCInfo->greetEnt->m_pVehicle && (level.time<NPCInfo->confusionTime||level.time<NPCInfo->insanityTime))
            {
                Vehicle_t*    pVeh    = NPCInfo->greetEnt->m_pVehicle;
                if (!(pVeh->m_ulFlags&VEH_OUTOFCONTROL))
                 {
                    gentity_t*    parent    = pVeh->m_pParentEntity;
                    float        CurSpeed = VectorLength(parent->client->ps.velocity);
                    pVeh->m_pVehicleInfo->StartDeathDelay(pVeh, 10000);
                    pVeh->m_ulFlags |= (VEH_OUTOFCONTROL);
                    VectorScale(parent->client->ps.velocity, 1.25f, parent->pos3);
                    if (CurSpeed<pVeh->m_pVehicleInfo->speedMax)
                    {
                        VectorNormalize(parent->pos3);
                        if (fabsf(parent->pos3[2])<0.25f)
                        {
                            VectorScale(parent->pos3, (pVeh->m_pVehicleInfo->speedMax * 1.25f), parent->pos3);
                        }
                        else
                        {
                            VectorScale(parent->client->ps.velocity, 1.25f, parent->pos3);
                        }
                    }
                }
            }

            if (NPCInfo->greetEnt->owner==NPC)
            {
                return true;
            }
            NPCInfo->greetEnt = 0;
        }

        // Otherwise Nothing To See Here
        //-------------------------------
        return false;
    }


    // If We Already Have A Target Vehicle, Make Sure It Is Still Valid
    //------------------------------------------------------------------
    if (NPCInfo->greetEnt)
    {
        if (!NPCInfo->greetEnt->inuse ||
            !NPCInfo->greetEnt->m_pVehicle ||
            !NPCInfo->greetEnt->m_pVehicle->m_pVehicleInfo)
        {
            NPCInfo->greetEnt = Vehicle_Find(NPC);
        }
        else
        {
            if (NPCInfo->greetEnt->owner && NPCInfo->greetEnt->owner!=NPC)
            {
                NPCInfo->greetEnt = Vehicle_Find(NPC);
            }
        }
    }

    // If We Have An Enemy, Try To Find A Vehicle Nearby
    //---------------------------------------------------
    else
    {
        NPCInfo->greetEnt = Vehicle_Find(NPC);
    }

    // If No Vehicle Available, Continue As Usual
    //--------------------------------------------
    if (!NPCInfo->greetEnt)
    {
        return false;
    }



    if (NPCInfo->greetEnt->owner==NPC)
    {
        Pilot_Steer_Vehicle();
    }
    else
    {
        Pilot_Goto_Vehicle();
    }

    Pilot_Update_Enemy();
    return true;
}






////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////
void    Pilot_Update_Enemy()
{
    if (!TIMER_Exists(NPC, "PilotRemoveTime"))
    {
        TIMER_Set(NPC, "PilotRemoveTime", MIN_STAY_VIEWABLE_TIME);
    }

    if (TIMER_Done(NPC, "NextPilotCheckEnemyTime"))
    {
        TIMER_Set(NPC, "NextPilotCheckEnemyTime", Q_irand(1000,2000));
        if (NPC->enemy && Distance(NPC->currentOrigin, NPC->enemy->currentOrigin)>1000.0f)
        {
            mPilotViewTraceCount ++;
            gi.trace(&mPilotViewTrace,
                NPC->currentOrigin,
                0,
                0,
                NPC->enemy->currentOrigin,
                NPC->s.number,
                MASK_SHOT,
                (EG2_Collision)0, 0);

            if ((mPilotViewTrace.allsolid==qfalse) &&
                (mPilotViewTrace.startsolid==qfalse ) &&
                ((mPilotViewTrace.entityNum==NPC->enemy->s.number)||(mPilotViewTrace.entityNum==NPC->enemy->s.m_iVehicleNum)))
            {
                TIMER_Set(NPC, "PilotRemoveTime", MIN_STAY_VIEWABLE_TIME);
            }
        }
        else
        {
            TIMER_Set(NPC, "PilotRemoveTime", MIN_STAY_VIEWABLE_TIME);
        }
    }

    if (TIMER_Done(NPC, "PilotRemoveTime"))
    {
        if (NPCInfo->greetEnt->owner==NPC)
        {
            NPCInfo->greetEnt->e_ThinkFunc    = thinkF_G_FreeEntity;
            NPCInfo->greetEnt->nextthink    = level.time;
        }
        NPC->e_ThinkFunc    = thinkF_G_FreeEntity;
        NPC->nextthink        = level.time;
    }
}


////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////
void    Pilot_Goto_Vehicle()
{
    STEER::Activate(NPC);
    {
        if (STEER::Reached(NPC, NPCInfo->greetEnt, 80.0f))
        {
            NPC_Use(NPCInfo->greetEnt, NPC, NPC);
        }
        else if (NAV::OnNeighboringPoints(NPC, NPCInfo->greetEnt))
        {
            STEER::Persue(NPC, NPCInfo->greetEnt, 50.0f, 0.0f, 30.0f, 0.0f, true);
        }
        else
        {
            if (!NAV::GoTo(NPC, NPCInfo->greetEnt))
            {
                STEER::Stop(NPC);
            }
        }
    }
    STEER::AvoidCollisions(NPC);
    STEER::DeActivate(NPC, &ucmd);
    NPC_UpdateAngles(qtrue, qtrue);
}

extern bool    VEH_StartStrafeRam(Vehicle_t *pVeh, bool Right);

////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////
void    Pilot_Steer_Vehicle()
{
    if (!NPC->enemy || !NPC->enemy->client)
    {
        return;
    }






// SETUP
//=======
    // Setup Actor Data
    //------------------
    CVec3        ActorPos(NPC->currentOrigin);
    CVec3        ActorAngles(NPC->currentAngles);
                ActorAngles[2]    = 0;
    Vehicle_t*    ActorVeh        = NPCInfo->greetEnt->m_pVehicle;
    bool        ActorInTurbo    = (ActorVeh->m_iTurboTime>level.time);
    float        ActorSpeed        = (ActorVeh)?(VectorLength(ActorVeh->m_pParentEntity->client->ps.velocity)):(NPC->client->ps.speed);


    // If my vehicle is spinning out of control, just hold on, we're going to die!!!!!
    //---------------------------------------------------------------------------------
    if (ActorVeh && (ActorVeh->m_ulFlags & VEH_OUTOFCONTROL))
    {
        if (NPC->client->ps.weapon!=WP_NONE)
        {
            NPC_ChangeWeapon(WP_NONE);
        }
        ucmd.buttons    &=~BUTTON_ATTACK;
        ucmd.buttons    &=~BUTTON_ALT_ATTACK;
        return;
    }

    CVec3        ActorDirection;
                AngleVectors(ActorAngles.v, ActorDirection.v, 0, 0);

    CVec3        ActorFuturePos(ActorPos);
                ActorFuturePos.ScaleAdd(ActorDirection, FUTURE_PRED_DIST);

    bool        ActorDoTurbo    = false;
    bool        ActorAccelerate    = false;
    bool        ActorAimAtTarget= true;
    float        ActorYawOffset    = 0.0f;


    // Setup Enemy Data
    //------------------
    CVec3        EnemyPos(NPC->enemy->currentOrigin);
    CVec3        EnemyAngles(NPC->enemy->currentAngles);
                EnemyAngles[2]    = 0;
    Vehicle_t*    EnemyVeh        = (NPC->enemy->s.m_iVehicleNum)?(g_entities[NPC->enemy->s.m_iVehicleNum].m_pVehicle):(0);
    bool        EnemyInTurbo    = (EnemyVeh && EnemyVeh->m_iTurboTime>level.time);
    float        EnemySpeed        = (EnemyVeh)?(EnemyVeh->m_pParentEntity->client->ps.speed):(NPC->enemy->resultspeed);
    bool        EnemySlideBreak    = (EnemyVeh && (EnemyVeh->m_ulFlags&VEH_SLIDEBREAKING || EnemyVeh->m_ulFlags&VEH_STRAFERAM));
    bool        EnemyDead        = (NPC->enemy->health<=0);

    bool        ActorFlank        = (NPCInfo->lastAvoidSteerSideDebouncer>level.time && EnemyVeh && EnemySpeed>10.0f);

    CVec3        EnemyDirection;
    CVec3        EnemyRight;
                AngleVectors(EnemyAngles.v, EnemyDirection.v, EnemyRight.v, 0);

    CVec3        EnemyFuturePos(EnemyPos);
                EnemyFuturePos.ScaleAdd(EnemyDirection, FUTURE_PRED_DIST);

    ESide        EnemySide        = ActorPos.LRTest(EnemyPos, EnemyFuturePos);
    CVec3        EnemyFlankPos(EnemyFuturePos);
                EnemyFlankPos.ScaleAdd(EnemyRight, (EnemySide==Side_Right)?(FUTURE_SIDE_DIST)-FUTURE_SIDE_DIST));

    // Debug Draw Enemy Data
    //-----------------------
    if (false)
    {
        CG_DrawEdge(EnemyPos.v,            EnemyFuturePos.v, EDGE_IMPACT_SAFE);
        CG_DrawEdge(EnemyFuturePos.v,    EnemyFlankPos.v, EDGE_IMPACT_SAFE);
    }


    // Setup Move And Aim Directions
    //-------------------------------
    CVec3        MoveDirection((ActorFlank)?(EnemyFlankPos):(EnemyFuturePos));
                MoveDirection    -= ActorPos;
    float        MoveDistance    = MoveDirection.SafeNorm();
    float        MoveAccuracy    = MoveDirection.Dot(ActorDirection);

    CVec3        AimDirection(EnemyPos);
                AimDirection    -= ActorPos;
    float        AimDistance        = AimDirection.SafeNorm();
    float        AimAccuracy        = AimDirection.Dot(ActorDirection);



    if (!ActorFlank && TIMER_Done(NPC, "FlankAttackCheck"))
    {
        TIMER_Set(NPC, "FlankAttackCheck", Q_irand(1000, 3000));
        if (MoveDistance<4000 && Q_irand(0, 1)==0)
        {
            NPCInfo->lastAvoidSteerSideDebouncer    = level.time + Q_irand(8000, 14000);
        }
    }



    // Fly By Sounds
    //---------------
    if ((ActorVeh->m_pVehicleInfo->soundFlyBy || ActorVeh->m_pVehicleInfo->soundFlyBy2) &&
        EnemyVeh &&
        MoveDistance<800 &&
        ActorSpeed>500.0f &&
        TIMER_Done(NPC, "FlybySoundDebouncer")
        )
    {
        if (EnemySpeed<100.0f || (ActorDirection.Dot(EnemyDirection)*(MoveDistance/800.0f))<-0.5f)
        {
            TIMER_Set(NPC, "FlybySoundDebouncer", 2000);
            int soundFlyBy = ActorVeh->m_pVehicleInfo->soundFlyBy;
            if (ActorVeh->m_pVehicleInfo->soundFlyBy2 && (!soundFlyBy || !Q_irand(0,1)))
            {
                soundFlyBy = ActorVeh->m_pVehicleInfo->soundFlyBy2;
            }
            G_Sound(ActorVeh->m_pParentEntity, soundFlyBy);
        }
    }



// FLY PAST BEHAVIOR
//===================
     if (EnemySlideBreak || !TIMER_Done(NPC, "MinHoldDirectionTime"))
    {
        if (TIMER_Done(NPC, "MinHoldDirectionTime"))
        {
            TIMER_Set(NPC, "MinHoldDirectionTime", 500);    // Hold For At Least 500 ms
        }
        ActorAccelerate        = true;                            // Go
        ActorAimAtTarget    = false;                        // Don't Alter Our Aim Direction
        ucmd.buttons        &=~BUTTON_VEH_SPEED;            // Let Normal Vehicle Controls Go
    }


// FLANKING BEHAVIOR
//===================
    else if (ActorFlank)
    {
          ActorAccelerate    = true;
        ActorDoTurbo    = (MoveDistance>2500 || EnemyInTurbo);
        ucmd.buttons    |= BUTTON_VEH_SPEED;            // Tells PMove to use the ps.speed we calculate here, not the one from g_vehicles.c


        // For Flanking, We Calculate The Speed By Hand, Rather Than Using Pure Accelerate / No Accelerate Functionality
        //---------------------------------------------------------------------------------------------------------------
        NPC->client->ps.speed = ActorVeh->m_pVehicleInfo->speedMax * ((ActorInTurbo)?(1.35f):(1.15f));


        // If In Slowing Distance, Scale Down The Speed As We Approach Our Move Target
        //-----------------------------------------------------------------------------
        if (MoveDistance<ATTACK_FLANK_SLOWING)
        {
            NPC->client->ps.speed *= (MoveDistance/ATTACK_FLANK_SLOWING);
            NPC->client->ps.speed += EnemySpeed;

            // Match Enemy Speed
            //-------------------
            if (NPC->client->ps.speed<5.0f && EnemySpeed<5.0f)
            {
                NPC->client->ps.speed = EnemySpeed;
            }

            // Extra Slow Down When Out In Front
            //-----------------------------------
             if  (MoveAccuracy<0.0f)
            {
                NPC->client->ps.speed *= (MoveAccuracy + 1.0f);
            }


            MoveDirection    *=        (MoveDistance/ATTACK_FLANK_SLOWING);
            EnemyDirection    *= 1.0f - (MoveDistance/ATTACK_FLANK_SLOWING);
            MoveDirection    += EnemyDirection;

            if (TIMER_Done(NPC, "RamCheck"))
            {
                TIMER_Set(NPC, "RamCheck", Q_irand(1000, 3000));
                if (MoveDistance<RAM_DIST && Q_irand(0, 2)==0)
                {
                    VEH_StartStrafeRam(ActorVeh, (EnemySide==Side_Left));
                }
            }
        }
    }


// NORMAL CHASE BEHAVIOR
//=======================
    else
    {
        if (!EnemyVeh && AimAccuracy>0.99f && MoveDistance<500 && !EnemyDead)
        {
            ActorAccelerate = true;
            ActorDoTurbo    = false;
        }
        else
        {
            ActorAccelerate = ((MoveDistance>500 && EnemySpeed>20.0f) || MoveDistance>1000);
            ActorDoTurbo    = (MoveDistance>3000 && EnemySpeed>20.0f);
        }
        ucmd.buttons    &=~BUTTON_VEH_SPEED;
    }




// APPLY RESULTS
//=======================
    // Decide Turbo
    //--------------
    if (ActorDoTurbo || ActorInTurbo)
    {
        ucmd.buttons |= BUTTON_ALT_ATTACK;
    }
    else
    {
        ucmd.buttons &=~BUTTON_ALT_ATTACK;
    }

    // Decide Acceleration
    //---------------------
    ucmd.forwardmove = (ActorAccelerate)?(127):(0);



    // Decide To Shoot
    //-----------------
    ucmd.buttons    &=~BUTTON_ATTACK;
    ucmd.rightmove    = 0;
     if (AimDistance<2000 && !EnemyDead)
    {
        // If Doing A Ram Attack
        //-----------------------
        if (ActorYawOffset!=0)
        {
            if (NPC->client->ps.weapon!=WP_NONE)
            {
                NPC_ChangeWeapon(WP_NONE);
            }
            ucmd.buttons    &=~BUTTON_ATTACK;
        }
         else if (AimAccuracy>ATTACK_FWD)
        {
            if (NPC->client->ps.weapon!=WP_NONE)
            {
                NPC_ChangeWeapon(WP_NONE);
            }
            ucmd.buttons    |= BUTTON_ATTACK;
        }
        else if (AimAccuracy<AIM_SIDE && AimAccuracy>-AIM_SIDE)
        {
            if (NPC->client->ps.weapon!=WP_BLASTER)
            {
                NPC_ChangeWeapon(WP_BLASTER);
            }

            if (AimAccuracy<ATTACK_SIDE && AimAccuracy>-ATTACK_SIDE)
            {
                //if (!TIMER_Done(NPC, "RiderAltAttack"))
                //{
                //    ucmd.buttons |= BUTTON_ALT_ATTACK;
                //}
                //else
                //{
                    ucmd.buttons |= BUTTON_ATTACK;

            /*        if (TIMER_Done(NPC, "RiderAltAttackCheck"))
                    {
                        TIMER_Set(NPC, "RiderAltAttackCheck", Q_irand(1000, 3000));
                        if (Q_irand(0, 2)==0)
                        {
                            TIMER_Set(NPC, "RiderAltAttack", 300);
                        }
                    }*/
                //}
                WeaponThink(true);
            }
            ucmd.rightmove = (EnemySide==Side_Left)?( 127)-127);
        }
        else
        {
            if (NPC->client->ps.weapon!=WP_NONE)
            {
                NPC_ChangeWeapon(WP_NONE);
            }
        }
    }
    else
    {
        if (NPC->client->ps.weapon!=WP_NONE)
        {
            NPC_ChangeWeapon(WP_NONE);
        }
    }


    // Aim At Target
    //---------------
    if (ActorAimAtTarget)
    {
        MoveDirection.VecToAng();
        NPCInfo->desiredPitch    = AngleNormalize360(MoveDirection[PITCH]);
        NPCInfo->desiredYaw        = AngleNormalize360(MoveDirection[YAW] + ActorYawOffset);
    }
    NPC_UpdateAngles(qtrue, qtrue);
}

 

another interessing AI is NPCfighter.cpp but really i am hard to understand that or how to use that.

there are 1700 line of code and many parts are unchucked and note used by the game.

seems the AI of drivable tie fighter vehicle or something like that.

Link to comment

I'd try to keep the fighter in the air without moving, like the way the AT-ST and most NPCs have a default state untill they spot a player or get a specific instruction. Perhaps give the ship a default in-air animation like in this video I just did to show you what I mean:

 

 

That's just playing a .roff file located in vjun1/bomber_run_tiebomber_2ndship.roff 

 

The first thing I'd try to do is to see if in that state, the fighter NPC can aim at the player and fire at him whenever he moves, like a normal NPC. After that is done, I think setting movement could be much easier. 

 

I see that my fighters do something like that when i use "notarget" cheat when they use WP_THERMAL as weapon and stop to bombard me... i suppose that you can use with drivable team neutral now with icarus scripting SET ANIMATION  and cinematic spawning. BOTH_SWIM_IDLE1 animation in loop allow to see the fighter float in place :)

(i not know really how damn fix the fly movement of player and enemy teams ffighters so i think now i pass to drivable code so after i need just to debugging the work.

Noodle likes this
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...