GoldenEye: Source Forums

Editing and Customization => Community Content => Topic started by: click4dylan on April 23, 2015, 09:10:19 am

Title: Nightfire Source Bots - Question for GE:S Developers
Post by: click4dylan on April 23, 2015, 09:10:19 am
I'm inquiring if the Goldeneye Source team would mind if we use their bot source code available on GitHub to use in Nightfire: Source. At least until we get our own bots. We would obviously provide credit. There are many people who are asking us to bring bots to the game, and many who don't want to play because there aren't any. This would help us immensely. Thank you so much for your response.

-Dylan (Lead developer at www.NightfireSource.com (http://www.NightfireSource.com))
Title: Re: Nightfire Source Bots - Question for GE:S Developers
Post by: killermonkey on April 23, 2015, 04:07:05 pm
Please use the code! However, I caution you its very ugly :(
Title: Re: Nightfire Source Bots - Question for GE:S Developers
Post by: click4dylan on April 23, 2015, 10:52:42 pm
Thanks so much! Don't worry. We have our fair share of ugly code as well. The Source SDK is so undocumented there's like 1000 ways to do something but only one or two that are the 'correct' way. It took us like 3 or 4 rewrites to the grapple phone alone to get it to function the same way as the original Nightfire. All the tutorials on the net, and examples we found either didn't work, or didn't function how we wanted it.

Lol, here's a crap snippet of code from the RC helicopter code. Had major issues trying to get entities to render out of the current PVS, so i ended up writing this convoluted crap to attach the player to the heli and make him invisible and invulnerable when firing.
Code: [Select]
if ( cmd->buttons & IN_ATTACK && time - lasttime_leftclicked > RandomFloat(0.1, 0.125) ){
m_bRecoil = true;
Vector savedplayerorigin = pPlayer->GetAbsOrigin();
pPlayer->AddEffects(EF_NODRAW);
MoveType_t savedmovetype = pPlayer->GetMoveType();
pPlayer->SetMoveType(MOVETYPE_NOCLIP);
int savedtakedamage = pPlayer->m_takedamage;
pPlayer->m_takedamage = DAMAGE_NO;
SolidType_t savedsolidtype = pPlayer->GetSolid();
pPlayer->SetSolid(SOLID_NONE);
lasttime_leftclicked = time;
Vector origin = GetLocalOrigin();
origin.z -= 2;
//Take the Player's EyeAngles and turn it into a direction
Vector vecDir;
AngleVectors( GetLocalAngles(), &vecDir );
//todo: fix spread, it's not shown on client correctly
//float spreadx = RandomFloat(-0.05, 0.05);
//float spready = RandomFloat(-0.05, 0.05);
pPlayer->FireBullets(1, origin, vecDir, Vector(0, 0, 0), 4096, GetAmmoDef()->Index( "minigun" ), 4, -1, -1, 20, pPlayer->GetBaseEntity(), false, true);
CBroadcastRecipientFilter broadcast;
EmitSound(broadcast, entindex(), PHELICOPTER_GUNSOUND, &origin, 0, 0);

Vector vecAbsEnd = origin + (vecDir * MAX_TRACE_LENGTH);
trace_t tr;
//Do the TraceLine, and write our results to our trace_t class, tr.
pPlayer->FollowEntity(this);
UTIL_TraceLine( origin, vecAbsEnd, MASK_SOLID, pPlayer, COLLISION_GROUP_NONE, &tr );
UTIL_Tracer( (Vector&)origin, (Vector&)tr.endpos, entindex(), 1, 6000, true, "GaussTracer" );
pPlayer->StopFollowingEntity();
pPlayer->SetAbsOrigin(savedplayerorigin);
pPlayer->RemoveEffects(EF_NODRAW);
pPlayer->SetMoveType(savedmovetype);
pPlayer->SetSolid(savedsolidtype);
pPlayer->m_takedamage = savedtakedamage;
}
if ( cmd->buttons & IN_ATTACK2 && time - lasttime_rightclicked > 3 ){
m_bShake = true;
Vector savedplayerorigin = pPlayer->GetAbsOrigin();
pPlayer->AddEffects(EF_NODRAW);
MoveType_t savedmovetype = pPlayer->GetMoveType();
pPlayer->SetMoveType(MOVETYPE_NOCLIP);
int savedtakedamage = pPlayer->m_takedamage;
pPlayer->m_takedamage = DAMAGE_NO;
SolidType_t savedsolidtype = pPlayer->GetSolid();
pPlayer->SetSolid(SOLID_NONE);
lasttime_rightclicked = time;
Vector origin = GetLocalOrigin();
origin.z -= 2;
//Take the Player's EyeAngles and turn it into a direction
Vector vecDir;
AngleVectors( GetLocalAngles(), &vecDir );
CBroadcastRecipientFilter broadcast;
EmitSound(broadcast, entindex(), PHELICOPTER_ROCKETSOUND, &origin, 0, 0);
CMissile *pMissile = CMissile::Create( origin, GetLocalAngles(), this->edict() ); //CRASH
if(!pMissile)
return;
pMissile->SetGravity(0.1);
pMissile->SetMoveType(MOVETYPE_FLYGRAVITY);
pMissile->SetImpactEnergyScale(0.5f);
pMissile->SetOwnerEntity(pPlayer);
pMissile->SetAbsVelocity(vecDir * 600);
pMissile->SetDamage( 80 );
pPlayer->StopFollowingEntity();
pPlayer->SetAbsOrigin(savedplayerorigin);
pPlayer->RemoveEffects(EF_NODRAW);
pPlayer->SetMoveType(savedmovetype);
pPlayer->SetSolid(savedsolidtype);
pPlayer->m_takedamage = savedtakedamage;
}
Title: Re: Nightfire Source Bots - Question for GE:S Developers
Post by: killermonkey on April 25, 2015, 01:53:01 pm
We had to render out of PVS for the glow effect. Here is a more elegant way of doing it:

https://github.com/goldeneye-source/ges-code/blob/develop/game/shared/ges/ge_weapon.cpp#L401

Basically you force the entity to be part of your leaf system which dictates PVS, networking, etc.
Title: Re: Nightfire Source Bots - Question for GE:S Developers
Post by: Kratos on May 02, 2015, 05:31:50 am
I'm inquiring if the Goldeneye Source team would mind if we use their bot source code available on GitHub to use in Nightfire: Source.
-Dylan (Lead developer at www.NightfireSource.com (http://www.NightfireSource.com))

Sure, just make GES singleplayer support and we will share the code :P

jk

Good luck with your project.