Posted: Thu Nov 02, 2006 7:58 pm
Are you replacing mfc's with widgets? I've never gotten to play around with mfc's so I have no clue what they even are. But I can give it a shot, and see what happends.
Let your game become a reality!
http://forum.realityfactory.info/
would you be able to use this test to do what u suggest, i cant think of much we have missed, may be a little more complicated that implementing network chess code but woud you be able to help?I think I could implement multiplayer of my old chess game using these numbers...).
I did try disconnecting each machine, neither pc detected it. I must have forgot to mention that.scott wrote: i dont belive that when jonas tested it he didnt disconect from each other due to problems, but keep in mind this was over a network so the 'ping' (time to transmit data to a computer and get it returned) would be very low with very high bandwidth due to the nature of networks.
In my test I was unable to see any gun's projectile or flame.scott wrote:thats a good point... i dont know how RF calculates the projectiles, im thinking its collision detection, meaining a projectile has to have mass, to colide with something, or is it when the trigger is pressed teh thing it was aiming at is hit with no actual bullet?
if it is a projectile with its mass hitting an object, can each other see the projectiles. the easisest way to find this out i would belive is to get a flame thrower or a grenade launcher and see if both computers can see the flames/explosion
this is just a shot in the dark as i dont know exactly how RF uses the weapons, i would of thought it was a projectile hitting an object but then i have herd nothing of needing to make a projectile for a gun.
Code: Select all
void CWeapon::Add_Projectile(const geVec3d &Pos, const geVec3d &Front, const geVec3d &Orient,
char *Projectile, char *PAttribute, char *PAltAttribute)
{
Proj *d;
int Type = -1;
for(int i=0; i<MAX_PROJD; i++)
{
if(ProjD[i].active)
{
if(!stricmp(ProjD[i].Name, Projectile))
{
Type = i;
break;
}
}
}
if(Type == -1)
return;
if(ProjD[Type].active)
{
geXForm3d XForm;
d = new Proj;
d->Rotation = ProjD[Type].Rotation;
d->Angles = Orient;
d->Pos = Pos;
d->Gravity = ProjD[Type].Gravity;
d->LifeTime = ProjD[Type].LifeTime;
d->Bounce = ProjD[Type].Bounce;
d->BounceSoundDef = NULL;
if(!EffectC_IsStringNull(ProjD[Type].BounceSound))
d->BounceSoundDef = SPool_Sound(ProjD[Type].BounceSound);
d->MoveSoundDef = NULL;
if(!EffectC_IsStringNull(ProjD[Type].MoveSound))
d->MoveSoundDef = SPool_Sound(ProjD[Type].MoveSound);
d->ImpactSoundDef = NULL;
if(!EffectC_IsStringNull(ProjD[Type].ImpactSound))
d->ImpactSoundDef = SPool_Sound(ProjD[Type].ImpactSound);
d->MoveSoundEffect = PlaySound(d->MoveSoundDef, d->Pos, true);
d->Decal = ProjD[Type].Decal;
d->Explosion = ProjD[Type].Explosion;
d->ActorExplosion = ProjD[Type].ActorExplosion;
// changed RF064
d->ShowBoth = ProjD[Type].ShowBoth;
d->AttachActor = ProjD[Type].AttachActor;
d->BoneLevel = ProjD[Type].BoneLevel;
// end change RF064
d->ShakeAmt = ProjD[Type].ShakeAmt;
d->ShakeDecay = ProjD[Type].ShakeDecay;
d->Damage = ProjD[Type].Damage;
// changed RF063
d->AltDamage = ProjD[Type].AltDamage;
d->AltAttribute = PAltAttribute;
// end change RF063
d->RadiusDamage = ProjD[Type].RadiusDamage;
d->Radius = ProjD[Type].Radius;
d->Attribute = PAttribute;
d->Name = ProjD[Type].Name;
// changed QD 12/15/05
//geXForm3d_SetIdentity(&XForm);
//geXForm3d_RotateZ(&XForm, Orient.Z);
geXForm3d_SetZRotation(&XForm, Orient.Z);
geXForm3d_RotateX(&XForm, Orient.X);
geXForm3d_RotateY(&XForm, Orient.Y);
//geVec3d_Set(&XForm.Translation, Pos.X, Pos.Y, Pos.Z);
geXForm3d_GetIn(&XForm, &(d->Direction));
geVec3d_Scale(&(d->Direction), ProjD[Type].Speed, &(d->Direction));
//geXForm3d_SetIdentity(&XForm);
// geXForm3d_RotateX(&XForm, 0.0f);
// geXForm3d_RotateY(&XForm, (-90.0f) / 57.3f);
geXForm3d_SetYRotation(&XForm, -GE_PIOVER2);
// geXForm3d_RotateZ(&XForm, 0.0f);
// end change
geXForm3d_GetIn(&XForm, &(d->In));
geVec3d_Inverse(&(d->In));
d->Actor = CCD->ActorManager()->SpawnActor(ProjD[Type].Actorfile,
d->Pos, d->Rotation, ProjD[Type].ActorAnimation, ProjD[Type].ActorAnimation, NULL);
CCD->ActorManager()->Rotate(d->Actor, d->Angles);
CCD->ActorManager()->SetType(d->Actor, ENTITY_PROJECTILE);
CCD->ActorManager()->SetScale(d->Actor, ProjD[Type].Scale);
CCD->ActorManager()->SetBoxChange(d->Actor, false);
CCD->ActorManager()->SetNoCollide(d->Actor);
CCD->ActorManager()->SetBBox(d->Actor, ProjD[Type].BoxSize, ProjD[Type].BoxSize, ProjD[Type].BoxSize);
CCD->ActorManager()->GetBoundingBox(d->Actor, &d->ExtBox);
CCD->ActorManager()->SetStepHeight(d->Actor, -1.0f);
// changed RF064
CCD->ActorManager()->SetHideRadar(d->Actor, true);
// end change RF064
if(d->Gravity)
CCD->ActorManager()->SetGravity(d->Actor, CCD->Player()->GetGravity());
GE_Collision Collision;
CCD->Collision()->IgnoreContents(false);
CCD->Collision()->CheckLevel(RGF_COLLISIONLEVEL_1);
char BoneHit[64];
BoneHit[0] = '\0';
if(CCD->Collision()->CheckForBoneCollision(&d->ExtBox.Min, &d->ExtBox.Max,
Front, d->Pos, &Collision, d->Actor, BoneHit, d->BoneLevel))
{
int nHitType = CCD->Collision()->ProcessCollision(Collision, d->Actor, false);
if(nHitType != kNoCollision)
{
if(d->MoveSoundEffect != -1)
CCD->EffectManager()->Item_Delete(EFF_SND, d->MoveSoundEffect);
PlaySound(d->ImpactSoundDef, d->Pos, false);
// inflict damage
// changed RF063
if(Collision.Actor)
CCD->Damage()->DamageActor(Collision.Actor, d->Damage, d->Attribute, d->AltDamage, d->AltAttribute, d->Name);
if(Collision.Model)
CCD->Damage()->DamageModel(Collision.Model, d->Damage, d->Attribute, d->AltDamage, d->AltAttribute);
// end change RF063
// create explosion here
// changed RF063
CCD->Explosions()->AddExplosion(d->Explosion, d->Pos);
if(d->ShakeAmt>0.0f)
CCD->CameraManager()->SetShake(d->ShakeAmt, d->ShakeDecay, d->Pos);
if(Collision.Actor)
// changed RF063
CCD->Explosions()->AddExplosion(d->ActorExplosion, d->Pos);
// Handle explosion damage here
if(d->RadiusDamage > 0.0f)
{
// changed RF063
CCD->Damage()->DamageActorInRange(d->Pos, d->Radius, d->RadiusDamage, d->Attribute, d->RadiusDamage, d->AltAttribute, "Explosion");
CCD->Damage()->DamageModelInRange(d->Pos, d->Radius, d->RadiusDamage, d->Attribute, d->RadiusDamage, d->AltAttribute);
// end change RF063
}
CCD->ActorManager()->RemoveActor(d->Actor);
geActor_Destroy(&d->Actor);
delete d;
return;
}
}
for(int i=0; i<5; i++)
{
d->Effect[i] = -1;
geXForm3d thePosition;
if(EffectC_IsStringNull(ProjD[Type].EffectBone[i]))
geActor_GetBoneTransform(d->Actor, RootBoneName(d->Actor), &(thePosition));
else
{
if(!geActor_GetBoneTransform(d->Actor, ProjD[Type].EffectBone[i], &(thePosition)))
geActor_GetBoneTransform(d->Actor, RootBoneName(d->Actor), &(thePosition));
}
if(ProjD[Type].Effect[i][0] != '\0')
{
for(int k=0; k<MAXEXPITEM; k++)
{
if(CCD->Effect()->EffectActive(k))
{
if(!stricmp(ProjD[Type].Effect[i], CCD->Effect()->EffectName(k)))
{
geVec3d Zero = {0.0f, 0.0f, 0.0f};
d->Effect[i] = CCD->Effect()->AddEffect(k, thePosition.Translation, Zero);
d->EffectType[i] = CCD->Effect()->EffectType(k);
d->EffectBone[i] = ProjD[Type].EffectBone[i];
break;
}
}
}
}
}
d->next = NULL;
d->prev = Bottom;
if(Bottom != NULL)
Bottom->next = d;
Bottom = d;
return;
}
}
Code: Select all
BuildPlayer
//
// put player info into buffer
/* ------------------------------------------------------------------------------------ */
void NetPlayerMgr::BuildPlayer(NetBuffer *Buff, int index, int Id)
{
Buff->Add(Id);
Buff->AddString(Player[index]->ActorName, strlen(Player[index]->ActorName));
Buff->Add(Player[index]->BaseRotation);
Buff->Add(Player[index]->localRotation);
Buff->Add(Player[index]->localTranslation);
Buff->AddString(Player[index]->Animation, strlen(Player[index]->Animation));
Buff->Add(Player[index]->AnimTime);
Buff->AddLen();
Code: Select all
SendWorldInfo
//
// send info about current world to socket
/* ------------------------------------------------------------------------------------ */
void NetPlayerMgr::SendWorldInfo(NetBuffer *Buff, NLsocket sock)
{
int j = 0;
// send info about clients
Buff->PosBack(0);
Buff->Add(1);
Buff->Add((unsigned char)CLIENTLIST);
for(int i=0; i<MAXPLAYERS; i++)
{
if(Player[i])
{
BuildPlayer(Buff, i, Player[i]->GetId());
j++;
}
}
Buff->Add(-1);
Buff->AddLen();
nlWrite(sock, Buff->Data, Buff->Size);
// send info about rest of world here
outbuffer->PosBack(0);
outbuffer->Add(1);
outbuffer->Add((unsigned char)WORLDLIST1);
CCD->Doors()->SaveTo(NULL, true);
CCD->Platforms()->SaveTo(NULL, true);
CCD->Props()->SaveTo(NULL, true);
CCD->Teleporters()->SaveTo(NULL, true);
CCD->Triggers()->SaveTo(NULL, true);
CCD->Logic()->SaveTo(NULL, true);
outbuffer->AddLen();
nlWrite(sock, outbuffer->Data, outbuffer->Size);
outbuffer->PosBack(0);
outbuffer->Add(1);
outbuffer->Add((unsigned char)WORLDLIST2);
CCD->Attributes()->SaveTo(NULL, true);
CCD->Damage()->SaveTo(NULL, true);
CCD->ElectricEffects()->SaveTo(NULL, true);
CCD->ModelManager()->SaveTo(NULL, true);
outbuffer->AddLen();
nlWrite(sock, outbuffer->Data, outbuffer->Size);
// total # of packets sent is defined by CONNECTIONPACKETS
// currently is 4
// send done connecting command
Buff->PosBack(0);
Buff->Add(1);
Buff->Add((unsigned char)DONECONNECT);
Buff->AddLen();
nlWrite(sock, Buff->Data, Buff->Size);
}