-
Posts
2,023 -
Joined
-
Last visited
Content Type
News Articles
Tutorials
Forums
Downloads
Everything posted by Asgarath83
-
Reflected blaster shots - aiming with crosshair
Asgarath83 replied to Langerd's topic in Coding and Scripts
Strange. with SABER_DEFENSE 3 you should be able to reflect shoots against enemy turret. you can do that on t3_byss level. mmm wait. you are talking about a Sentry droid??? O.o -
@@Noodle the roof of hylden city is little inclinated because i have not fix model rotation (and fov on scene imported on 3d max lol the unique trouble of 3dripper is the fov issue, big map can have inclination deformation problems if camera is not perpendicular to level plane or if import option are not setted fine. i fixed later. about light. well, i created a tested skybox without any sky shader, just for contain the scene of hylden docks and prevent issues of map leaked. water of the ocean was remove by level before exporting, can be easily recreate with a brush and a water shader, much better of original bo2 game. lighting enviroment is missing because i did this test on 3DS misc_model format some months ago and i was focused to fix the problem of how to match textures because the method for apply texture of 3DS imported misc_model is very different related to MD3 tecnicque of apply textures. so the map was just on -META build, NO Vis, Not lighting. i use the simple META build for 99% of my map works and test, i use the light building only for final release and for ... well, for make the map lighting and shadowcasting, obvious. so this explain because there are not lighting and shadows for complete the level is sufficient to clean up scene by NPC stuffs of original game, separate the interactive object movable into other model respect to the scene .3DS (in this case, the interactive part of the map is the coffinslab door and the lift at the end of map (i not screenshoted him) and put light . i thing a spectral blue-green enviroment ambience light with sunset evening and some green flames torch spotted in some places are sufficient for create a deep glooming and scary level ambientation. :3 @@SomaZ. ew, i already tried with Noesis as first thing and it not process .MOX or BMD. i admit that target files was by the mmorpg of perfect world international. with a MD3 \ 3DS full compatibility they should be really a deep total assets resources. this old mmorpg have nice graphic, wonderful texture quality and also low poly models. the unique trouble is the difficult to manage the format of mmorpg static meshes. not much user friendly. (obvius, game is chinese) .-. about hylden city instead, it was for my Legacy of Kain MOD. this is related to my old topic when i asked about how to recreate game locations like hylden city or eternal prisons. i have not the heal or time for recreate a map for scratch, so ripping scene on 3DS and rebuild location with modular puzzles for me is the faster way. almost for games like defiance, blood omen 2 and soul reaver 2 this works like a charm. about pw... well, i really prefear to avoid to rip stuff of building and cities by game directly. i not found exactly legal or legittim. accounts that do that can be banned by servers. but also apply texture manually to 87 thousand of models... well... ARGH! @.@ the best way i guess should a scripts \ addons for 3d max for automatically assign a texture name to his related material name of a scene and export to 3DS OOORR... the same thing but that assign texture name automatically on blender customproperties, for MD3 exporting. 3d max method for export MD3 is too much complicated for manage thousand of static meshes. :\ . .
-
I want also get a little proof of what i tell becuase i can understand if the idea of use 3DS instead of the historical MD3 format or ASE for static mesh can get some skeptical reaction. To show a little image gallery of a test i did with another part: the docks of Hylden City by games bo2. this is NOT a MD3, this is 3DS scene. and as you can see it works nicely on JKA.
-
i can also guarantee that 3DS format works wonderful with JKA and radiant 1.5.0, if is solved the problem of texture assignament. i tested with a scene of a inside of a great cathedral stronghold ripped with 3d ripper and exported to 3DS format and load on JKA with the textures assigned with the tecnique i told and it support a scene with more of 32 part for mesh. there is a mesh of the 3ds file that have 19k of vertexes!!! and on 3DS format not crash on JKA and also on radiant too. there is only the problem of textures assignment.
-
Recently i got a large assets of 87k models. they are on bmd format but i found a tool that can convert to 3ds and obj, so they can be port on blender 2.68 or 3d studio max. or directly on gtk radiant. (but this is tricky). i would directly use on JKA if there is not a stupid problem: personally i see after a lot of try that 3ds format is really more better and much workable of MD3 for two reason: i tested with success usijng a .3ds mesh on radiant, and also on JKA too with success, not crash map no problem on building maps etc. the test stuff was an entire scene, a level part, i ripped from a low poly game months ago with 3d ripper dx. . with 3DS i not get any trouble regards the two big limitation of MD3:; no more of 1k of vertexes on a mesh and no more of 32 mesh for a model. but they have a problem: they read the texture by base folder by default or by the mod base folder. a texture also cannot have a name more long of 12 characters. the problem of 3ds is that: MD3 read the textures by MD3shader relative path fields on Custom properties of model, when you put on blender when you create a MD3 using MD3 export of mrwonko. no prolbem of path of long name texture, is highly customizable. also with 3d max MD3 export of ashuradx is pretty nice, but a little more hard to use, because you need to apply photometric texture to model before export, and also, to rename material of model with texture relative path and also, to have on the folder export the texture of model. Because i not human possible to manually convert one for one on Blender or 3D max 87 K of models without take an entire lifetime into MD3 format with the custom properties and material assign methods of 3d max or blender i wanna try if there is some way for create working 3DS by blender. BUT... there is a trouble basically... ON 3DS FORMAT, gtk radiant and JKA read the textures and materials name by Material slots. so, also if on blender i see the model with the correct texture assignment, display and uvmapping, if i port as misc_model on radiant the same model i get the error Texture load failed: "Material_1" Texture load failed: "Material_2" Texture load failed: "Material_3" Radiant search the material name of 3DS! not the textures name!!! so the unique way for force radiant and JKA to read the 3ds texture is to manually set the name on blender and re-export the 3ds. (without put a name more long of 12 character, folder \path included) i see i have no problem to read on Gtk radiant and Jedi Academy a 3ds exported by 3d max of a scene ripped by 3d reaper, because into the exporting the material name match with texture name, so radiant and JKA can read without trouble. (and i have also a batch rename tools on blender for add a prefix to materials name on blender. for example if texures are 398eeef44.dds and 343eeb239.dds, i can use this tool for rename as Sr/398eeef44 and sr/343eeb239. this allow also to have a custom folder where slap the texture instead of get spare on all Base folder of JKA or the mod folder (is sufficient to put the converted Dds inside a pk3 into a subfolder with desired name for resolve any problem about eventually texture overwrite name or have hundreds of textures scattered on base folder of mod or radiant base path, this should be really annoying). otherwise, i have serious trouble with 3ds created by 3d object converter. because material not match with texutre name but are "material1, material2, material 3... i have two folders of object that i can use. the firsr folder contain just 150 files... i can do the sacrifice to manually convert on MD3 with blender 2.68 because i have a plug in that copy custom properties on all object on the scene. but about the other folder with 87 K files !! oh damn... they are low poly and very nice textured models but how damn i can get on JKA without become crazy? :\ So my question regard this huge amount of staff: there is any plug , addons or script for blender 268, that can assign for every object and every material the same name of his texture??? this can make this job a little less crazy? More better: there is any program that can batch convert *.BMD format of 3d models into 3DS compatible with radiant or JKA , also with an autorenaming of materials of models for match the name of textures assigned? example: if there is material_1 with texture 3d6.dds material_1 must be renamed too 3d6.dds or 3d6. thanks for any answer.
-
Okay, this is the deal. i know how works with MD3 for create misc_model and misc_model_static. But i discover also that radiant and JKA can manage too 3DS and OBJ format. expecially 3ds. and this without Any-Editing-Of-Models inside blender or 3d studio max. if the material name of a 3ds file is the same name of the texture file, radiant, and JKA too, can read the texture without problem. and also, 3ds works on game also better of MD3 for what i see, because they have not limitation as 1000 vertexes errors. i ported into game really GIANT scene with thousands of vertex without problems with this tecnique. and just into one 3ds misc_model. how do that. i discovered that with some stuff ripped with 3d ripper Basically... - i converted dds textures ripped into jpg textures. - i placed into a 2 pk3 folder the jpg textures - need two pk3. a pk3 with textures renamed with .dds as sufix in that case, because radiant reed the textures images for be displayed into the editor. but game read shaders, not textures, so sufix name is not necessary. the pk3 files with *.dds texture rename can be placed into the base source folder of GTK radiant. the pk3 files with textures without renaming, can be placed into the mod folder on gamedata. is possible also, using blender, with a rename object addon, to change material and textures name (on the case of ripped stuff by 3d ripper, the name are matching), adding a prefix. i see that engine of JKA and radiant not read a texture name if name is more long of 12 character. with if you add a little prefix like 01/ to all texture and material name with the addon of blender 2.68, you can place without any problem textures also into a subfolder of a pk3 (just for avoid to overwrite other textures or other problems like that). to this point, all is perfect. and so, what is wrong? Well, i have found a large asset of some thousand of model. they are low poly, very miscellaneus and with nice textures, but they are into MOX and BMD format. i found a program that convert MOX and BMD into 3ds (3d object converter) but there is a little problem: the converted files have as material name "material_1 , material_2, material_3, material_4. if i open the original file on his folder, with his textures into the same folder, i can easily convert into 3ds. after that, the obtained 3ds have not any problem of textures loading on blender. (and on 3d object converter there is also a batch convert function on 3dobjectconverter for convert with a one click hundreds of models ) i have already tryed on radiant and JKA these and they 3ds working on engine without trobles-. so, what is the problem? the problem is: material mismatch with textures name. so for example: i have an object called table with 4 textures: table_1, table_2, table_3, table_4. i had a 3ds that has material name have "material_1, material_2, material_3, material_4. Ond Blender material slot, they are in that way, and also on radiant 3ds texture are readed with material name, not with textures name. normally i not ask a so annoying question but manually re-assign textures for 80K of models is really a madness. @-@ so... i ask that mainly to blender user. There is any possibility, any workaround to have some script or addons for blender 2.68 that can rename each material with his texture name? (but also in that way is crazy... but i not think someone know if there is some way to force 3dobjectconverter to convert the 3ds with materials named like textures. OR if there is another program that can convert MOX and BMD 3d file formats. The alternative should rips stuff i want by game (buildings basically), but i not like much to rip with 3dripper if is not extremely necessary. also because the wireframe quality of ripped stuff are really missed up and also meshes can be heavily deformed into the ripping. Thanks for every answer.
-
Ask me anything about the Jedi source code
Asgarath83 replied to MGummelt's topic in Coding and Scripts
Thanks! but without MGummelt suggest i should again on brainstorming mode :3 i suppose i can fix crazy acceleration with if NPC->client->ps.velocity > 1 NPC->client->ps.velocity = 1 after VectorMA. this should avoid to overflow the default speed value. iif not, i can also try the ps.velocity < 1 ps.velocity = 0 by fighter_hunt or the decay multiplier with 0.(number.)f for a gradual decelerating. Instead about the client i thinks is sufficient: - NPC and client starfighters scaled to 50 as modelsca on NPC files. that fix the camera problem with the "giant" tiefighter model vehicle. moving the Playable fighter: well, i not know if is possible to use "playermodel sentry" or "playermodel remote" for see if player can move these droids class. if is possible should not be problem to allow my fighter class to be moved also by player (and adding forceforward command by icarus script at start of level player too can have the autoforward propulsion as rogue squadron 3d) if instead droids are statics with players u.cmd (now i not remember, i need to test the default sentry and remote_sp NPC for see if player can move.) i can just set the player fighter fly like a rockettrooper fly (with some little edit on yawangle of flystart) and changing jetpack sound on the fighter engine sound loop and should be okay.) After that, all it need is to customize UI (like atst HUD) for the fighter class and the works is done and i will share the code.) Thanks again MGummelt, really -
Ask me anything about the Jedi source code
Asgarath83 replied to MGummelt's topic in Coding and Scripts
@@MGummelt it works!!! after two years of headaches! thanks ! thanks 1 thousand time!!! i need just to put on the equation some decay value like the "apply friction" and the decay int of Sentry Ai because you're right! VectorMa create a logaritmic acceleration... but is also necessary for make all workings. so they need really a brake inside the code because i spawned fifty fighters with consolles and they go forward, boost up, accelerate in so crazy way that also if they seek me as enemy they fly for all map and skybox like crazy comets and explodes by impact damage with skybox to a mad speed! ROTFL!!! it's funny to see but it works! now i need just to debug, finding the just values for making a decent flight i am sure at the end i'll do that. and after that i can think to the player client fighter code and user UI HUD. Because NPC is almost done. thanks again!! -
Ask me anything about the Jedi source code
Asgarath83 replied to MGummelt's topic in Coding and Scripts
Thanks friend, i testing now. well, as i told, my fighter is not a vehicle... the AI is building with a workaroung about AI_SENTRY (for flying) and AI_Bobafett (for combat and switch weapons) but all i obtains was some funny fighter droids NPC that fly and shoot like tornado assault chopter. (but they are not vehicles. they are characters, like jedi, lijke sith, like reborns, foir engines they are NPCs. they only appear as fighter because they have the tie fighter model that i have rigged with humanoid skeleton, only to pelvis bone (so i obtained a rigid body starfighter NPC) and i also added in front of tiefighter cannon the l_hand and r_hand tag, i also removed for fighter class the spawning of shooting weapons glm models (so fighter not have silly a blaster or a repeater or a rocket launcher attacked to his cannon) i added also death efx explosion with corpse removal and customized FX of all shooting weapons for starfighter class. At moment, for avoid to make mistakes or some big error on AI without remember how things works before and how repairs (i have backuped copy of my edited AI_sentry.cpp file) i have setted all the fighter parameter to another class so i am using this class for making all test and debugging for avoid of ruin fighter class with my noob c++ skills. the test class is called CLASS_OLON i changed also the functions name for avoid redundance or conflict with fighters ruins. in this AI, i tryed something of difference: instead of Sentry droid fly behavour i tryed the AI_REMOTE.cpp. and yesterday i discover that flight is not setted by Fighter_hunt \ Olon_hunt functions as i wrong thinked... the Hunt function control the chasing of the enemy. the Flight of NPC, instead if setted by Fighter_MaintainHeight \ Olon_MantainHeight of my test code. and here, on the olon workinprogress testing AI, i merged the remote and sentry maintain height functions. the result for combat and dogfight is... Spectacular! with some little adjustament (i added faceenemy, because Remote AI have not and i disable remote spin of model) i obtain an NPC fighers that chase enemy and move like a remote instead of a sentry, but also strafing like a sentry... oh well, a good starfighter battle! this is my work in progress edit: /* ------------------------- Olon_MaintainHeight ------------------------- */ void Olon_MaintainHeight( void ) { float dif; // Update our angles regardless //////////////////////////////////////// NPC_FaceEnemy( qtrue ); NPC_UpdateAngles( qtrue, qtrue ); // Cambia il vettore 2 con l'1. if ( NPC->client->ps.velocity[2] ) { NPC->client->ps.velocity[2] *= OLON_DECAY; if ( fabs( NPC->client->ps.velocity[2] ) < 1 ) { NPC->client->ps.velocity[2] = 0; } } // If we have an enemy, we should try to hover at or a little below enemy eye level if ( NPC->enemy ) { //SENTRY // Find the height difference dif = (NPC->enemy->currentOrigin[2]+NPC->enemy->maxs[2]) - NPC->currentOrigin[2]; // cap to prevent dramatic height shifts if ( fabs( dif ) > 8 ) { if ( fabs( dif ) > OLON_HOVER_HEIGHT ) { dif = ( dif < 0 ? -24 : 24 ); } NPC->client->ps.velocity[2] = (NPC->client->ps.velocity[2]+dif)/2; } //REMOTE if (TIMER_Done( NPC, "OlonheightChange")) { TIMER_Set( NPC,"OlonheightChange",Q_irand( 1000, 3000 )); // Find the height difference dif = (NPC->enemy->currentOrigin[2] + Q_irand( 0, NPC->enemy->maxs[2]+8 )) - NPC->currentOrigin[2]; // cap to prevent dramatic height shifts if ( fabs( dif ) > 2 ) { if ( fabs( dif ) > 24 ) { dif = ( dif < 0 ? -24 : 24 ); } dif *= 10; NPC->client->ps.velocity[2] = (NPC->client->ps.velocity[2]+dif)/2; NPC->fx_time = level.time; //G_Sound( NPC, G_SoundIndex("sound/chars/Olon/misc/hiss.wav")); } } } else { //REMOTE gentity_t *goal = NULL; if ( NPCInfo->goalEntity ) // Is there a goal? { goal = NPCInfo->goalEntity; } else { goal = NPCInfo->lastGoalEntity; } if (goal) { dif = goal->currentOrigin[2] - NPC->currentOrigin[2]; //REMOTE if ( fabs( dif ) > 24 ) { dif = ( dif < 0 ? -24 : 24 ); NPC->client->ps.velocity[2] = (NPC->client->ps.velocity[2]+dif)/2; } //SENTRY if ( fabs( dif ) > OLON_HOVER_HEIGHT ) { ucmd.upmove = ( ucmd.upmove < 0 ? -4 : 4 ); } else { if ( NPC->client->ps.velocity[2] ) { NPC->client->ps.velocity[2] *= OLON_VELOCITY_DECAY; if ( fabs( NPC->client->ps.velocity[2] ) < 2 ) { NPC->client->ps.velocity[2] = 0; } } } } // Apply friction to Z else if ( NPC->client->ps.velocity[2] ) { NPC->client->ps.velocity[2] *= OLON_VELOCITY_DECAY; if ( fabs( NPC->client->ps.velocity[2] ) < 1 ) { NPC->client->ps.velocity[2] = 0; } } // Apply friction else if ( NPC->client->ps.velocity[0] ) { NPC->client->ps.velocity[0] *= OLON_DECAY; if ( fabs( NPC->client->ps.velocity[0] ) < 1 ) { NPC->client->ps.velocity[0] = 0; } } else if ( NPC->client->ps.velocity[1] ) { NPC->client->ps.velocity[1] *= OLON_DECAY; if ( fabs( NPC->client->ps.velocity[1] ) < 1 ) { NPC->client->ps.velocity[1] = 0; } } } } /* ------------------------- Olon_Strafe ------------------------- */ void Olon_Strafe( void ) { int dir; vec3_t end, right; trace_t tr; AngleVectors( NPC->client->renderInfo.eyeAngles, NULL, right, NULL ); // Pick a random strafe direction, then check to see if doing a strafe would be // reasonable valid dir = ( rand() & 1 ) ? -1 : 1; VectorMA( NPC->currentOrigin, OLON_STRAFE_DIS * dir, right, end ); gi.trace( &tr, NPC->currentOrigin, NULL, NULL, end, NPC->s.number, MASK_SOLID, (EG2_Collision)0, 0 ); // Close enough if ( tr.fraction > 0.9f ) { VectorMA( NPC->client->ps.velocity, OLON_STRAFE_VEL * dir, right, NPC->client->ps.velocity ); G_Sound( NPC, G_SoundIndex("sound/chars/remote/misc/hiss.wav")); // Every time strafing, Add also a slight forward push. // so you will go after your enemy and you can attack from back! NPC->client->ps.velocity[1] += OLON_FORWARD_PUSH; // Set the strafe start time so we can do a controlled roll NPC->fx_time = level.time; NPCInfo->standTime = level.time + 3000 + random() * 500; } } /* ------------------------- Olon_Hunt ------------------------- */ void Olon_Hunt( qboolean olonvisible, qboolean olonadvance, qboolean olonretreat ) { float olondistance, olonspeed; vec3_t forward; //If we're not supposed to stand still, pursue the player if ( NPCInfo->standTime < level.time ) { // Only strafe when we can see the player if ( olonvisible ) { Olon_Strafe(); return; } } //If we don't want to advance, stop here if ( olonadvance == qfalse && olonvisible == qtrue ) return; //Only try and navigate if the player is visible if ( olonvisible == qfalse ) { // Move towards our goal NPCInfo->goalEntity = NPC->enemy; NPCInfo->goalRadius = 12; NPC_MoveToGoal(qtrue); return; } else { VectorSubtract( NPC->enemy->currentOrigin, NPC->currentOrigin, forward ); olondistance = VectorNormalize( forward ); } olonspeed = OLON_FORWARD_BASE_SPEED + OLON_FORWARD_MULTIPLIER * g_spskill->integer; if ( olonretreat == qtrue ) { olonspeed *= -1; } VectorMA( NPC->client->ps.velocity, olonspeed, forward, NPC->client->ps.velocity ); NPC_FaceEnemy( qtrue ); } /* ------------------------- Olon_Ranged ------------------------- */ void Olon_Ranged( qboolean olonvisible, qboolean olonadvance, qboolean olonretreat ) { if ( TIMER_Done( NPC, "attackDelay" ) ) // Attack? { TIMER_Set( NPC, "attackDelay", Q_irand( 500, 3000 ) ); Olon_Fire(); } if ( NPCInfo->scriptFlags & SCF_CHASE_ENEMIES ) { Olon_Hunt( olonvisible, olonadvance, olonretreat ); } } #define MIN_OLON_RANGE 8192 #define MIN_OLON_RANGE_SQR ( MIN_OLON_RANGE * MIN_OLON_RANGE ) #define MIN_OLON_DISTANCE 1024 #define MIN_OLON_SQR ( MIN_OLON_DISTANCE * MIN_OLON_DISTANCE ) /* ------------------------- Olon_Attack ------------------------- */ void Olon_Attack( void ) { //QQQ DISABLED FOR AVOID SILLY SPINNING MOVEMENT /*if ( TIMER_Done(NPC,"spin") ) { TIMER_Set( NPC, "spin", Q_irand( 250, 1500 ) ); NPCInfo->desiredYaw += Q_irand( -200, 200 ); }*/ // Always keep a good height off the ground Olon_MaintainHeight(); // If we don't have an enemy, just idle if ( NPC_CheckEnemyExt() == qfalse ) { Olon_Idle(); return; } // Rate our distance to the target, and our visibilty float olondistance = (int) DistanceHorizontalSquared( NPC->currentOrigin, NPC->enemy->currentOrigin ); // distance_e distRate = ( distance > MIN_MELEE_RANGE_SQR ) ? DIST_LONG : DIST_MELEE; qboolean olonvisible = NPC_ClearLOS( NPC->enemy ); float olonidealDist = MIN_OLON_SQR+(MIN_OLON_SQR*Q_flrand( 0, 1 )); qboolean olonadvance = (qboolean)(olondistance > olonidealDist*1.25); qboolean olonretreat = (qboolean)(olondistance < olonidealDist*0.75); // If we cannot see our target, move to see it if ( olonvisible == qfalse ) { if ( NPCInfo->scriptFlags & SCF_CHASE_ENEMIES ) { Olon_Hunt( olonvisible, olonadvance, olonretreat ); return; } } Olon_Ranged( olonvisible, olonadvance, olonretreat ); } /* ------------------------- Olon automatic flyforwards functions ------------------------- */ void Olon_flyforward1( void ) { float speed; vec3_t forward; //Get your current forward dir AngleVectors( NPC->client->renderInfo.eyeAngles, forward, NULL, NULL ); //or just this - not sure why you're trying to get the NPC's eye angles on a vehicle above? That would be more for a player controlling a vehicle //AngleVectors( self->currentAngles, forward, right, NULL ); ucmd.forwardmove = NPC->client->forced_forwardmove; speed = NPCInfo->stats.walkSpeed; //Set speed to walkspeed or runspeed or whatever you want //speed = FIGHTER_FORWARD_BASE_SPEED + FIGHTER_FORWARD_MULTIPLIER * g_spskill->integer; //set velocity directly - note that this *adds* the new velocity to the old one, meaning it will keep accelerating - only do this if the speed hasn't reached max or you're changing direction VectorMA( NPC->client->ps.velocity, speed, forward, NPC->client->ps.velocity ); //You can just do this, but this will go to the new velocity immediately - you'd have to smooth out acceleration yourself //VectorMultiply( forward, speed, NPC->client->ps.velocity ); NPC->client->ps.pm_time = 500; NPC->client->ps.pm_flags |= PMF_TIME_KNOCKBACK; } /* ------------------------- Olon Idle ------------------------- */ void Olon_Idle( void ) { Olon_flyforward1();//autoforward at walkspeed Olon_MaintainHeight(); NPC_BSIdle(); } /* ------------------------- Olon_Patrol ------------------------- */ void Olon_Patrol( void ) { Olon_MaintainHeight(); //If we have somewhere to go, then do that if (!NPC->enemy) { if ( UpdateGoal() ) { //start loop sound once we move ucmd.buttons |= BUTTON_WALKING; NPC_MoveToGoal( qtrue ); } } NPC_UpdateAngles( qtrue, qtrue ); } /* ------------------------- NPC_BSOlon_Default ------------------------- */ void NPC_BSOlon_Default( void ) { if ( NPC->enemy ) { Olon_Attack(); } else if ( NPCInfo->scriptFlags & SCF_LOOK_FOR_ENEMIES ) { Olon_Patrol(); } else { Olon_Idle(); } } basically: on hunt, i added the face enemy and disabled the spin of remote droid on strafing, i changed the "add a slight upward push" that's because is a fighting between two NPC, one friend and other enemy, every time fighter are strafing they go upward a lot. result: after 10 minutes of battle they are on the top of skybox of the map Lmao. XD obvious, sentry and remote are not thinked for fight each other, i see also rockettroopers have this little problem. so i changed the upward push of ps.velocity on vector 2 (up\down) to vector 1 (forward \ backward) in this way, the push will be forward and not up. i hjave not again tested but if i am correct the result is: every time fighter will strafing, they go a lot forward (i set the value for deal a big push forward) so fighter will go over his enemy and reach his backs and shoot on the back of fighter opponent to the next attack. teorically should works, now i need to test. On olon maintain height i am testing a merged fabs vector functions that merge remote and sentry flying parameter. as i told, i obtained something of pretty interessing: the fighters on a dogfight, fight really as fighters! they also are pretty smart: if i escape, the NPC fighter go over my fighter NPC, and face me and shoot me when is strafing on left \right with a frontal attack (but moving on left) this is nice! is better and more realistic of fighters that fight like F16 airplanes. if i am on behind of a fighter, with this movement it is not so stupid to expose vulnerable parts are boosters and back. it turn for face opponent, (they are starfighter by the rest, so why fight as war airplanes . into the space there are not up\down distinction) so, now in dogfight fighter escape, attack, strafing, fly around the enemy shooting very nicely and facing each others! the only problem is i created a little logarithmic accelerations,... fighters become soon fast... too fast every time they turn and strafe into a new attack. (like speed vehicle but more madness movement!) so fast that at the end they are impossible to targetting and they fly into a spare of time by a corner of map, throw map itself, to other corner! really i will need to apply a STRONG friction on this acceleration. for my luck there is this on the code i am testing. // Apply friction to Z else if ( NPC->client->ps.velocity[2] ) { NPC->client->ps.velocity[2] *= OLON_VELOCITY_DECAY; if ( fabs( NPC->client->ps.velocity[2] ) < 1 ) { NPC->client->ps.velocity[2] = 0; } } // Apply friction else if ( NPC->client->ps.velocity[0] ) { NPC->client->ps.velocity[0] *= OLON_DECAY; if ( fabs( NPC->client->ps.velocity[0] ) < 1 ) { NPC->client->ps.velocity[0] = 0; } } else if ( NPC->client->ps.velocity[1] ) { NPC->client->ps.velocity[1] *= OLON_DECAY; if ( fabs( NPC->client->ps.velocity[1] ) < 1 ) { NPC->client->ps.velocity[1] = 0; } } so there is also a deceleration movement (but too weak for moment respect to acceleration movement) and so after a lot of time fighters normalize their speed and return to fight as fighters... and not as crazy comets. XD About the autoforceforward. i am trying to do that now: the Olon_idle calls this function float speed; vec3_t forward; //Get your current forward dir AngleVectors( NPC->client->renderInfo.eyeAngles, forward, NULL, NULL ); //or just this - not sure why you're trying to get the NPC's eye angles on a vehicle above? That would be more for a player controlling a vehicle //AngleVectors( self->currentAngles, forward, right, NULL ); ucmd.forwardmove = NPC->client->forced_forwardmove; speed = NPCInfo->stats.walkSpeed; //Set speed to walkspeed or runspeed or whatever you want //speed = FIGHTER_FORWARD_BASE_SPEED + FIGHTER_FORWARD_MULTIPLIER * g_spskill->integer; //set velocity directly - note that this *adds* the new velocity to the old one, meaning it will keep accelerating - only do this if the speed hasn't reached max or you're changing direction VectorMA( NPC->client->ps.velocity, speed, forward, NPC->client->ps.velocity ); //You can just do this, but this will go to the new velocity immediately - you'd have to smooth out acceleration yourself //VectorMultiply( forward, speed, NPC->client->ps.velocity ); NPC->client->ps.pm_time = 500; NPC->client->ps.pm_flags |= PMF_TIME_KNOCKBACK; } i pasted line you suggest me and now i want to test. if works, i will fix next for have obtimal result. (also my crazy dogfight lol) also, i am sorry for my sadly post of the other day. i take a lot of time of figure that NPC move just because AI imitated player movement. i never expected that and this mechanic is very interesting. so, basiclaly, NPCs are like puppet moved by engines. and engine use virtual keyboard and joypand with ucmds for reproducing the player movement...now i understand why forceforward not work until now. >.< now i test my little code. i will let you know the progress. Thanks! -
mmm maybe we can help each other. i can give an hand on next future, finished the summer, not too difficult for my mapping skills also if i am not a professional mapper. in change i want only a thing: i am working on AI for making starfighters as NPC not as Vehicle, because NPC can sort many more shoot weapons and also not need pilot and have much manouvrability of starfighter vehicle of JKA engines. also this can open new frontier to SP , my goal is to create a game mode SP for JKA with space battle FPS gamestyle. my AI is okay for shooting, combat and switching weapons but i am a noob with vectors and movement,. i need a Nice programmer that help me to manage fighter fly movement for create a realistic dogfight combat , like old games as rogue squadron 3D and XWingAlliance. if in your team there is something with the require coding skill and spare time fro write movement functions of fighters, i can surely help you in retun with this map. at moment my fighters move like a sentry droids... so they attack like a assault tornado chopter. silly behavour for a starfighter .-. Should be great if they move like a VH_SPEEDER or like a rocket launcher homing missile projectile but vehicle codes and projectile code are not compatible with NPC code. if i remember fine i have SJC t2_rogue source map, textures are fine and also rebuilding. it need just: - NPC placing entity - NPC files and models for civilians - entity for scripting, ref tag scriptrunner etc. - a rewrite of scripts of t2_rogue. so.,.. find me a nice coder for help with my little trouble and i jump istantly on discord for chat with your team about that and t2_rogue remake ... However, we should continue conversation on private message, here we are Off topic.
-
well, for epic challenge mod IV i write a NPC Ai based on boba fett ai when NPC use sabers if enemy is close and use ranged weapons if enemy is far. but that require coding and also replace default AI with new AI... or create new classes of NPC with this behavour, sorry : \
-
replace t2_rogue... sigh.. i worked 2 years ago to the coruscant SJC map adapted for single player for replace t2_rogue location. i placed first entities and did waypoint navgrid BUT... my teammates of projects never end the work so the project is stopped for what i know. and all it need is just to place entities, alien folks and NPC civilain and remake the scripts of t2_rogue for match with new map structure and path. for Main Topic however. i love this work o.o nice! i suggest to use for worlds as Corellia, with darkest lighting and texture can be also a Nar Shaddaa map, but i guess Corellia is more indicated.
-
Ask me anything about the Jedi source code
Asgarath83 replied to MGummelt's topic in Coding and Scripts
i Did a lot of progress but again i not have the desired movement. i am working on the fighter_flyforward function but again it not work... or crashes if i enable the fighter_hunt past code about visible and advance. is just a first step. i need to study this for understand exactly what i need to do for boost my fighters. they move fine when they attack,. but when they spawn they are passive. i wanna they move at their walkspeed when they spawn, with forceforwarding, or a vector or any other code possibilities. . i paste here the code, in the case of someone desires to give me a little hint of what is wrong on this fly AI. except fighter_forward function, this is again work in progress. ///////////////////////////////// FLIGHT AI ///////////////////////////////// /* ------------------------- Fighter_Strafe ------------------------- */ void Fighter_Strafe( void ) { int dir; vec3_t end, right; trace_t tr; AngleVectors( NPC->client->renderInfo.eyeAngles, NULL, right, NULL ); // Pick a random strafe direction, then check to see if doing a strafe would be // reasonable valid dir = ( rand() & 1 ) ? -1 : 1; VectorMA( NPC->currentOrigin, FIGHTER_STRAFE_DIS * dir, right, end ); gi.trace( &tr, NPC->currentOrigin, NULL, NULL, end, NPC->s.number, MASK_SOLID, (EG2_Collision)0, 0 ); // Close enough if ( tr.fraction > 0.9f ) { VectorMA( NPC->client->ps.velocity, FIGHTER_STRAFE_VEL * dir, right, NPC->client->ps.velocity ); // Add a slight upward push NPC->client->ps.velocity[1] += FIGHTER_UPWARD_PUSH; //NPC->client->ps.velocity[2] += FIGHTER_UPWARD_PUSH; // Set the strafe start time so we can do a controlled roll NPC->fx_time = level.time; NPCInfo->standTime = level.time + 3000 + random() * 500; } } //extern void rocketThink ( gentity_t *ent ); /* ------------------------- Fighter_Hunt ------------------------- */ void Fighter_Hunt( qboolean visible, qboolean advance ) { float distance, speed; vec3_t forward; //If we're not supposed to stand still, pursue the player if ( NPCInfo->standTime < level.time ) { // Only strafe when we can see the player if ( visible ) { Fighter_Strafe(); return; } } //If we don't want to advance, stop here if ( !advance && visible ) return; //Only try and navigate if the player is visible if ( visible == qfalse ) { // Move towards our goal NPCInfo->goalEntity = NPC->enemy; NPCInfo->goalRadius = 1024; NPC_MoveToGoal(qtrue); return; } else { VectorSubtract( NPC->enemy->currentOrigin, NPC->currentOrigin, forward ); distance = VectorNormalize( forward ); } speed = FIGHTER_FORWARD_BASE_SPEED + FIGHTER_FORWARD_MULTIPLIER * g_spskill->integer; VectorMA( NPC->client->ps.velocity, speed, forward, NPC->client->ps.velocity ); } /* ------------------------- Fighter_RangedAttack ------------------------- */ void Fighter_RangedAttack( qboolean visible, qboolean advance ) { if ( TIMER_Done( NPC, "attackDelay" ) && NPC->attackDebounceTime < level.time && visible ) // Attack? { if ( NPCInfo->burstCount > 6 ) { if ( !NPC->fly_sound_debounce_time ) {//delay closing down to give the player an opening NPC->fly_sound_debounce_time = level.time + Q_irand( 500, 2000 ); } else if ( NPC->fly_sound_debounce_time < level.time ) { NPCInfo->localState = FSTATE_ACTIVE; NPC->fly_sound_debounce_time = NPCInfo->burstCount = 0; TIMER_Set( NPC, "attackDelay", Q_irand( 2000, 3500) ); NPC_SetAnim( NPC, SETANIM_BOTH, BOTH_FLY_SHIELDED, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD ); G_SoundOnEnt( NPC, CHAN_AUTO, "sound/chars/Fighter/misc/Fighter_shield_close" ); // Fighter high ranked shield itself when chase the player. if ( NPCInfo->rank > RANK_LT_COMM ) { NPC->flags |= FL_SHIELDED; } } } else { Fighter_Fire(); } } if ( NPCInfo->scriptFlags & SCF_CHASE_ENEMIES ) { Fighter_Hunt( visible, advance ); } } /* ------------------------- Fighter_MaintainHeight ------------------------- */ void Fighter_MaintainHeight( void ) { float dif; NPC->s.loopSound = G_SoundIndex( "sound/chars/Fighter/misc/Fighter_hover_1_lp" ); // Update our angles regardless NPC_UpdateAngles( qtrue, qtrue ); // If we have an enemy, we should try to hover at about enemy eye level if ( NPC->enemy ) { // Find the height difference dif = (NPC->enemy->currentOrigin[2]+NPC->enemy->maxs[2]) - NPC->currentOrigin[2]; // cap to prevent dramatic height shifts if ( fabs( dif ) > 8 ) { if ( fabs( dif ) > FIGHTER_HOVER_HEIGHT ) { dif = ( dif < 0 ? -24 : 24 ); } NPC->client->ps.velocity[2] = (NPC->client->ps.velocity[2]+dif)/2; } } else { gentity_t *goal = NULL; if ( NPCInfo->goalEntity ) // Is there a goal? { goal = NPCInfo->goalEntity; } else { goal = NPCInfo->lastGoalEntity; } if (goal) { dif = goal->currentOrigin[2] - NPC->currentOrigin[2]; if ( fabs( dif ) > FIGHTER_HOVER_HEIGHT ) { ucmd.upmove = ( ucmd.upmove < 0 ? -4 : 4 ); } else { if ( NPC->client->ps.velocity[2] ) { NPC->client->ps.velocity[2] *= FIGHTER_VELOCITY_DECAY; if ( fabs( NPC->client->ps.velocity[2] ) < 2 ) { NPC->client->ps.velocity[2] = 0; } } } } // Apply friction to Z else if ( NPC->client->ps.velocity[2] ) { NPC->client->ps.velocity[2] *= FIGHTER_VELOCITY_DECAY; if ( fabs( NPC->client->ps.velocity[2] ) < 1 ) { NPC->client->ps.velocity[2] = 0; } } } // Apply friction if ( NPC->client->ps.velocity[0] ) { NPC->client->ps.velocity[0] *= FIGHTER_VELOCITY_DECAY; if ( fabs( NPC->client->ps.velocity[0] ) < 1 ) { NPC->client->ps.velocity[0] = 0; } } if ( NPC->client->ps.velocity[1] ) { NPC->client->ps.velocity[1] *= FIGHTER_VELOCITY_DECAY; if ( fabs( NPC->client->ps.velocity[1] ) < 1 ) { NPC->client->ps.velocity[1] = 0; } } NPC_FaceEnemy( qtrue ); } void Fighter_flyforward1( void ) { //qboolean visible, advance; // Rate our distance to the target and visibilty /*float distance2 = (int) DistanceHorizontalSquared( NPC->currentOrigin, NPC->enemy->currentOrigin ); qboolean visible2 = NPC_ClearLOS( NPC->enemy ); qboolean advance2 = (qboolean)(distance2 > FIGHTER_MIN_DISTANCE_SQR);*/ //visible, int advance; float distance, speed; vec3_t forward; speed = NPCInfo->stats.walkSpeed; //speed = FIGHTER_FORWARD_BASE_SPEED + FIGHTER_FORWARD_MULTIPLIER * g_spskill->integer; VectorMA( NPC->client->ps.velocity, speed, forward, NPC->client->ps.velocity ); distance = VectorNormalize( forward ); //We're not supposed to stand still, move forward at run speed! if ( NPCInfo->standTime < level.time ) { speed = NPCInfo->stats.walkSpeed; //FIGHTER_FORWARD_BASE_SPEED + FIGHTER_FORWARD_MULTIPLIER * g_spskill->integer; VectorMA( NPC->client->ps.velocity, speed, forward, NPC->client->ps.velocity ); distance = VectorNormalize( forward ); // Only strafe when we can see the player /*if ( visible2 ) { Fighter_Strafe(); return; }*/ } //If we don't want to advance, stop here /*if ( !advance2 && visible2 ) return;*/ //Only try and navigate if the player is visible /*if ( visible2 == qfalse ) { // Move towards our goal NPCInfo->goalEntity = NPC->enemy; NPCInfo->goalRadius = 1024; NPC_MoveToGoal(qtrue); return; } else { VectorSubtract( NPC->enemy->currentOrigin, NPC->currentOrigin, forward ); distance = VectorNormalize( forward ); }*/ /* vec3_t forward, right; FighterSpeed = NPC->client->ps.speed; //float forwardAmt = forward*FighterVelocity; //FighterVelocity = forwardAmt; NPC->client->ps.speed = NPCInfo->stats.walkSpeed; //AngleVectors( self->currentAngles, forward, right, NULL ); AngleVectors( NPC->currentAngles, forward, NULL, NULL ); FighterSpeed = VectorNormalize(FighterVelocity); //else if /*vec3_t forward, right; //AngleVectors( self->currentAngles, forward, right, NULL ); // Automoving forward at walkspeed. FighterSpeed = VectorNormalize(FighterVelocity); //float forwardAmt = forward*FighterVelocity; // ????!?!??! what i need to do now?!?!? // CODE PAST BY AI_JEDI.CPP if ( VectorCompare( NPC->client->ps.moveDir, vec3_origin ) && (ucmd.forwardmove||ucmd.rightmove) ) {//using ucmds to move this turn, not NAV if ( (ucmd.buttons&BUTTON_WALKING) ) {//FIXME: NAV system screws with speed directly, so now I have to re-set it myself! NPC->client->ps.speed = NPCInfo->stats.walkSpeed; } else { NPC->client->ps.speed = NPCInfo->stats.runSpeed; } } // CODE PASTE BY NPC_MOVE.CPP /*dir[2] = 0; VectorNormalize( dir ); //NPCs cheat and store this directly because converting movement into a ucmd loses precision VectorCopy( dir, self->client->ps.moveDir ); float fDot = DotProduct( forward, dir ) * 127.0f; float rDot = DotProduct( right, dir ) * 127.0f; //Must clamp this because DotProduct is not guaranteed to return a number within -1 to 1, and that would be bad when we're shoving this into a signed byte if ( fDot > 127.0f ) { fDot = 127.0f; } if ( fDot < -127.0f ) { fDot = -127.0f; } if ( rDot > 127.0f ) { rDot = 127.0f; } if ( rDot < -127.0f ) { rDot = -127.0f; } cmd->forwardmove = floor(fDot); cmd->rightmove = floor(rDot);*/ } /* ------------------------- Fighter_Idle ------------------------- */ void Fighter_Idle( void ) { Fighter_MaintainHeight(); //Fighter_flyforward1(); // Is he waking up? if (NPCInfo->localState == FSTATE_WAKEUP) { if (NPC->client->ps.torsoAnimTimer<=0) { NPCInfo->scriptFlags |= SCF_LOOK_FOR_ENEMIES; NPCInfo->burstCount = 0; } } else { NPC_SetAnim( NPC, SETANIM_BOTH, BOTH_SLEEP1, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD ); NPC->flags |= FL_SHIELDED; NPC_BSIdle(); } } /* ------------------------- Fighter_AttackDecision ------------------------- */ void Fighter_AttackDecision( void ) { // Always keep a good height off the ground Fighter_MaintainHeight(); NPC->s.loopSound = G_SoundIndex( "sound/chars/Fighter/misc/Fighter_hover_2_lp" ); //randomly talk if ( TIMER_Done(NPC,"patrolNoise") ) { if (TIMER_Done(NPC,"angerNoise")) { G_SoundOnEnt( NPC, CHAN_AUTO, va("sound/chars/Fighter/misc/talk%d", Q_irand(1, 3)) ); TIMER_Set( NPC, "patrolNoise", Q_irand( 4000, 10000 ) ); } } // He's dead. if (NPC->enemy->health<1) { NPC->enemy = NULL; Fighter_Idle(); return; } // If we don't have an enemy, just idle if ( NPC_CheckEnemyExt() == qfalse ) { Fighter_Idle(); return; } // Rate our distance to the target and visibilty float distance = (int) DistanceHorizontalSquared( NPC->currentOrigin, NPC->enemy->currentOrigin ); qboolean visible = NPC_ClearLOS( NPC->enemy ); qboolean advance = (qboolean)(distance > FIGHTER_MIN_DISTANCE_SQR); // If we cannot see our target, move to see it if ( visible == qfalse ) { if ( NPCInfo->scriptFlags & SCF_CHASE_ENEMIES ) { Fighter_Hunt( visible, advance ); return; } } NPC_FaceEnemy( qtrue ); Fighter_RangedAttack( visible, advance ); } qboolean NPC_CheckFighterTeamStealth( void ); /* ------------------------- Fighter_Hunt - look for enemy. -------------------------` */ void Fighter_Hunt(void) { if ( NPCInfo->goalEntity == NULL ) { NPCInfo->goalEntity = NPC->enemy; } NPC_FaceEnemy( qtrue ); NPCInfo->combatMove = qtrue; NPC_MoveToGoal( qtrue ); } /* ------------------------- Fighter_Patrol ------------------------- */ void Fighter_Patrol( void ) { Fighter_MaintainHeight(); //SENTRY CODE //If we have somewhere to go, then do that if (!NPC->enemy) { if ( NPC_CheckPlayerTeamStealth() ) { //NPC_AngerSound(); NPC_UpdateAngles( qtrue, qtrue ); return; } if ( UpdateGoal() ) { //start loop sound once we move ucmd.buttons |= BUTTON_WALKING; NPC_MoveToGoal( qtrue ); } //randomly talk if (TIMER_Done(NPC,"patrolNoise")) { G_SoundOnEnt( NPC, CHAN_AUTO, va("sound/chars/Fighter/misc/talk%d", Q_irand(1, 3)) ); TIMER_Set( NPC, "patrolNoise", Q_irand( 2000, 4000 ) ); } } NPC_UpdateAngles( qtrue, qtrue ); //// MARK CODE if ( NPC_CheckPlayerTeamStealth() ) { G_Sound( NPC, G_SoundIndex("sound/chars/Fighter/misc/Fighter_wakeup")); NPC_UpdateAngles( qtrue, qtrue ); return; } //If we have somewhere to go, then do that if (!NPC->enemy) { if ( UpdateGoal() ) { ucmd.buttons |= BUTTON_WALKING; NPC_MoveToGoal( qtrue ); NPC_UpdateAngles( qtrue, qtrue ); } //randomly talk if (TIMER_Done(NPC,"patrolNoise")) { G_Sound( NPC, G_SoundIndex(va("sound/chars/Fighter/misc/talk%d.wav", Q_irand(1, 4)))); TIMER_Set( NPC, "patrolNoise", Q_irand( 2000, 4000 ) ); } } } /* ------------------------- NPC_BSFighter_Default ------------------------- */ void NPC_BSFighter_Default( void ) { // When you spawn immediatly execute this!! Fighter_flyforward1(); //NPC->client->forced_forwardmove = 127; // DA PROGRAMMARE PER ORA E' INERTE. //NPC->e_DieFunc = dieF_Fighter_die; /*if ( NPC->targetname ) { //NPC->e_UseFunc = useF_TieFighter_use; NPC->e_UseFunc = useF_TieFighterUse; }*/ if ( NPC->enemy ) { if( (NPCInfo->scriptFlags & SCF_CHASE_ENEMIES) ) { NPCInfo->goalEntity = NPC->enemy; } Fighter_Hunt(); // Fighter_Hunt( visible, advance); Fighter_AttackDecision(); Fighter_Update(); } /*{ NPCInfo->goalEntity = NPC->enemy; Fighter_Hunt(); Fighter_AttackDecision(); }*/ else if ( NPCInfo->scriptFlags & SCF_LOOK_FOR_ENEMIES ) { Fighter_Patrol(); } else { Fighter_Idle(); } } -
Ask me anything about the Jedi source code
Asgarath83 replied to MGummelt's topic in Coding and Scripts
i tryed this but with no much result vec3_t forward, right; FighterSpeed = NPC->client->ps.speed; //float forwardAmt = forward*FighterVelocity; //FighterVelocity = forwardAmt; NPC->client->ps.speed = NPCInfo->stats.walkSpeed; //AngleVectors( self->currentAngles, forward, right, NULL ); AngleVectors( NPC->currentAngles, forward, NULL, NULL ); FighterSpeed = VectorNormalize(FighterVelocity); i cannot use float forwardAmt because visual studio give me error. it require an editable Lvalue... o.O. -
Ask me anything about the Jedi source code
Asgarath83 replied to MGummelt's topic in Coding and Scripts
@@MGummelt okay, this is what i am trying to archieve. I have my fighter AI, and this is the default behavour. void NPC_BSFighter_Default( void ) { NPC->client->forced_forwardmove = 127; // WORK IN PROGRESS //NPC->e_DieFunc = dieF_Fighter_die; /*if ( NPC->targetname ) { //NPC->e_UseFunc = useF_TieFighter_use; NPC->e_UseFunc = useF_TieFighterUse; }*/ if ( NPC->enemy ) { if( (NPCInfo->scriptFlags & SCF_CHASE_ENEMIES) ) { NPCInfo->goalEntity = NPC->enemy; } Fighter_Hunt(); Fighter_AttackDecision(); Fighter_Update(); } /*{ NPCInfo->goalEntity = NPC->enemy; Fighter_Hunt(); Fighter_AttackDecision(); }*/ else if ( NPCInfo->scriptFlags & SCF_LOOK_FOR_ENEMIES ) { Fighter_Patrol(); } else { Fighter_Idle(); } } as you can see, the fighter have the following statements: Idle: do nothing, is the behavor that assume when it spawn. is in wait of order. Patrol: move throught waypoint and Navgoal, like a sentry, following desired icarus scripted path. Hunt: chase an Enemy Update: update the AI fight boba fett fighting advanced ai commands and behavours. AttackDecision: remind to tacticts: fighter decide what kind of approach have on the Enemy, switching and selecting the properly weapons of his arsenal to attack, this is set by calculating variable like the distance from opponent and other tnings. this works like an half way between a sentry Ai and Bobafett AI. now, i want that fighter get an autoforward movement when is in idle and patrol. this movement are not a specified speed. should be more better if the speed value can be definied throught NPC file. for Idle and Patrol behavour i want to force fighter to move forward at his walkspeed. for Hunt and attack behavour, when shoot and chase enemy, i wanna force the fighter to move forward to his NPC Runspeed. so, i start with my Fighter_Idle code. void Fighter_Idle( void ) { Fighter_MaintainHeight(); Fighter_flyforward1(); // Is he waking up? if (NPCInfo->localState == FSTATE_WAKEUP) { if (NPC->client->ps.torsoAnimTimer<=0) { NPCInfo->scriptFlags |= SCF_LOOK_FOR_ENEMIES; NPCInfo->burstCount = 0; } } else { NPC_SetAnim( NPC, SETANIM_BOTH, BOTH_SLEEP1, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD ); NPC->flags |= FL_SHIELDED; NPC_BSIdle(); } } where Fighter_flyforward is the void function called for take the automovement to the fighter. now is the hardest way... WRITE the fighter_flyforward function. void Fighter_flyforward1( gentity_t *self, usercmd_t *cmd, vec3_t dir ) { vec3_t forward, right; AngleVectors( self->currentAngles, forward, right, NULL ); // Automoving forward at walkspeed. FighterSpeed = VectorNormalize(FighterVelocity); float forwardAmt = forward*FighterVelocity; // ????!?!??! what i need to do now?!?!? // CODE PAST BY AI_JEDI.CPP if ( VectorCompare( NPC->client->ps.moveDir, vec3_origin ) && (ucmd.forwardmove||ucmd.rightmove) ) {//using ucmds to move this turn, not NAV if ( (ucmd.buttons&BUTTON_WALKING) ) {//FIXME: NAV system screws with speed directly, so now I have to re-set it myself! NPC->client->ps.speed = NPCInfo->stats.walkSpeed; } else { NPC->client->ps.speed = NPCInfo->stats.runSpeed; } }*/ // CODE PASTE BY NPC_MOVE.CPP dir[2] = 0; VectorNormalize( dir ); //NPCs cheat and store this directly because converting movement into a ucmd loses precision VectorCopy( dir, self->client->ps.moveDir ); float fDot = DotProduct( forward, dir ) * 127.0f; float rDot = DotProduct( right, dir ) * 127.0f; //Must clamp this because DotProduct is not guaranteed to return a number within -1 to 1, and that would be bad when we're shoving this into a signed byte if ( fDot > 127.0f ) { fDot = 127.0f; } if ( fDot < -127.0f ) { fDot = -127.0f; } if ( rDot > 127.0f ) { rDot = 127.0f; } if ( rDot < -127.0f ) { rDot = -127.0f; } cmd->forwardmove = floor(fDot); cmd->rightmove = floor(rDot); } basically, i not know much of C++ just the base and i have not familiarity with vector. for my curse, i never ended the high schools for heal problems, so i lack of math knowledge i need for understand that. i pasted for have an hint two chunks of code: one is the function you direct to me, that sect the movement in base of direction to an NPC when is moving. the second chunks of code i picked up from Ai_JEDI.CPP. i Not need directly that, but i just wanna to give a look about how to force , with code way, an NPC to move at walkspeed NPC data value or runspeed. this chunk of code contain the answer. so now, what i need is to merge the two stuff into something that my Fighter can understand. at the start of file, i setted FighterSpeed as an int Int FighterSpeed; vec3_t FighterVelocity; That's are my version of your suggested desiredSpeed and DesiredVelocity. This is the part that i really not anderstand. because there is not any forwardAmt on my code. float forwardAmt = forward*FighterVelocity; Well, so basically... i reached a dead lock point. i not know exactly how to write this function. i not want to abuse of your time and your patience, you are very kind with me and other coder, but... well, i should need an hint, or little better because i not understand much vector maths, (vectors are simply directions, X, Y, Z, on a cartesian 3d grid, for what i understood, they are necessaty for tell to the entity how to move and in what direction on the 3Dspace of game). well, i need a step by step little guide about that. Thanks for every reply. :\ i spend 3 hours on that and i get a painful headache. -
Ask me anything about the Jedi source code
Asgarath83 replied to MGummelt's topic in Coding and Scripts
Dear MGummelt, thanks for time you spend to answer to me and to alls coder of JKHUB. here in italy is pretty hot summer and is not easy stay on computer to do coding with hot weather. but i'll do as soon as i can. i really want to see the result and i think your suggests are pretty valid and interessing. thanks again and have nice holiday. i'will let you know my progress -
Ask me anything about the Jedi source code
Asgarath83 replied to MGummelt's topic in Coding and Scripts
That's explain a very lot of things. infact after build nothing is changed to my fighter (but they are NOT vehicle, myster they are really NPC... basically they are like droids... but i want they move and fight like a vehicle. something like that. i do that with NPC code instead of vehicle because NPC is more simply to use, not need a driver and have more weapons and weapons can be easy switchable (i want my fighters using seekers if enemy is far and blaster if near, and bomb and chaff and flare and other original weapons too, is for a science fiction mod not only star wars ) basically i want to recreate this movement: https://www.youtube.com/watch?v=CDntDe7eazAleaving out leaving force forward move, and using a vector movement imbued into NPC AI client code that force NPC to move a walkspeed into his idle \ patrol state and runspeed at his attack \ flee \ hunt \ strafe behavour state, there is some other way to do that with a simple vector move along Y axis? i am not familiar with vector so i need an example of a little function that force an entity to move forward along a vector direction. there is into the code the command about SET_MOVEMENT X \ Y \ Z of something like that and it work on every entity, npc included, but i tryed and it move with absolutely direction, not with a vector related to X Y Z left \ right forward \ backward and up \ down of NPC. i need just to push a fighter along Y axis with + values, but NOT with absolutely map Y vector, but with Y axis vector relative to entity. mmm strange, video link not work try to dive into google with search about "rogue squadron 3d escape on fest gold medal" and you see what i want to recreate. -
Ask me anything about the Jedi source code
Asgarath83 replied to MGummelt's topic in Coding and Scripts
tested but fighters not run forward on spawning like i desire. I think there is something missing again. Well i will focus on that when i'll got more time. now is hot day. basically i am trying to recreate the forward movement of fighters of Rogue Squadron 3D game. Have nice time and thanks for answer! i think use icarus command is not sufficient ( on SP forced_forwardmove is a signed_chars on the scructure g_client_s ) maybe i not sufficient to add command to the AI behavour, or calling with icarus scripting after i added on p_move. maybe i near really to write an entire function structure for automatically move NPCs forward when is called, and add on gNPC_t and after add on p_move... mmm headaching. :S there is not possibility to simply add a movement on a character with a vector Y setting on his AI code? at the end i need only that my AI Class automatically move forward along Y axis. -
Ask me anything about the Jedi source code
Asgarath83 replied to MGummelt's topic in Coding and Scripts
I do two edit one in BS_Fighter_Default void NPC_BSFighter_Default( void ) { NPC->client->forced_forwardmove = 127; and the other on bg_pmove.cpp on void pmove, near to end of file. i added the last condition } if ( pm->ps->pm_flags & PMF_SLOW_MO_FALL ) {//half grav pm->ps->gravity *= 2; } // FIX FOR NPC MOVE FORWARD if ( pm->gent && pm->gent->NPC && pm->gent->NPC->force_forwardmove != 0) {// Boost up forward! EVER! pm->cmd.forwardmove = pm->gent->NPC->force_forwardmove; } }when i build i get a build error because forceforwardmove is not a member of gNPC_t (on b_public.h) Okay i am adding on gNPC_t . but is forced_forwardmove not forceforward. now i understand the code errors. stilling building Dll. -
Ask me anything about the Jedi source code
Asgarath83 replied to MGummelt's topic in Coding and Scripts
Oh... is on pm array... D: i used until now with failure this if ( NPC->client->NPC_class == CLASS_FIGHTER) { NPC->client->forced_forwardmove = 127; // force to runspeed } example on NPC_spawn.CPP i tried else if ( ent->client->NPC_class == CLASS_FIGHTER ) { ent->client->ps.gravity = 0; ent->svFlags |= SVF_CUSTOM_GRAVITY; ent->client->moveType = MT_FLYSWIM; ent->s.loopSound = G_SoundIndex( "sound/vehicles/tie-bomber/loop.wav" ); ent->client->force_forwardmove = 127; // For start to fly? ent->client->ps.forcePowersKnown |= ( 1 << FP_LEVITATION ); ent->client->ps.forcePowerLevel[FP_LEVITATION] = FORCE_LEVEL_3; ent->client->ps.forcePower = 100; ent->NPC->scriptFlags |= (SCF_NAV_CAN_FLY|SCF_FLY_WITH_JET|SCF_NAV_CAN_JUMP);//no groups, no combat points! //start in the air, use spotlight //ent->NPC->scriptFlags |= SCF_NO_GROUPS; ent->NPC->scriptFlags &= ~SCF_FLY_WITH_JET; RT_FlyStart( ent ); NPC_SetMoveGoal( ent, ent->currentOrigin, 16, qfalse, -1, NULL ); VectorCopy( ent->currentOrigin, ent->pos1 ); // Spawn Floating until see an enemy! NPC_SetAnim( ent, SETANIM_LEGS, BOTH_SWIM_IDLE1, SETANIM_FLAG_NORMAL ); NPC_SetAnim( ent, SETANIM_TORSO, BOTH_SWIM_IDLE1, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD ); ent->client->ps.torsoAnimTimer = level.time + cg.time; } (i tryed to worked around a merged copy of Seeker, Sentry and rockettrooper\Bobafett AI, Seeker \ sentry ai for flight movement and strafing and death with explosion and corpse disappering; boba fett for switching weapons and tactics. niceful for fight, but not force forwarding. so my fighter act like assault chopters, like tornadoes of saint row series LOL. ) i will try the pm way! thanks! :3 -
@@DT85 still better. now i get "only" the f****ed "ohi ahi i hate this md3 because have more of 1k vertexes on that mesh..." so i think for fix is sufficient to split the incriminated. on blender i can easily see vertex number of a mesh. i think misc_model problem is strange. seems to happen when misc_model have more of 6k vertexes as total amount of meshes... (md3 have total of 10k vertexes each one) otherwise... with ripped stuff into 3ds format i not get never this trouble. and i tested a map of a cathedral with a mesh with more of 10k! (cathedral was splitted in a mesh for material and some was very very... load as vertexes numers.)... so i think depend by limitation of MD3 format. pity there is not a way to rip into a single frameshot this lake with 3dripper. is so big that cannot render all area on original game. however thanks. i had already this kind of trouble when i recreated the ruined pillars of nosgoth from soul reaver 2 for first level of my mod. when i did that, i used only MD3... i get a very craziness for force JKA to eat the misc_models of pillars... i was forced to spli the scene into 4 different MD3.
-
Ok, i'll do. the alternative is to split in a large amount of MD3 all the scenes and also to become crazy to detach all meshes with more of 1k vertexes. Why a entity model static is more sure respect a misc_model for this kind of silly errors of q3map2 and vanilla engine?
-
By a code way, i see crash is caused from this: tr_bsp.cpp Sorry, i got problem with bbcode. i show that: /* =============== ParseTriSurf =============== */ static void ParseTriSurf( dsurface_t *ds, mapVert_t *verts, msurface_t *surf, int *indexes, world_t &worldData, int index ) { srfTriangles_t *tri; int i, j, k; int numVerts, numIndexes; // get fog volume surf->fogIndex = LittleLong( ds->fogNum ) + 1; if (index && !surf->fogIndex && tr.world && tr.world->globalFog != -1) { surf->fogIndex = worldData.globalFog; } // get shader surf->shader = ShaderForShaderNum( ds->shaderNum, lightmapsVertex, ds->lightmapStyles, ds->vertexStyles, worldData ); if ( r_singleShader->integer && !surf->shader->sky ) { surf->shader = tr.defaultShader; } numVerts = LittleLong( ds->numVerts ); numIndexes = LittleLong( ds->numIndexes ); if ( numVerts >= SHADER_MAX_VERTEXES ) { Com_Error(ERR_DROP, "ParseTriSurf: verts > MAX (%d > %d) on misc_model %s", numVerts, SHADER_MAX_VERTEXES, surf->shader->name ); } if ( numIndexes >= SHADER_MAX_INDEXES ) { Com_Error(ERR_DROP, "ParseTriSurf: indices > MAX (%d > %d) on misc_model %s", numIndexes, SHADER_MAX_INDEXES, surf->shader->name ); } tri = (srfTriangles_t *) Z_Malloc( sizeof( *tri ) + numVerts * sizeof( tri->verts[0] ) + numIndexes * sizeof( tri->indexes[0] ), TAG_HUNKMISCMODELS, qfalse ); tri->dlightBits = 0; //JIC tri->surfaceType = SF_TRIANGLES; tri->numVerts = numVerts; tri->numIndexes = numIndexes; tri->verts = (drawVert_t *)(tri + 1); tri->indexes = (int *)(tri->verts + tri->numVerts ); surf->data = (surfaceType_t *)tri; // copy vertexes verts += LittleLong( ds->firstVert ); ClearBounds( tri->bounds[0], tri->bounds[1] ); for ( i = 0 ; i < numVerts ; i++ ) { for ( j = 0 ; j < 3 ; j++ ) { tri->verts.xyz[j] = LittleFloat( verts.xyz[j] ); tri->verts.normal[j] = LittleFloat( verts.normal[j] ); } AddPointToBounds( tri->verts.xyz, tri->bounds[0], tri->bounds[1] ); for ( j = 0 ; j < 2 ; j++ ) { tri->verts.st[j] = LittleFloat( verts.st[j] ); for(k=0;k<MAXLIGHTMAPS;k++) { tri->verts.lightmap[k][j] = LittleFloat( verts.lightmap[k][j] ); } } for(k=0;k<MAXLIGHTMAPS;k++) { R_ColorShiftLightingBytes( verts.color[k], tri->verts.color[k] ); } } // copy indexes indexes += LittleLong( ds->firstIndex ); for ( i = 0 ; i < numIndexes ; i++ ) { tri->indexes = LittleLong( indexes ); if ( tri->indexes < 0 || tri->indexes >= numVerts ) { Com_Error( ERR_DROP, "Bad index in triangle surface" ); } } }
-
I have a big lake map. because i am unabled to ripped out from a game in a single shoot and i need the entire landscape, i extracted collada from with a tool from game (model ex 4). collada lost his textures so i need to manually assign (i have no problem on that with 3DS format i discover a method for ripper 3d ripper dx frames. but however... i need this area to an high quality not ripped enviroment. i imported collada on blender, i removed sky and water meshes (they are silly big for model). because area is BIG and is done by 50 meshes, i have no choice that export on MD3. i assigned manually materials and textures with "md3shader custom properties" and "copy custom properties" and 1 hour of painful work to put correct texture name to each mesh, i had no problem on that. but obvius 50 mesh are too much for MD3 format. so i splitted the model into two MD3, by 25 meshes each one. on radiant is all okay. i not use spawnflag solid because if i use i hit the MAX_BRUSHES error (map have more of 32k etc brushes) so... okay, i can build with no solid and using clipping. at least player can walk only in a little road valley of the landscape. cannot go into lake. is a vampire and water is deadly for vampires. so... that's fine. what is the problem: i tryed to load the map on JKA with a build meta and i get this error "parse trisurf indices > Max (8550 > 6000 ) on misc_model models/sr2/sarruins/lake2b-1090 i seek on blender the mesh that use this texture and is of 929 vertexes So... why it give me this error? (and i get also with another model more more more simple of that.) strangely, if use the 3DS format with ripped models i not get any error on radiant or on map, also for very bigh, high and massively models structures. mmm i see there are some meshes that overcap 1000 vertexes md3 limit... strangely i not get crash for that motivation.
-
well jedi knight galaxyes + rend2 + warzone ... i think is possible to reach something like that. maybe not a MMORPG but a RPG multiplayer yes. i hope for things like that also for SP. .-.