community attempt at multiplayer

Programming Reality Factory and Genesis3D.
User avatar
jonas
Posts: 779
Joined: Tue Jul 05, 2005 5:43 pm
Location: Texas, USA
Contact:

Post by jonas »

Jay wrote:i've just looked at the definition of the NetPlayer:

Code: Select all

class NetPlayer
{
public:
	NetPlayer();
	~NetPlayer();
	void Create(char *actorname);
	int GetId()											{ return Id;						}
	void SetId(int id)									{ Id = id;							}
	void SetBaseRotation(const geVec3d &Rotation)		{ BaseRotation = Rotation;			}
	void SetlocalRotation(const geVec3d &Rotation)		{ localRotation = Rotation;			}
	void SetlocalTranslation(const geVec3d &Translation){ localTranslation = Translation;	}

 public:
	geActor *Actor;
	char ActorName[128];
	char Animation[128];
// changed QD 02/01/07
	char PlayerName[64];
	float Scale;
// end change
	float AnimTime;
	int Id;
	geVec3d localTranslation;
	geVec3d localRotation;	
	geVec3d oldTranslation;
	geVec3d oldRotation;	
	geVec3d BaseRotation;

private:

};
I think Id refers to 'IdentificationNumber' of the Player. Has nothing to do with the weapons. I would say you have to add a new geActor* variable for the weapon and then use it like the pawn weapons are used...
Exactly, but if you take a peek at DisplayThirdPerson(); it calls for int index

CWeapon.cpp

Code: Select all

void CWeapon::DisplayThirdPerson(int index)
{
       geXForm3d Xform;
       geVec3d the Rotation;
       geVec3d the Position;
       geMotion *ActorMotion;
       geMotion *ActorBMotion;

       geActor *Actor = CCD->Player()->GetActor();
       CCD->ActorManager()->GetRotate(Actor, &theRotation);
       CCD->ActorManager()->GetPosition(Actor, &thePosition);
       geActor_SetScale(WeaponD[index].PActor, WeaponD[index].PScale, WeaponD[index].PScale, WeaponD[index].PScale);
In CNetwork.cpp when sending player information back and forth it uses each ones index number(id).
Jay wrote: you might have a look at the CPawn.cpp for the weapon rendering.
that may be a start. Just a question: are the projectiles shown in the other player's views?
CWeapon.cpp

Code: Select all

Void CWeapon::Rendering(bool flag)
Tried it :(
No projectiles aren't even shown in the other players view. All they see of you is your arm moving up and down when firing.
Looks like i'll probably be adding a function or 2 to Cweapon.cpp *sigh* or hacking them a lot.
Jonas

Focused, hard work is the real key to success. Keep your eyes on the goal, and just keep taking the next step towards completing it. If you aren't sure which way to do something, do it both ways and see which works better. - John Carmack
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Post by Jay »

ok. index (in CWeapon.cpp) seems to be the index of preloaded weapons. So maybe you just add an int variable for the weapon in the NetPlayer class and send it to the server and from then then to the players, so that you can update the weapons.
Everyone can see the difficult, but only the wise can see the simple.
-----
User avatar
zany_001
Posts: 1047
Joined: Fri Mar 02, 2007 8:36 am
Location: Aotearoa

Post by zany_001 »

you seem to be doing some good work there,keep it up! :D so does this mean that multiplayer will be here before the end of next year :?: also,how does rf spawn the projectiles?like,does it spawn them like for pawns,or is it entirely different?
Once I was sad, and I stopped being sad and was awesome instead.
True story.
User avatar
jonas
Posts: 779
Joined: Tue Jul 05, 2005 5:43 pm
Location: Texas, USA
Contact:

Post by jonas »

I'm sorry to say this guys but I don't think I can finish this. The more I look through the code the more confused I'm getting. I found parts and pieces of the game initiation in the strangest of places... its mind boggling. In all honesty for this type of endeavor I should probably wait until my programming skills are at a higher level. I will leave Programming Rf for someone with a lot of experience, and/or more patience. Not for a total doofus(like me). So to put my conscience at ease for something I can't do but promised to do, I must pass it on to someone else. :? I think I'm going to just start focusing on making games, that's something I can do.
Jonas

Focused, hard work is the real key to success. Keep your eyes on the goal, and just keep taking the next step towards completing it. If you aren't sure which way to do something, do it both ways and see which works better. - John Carmack
Voltare
Posts: 263
Joined: Tue Jul 05, 2005 10:36 am

Post by Voltare »

What happened is this : so many people made code contributions to RF, some commented, most not that it got out of hand quickly, to the point of where it's not even worth attempting it.You'll never figure out where things are suppossed to go, or what this crazy little bit of code here does.

So, RF1+ Multiplayer will never happen.Period.

But, what can happen is this: as we write rf2, make sure that we include good commented code,
i.e.:

(code stuff here) // this does this to this part , handles etc. , acts on etc. , does this to etc., works with etc.

Make this a hallmark of RF2!!!! So that those who come after us aren't completely flummoxed by what we did.Yeah, it makes it a little more difficult to write out....but it's just a few more words........

Who cares if you know what that code you wrote did? The next guy who looks at it ain't gonna have a clue.

I've been having similar arguements with coders for years now....they really don't want to comment their code..( Take a look at Quake source, for instance....yuck!!!!!!!)


I am learning programming in XNA right now, and I am commenting every single line of code I write...why? cause when I come back to it later, I want to know what that line does, where it points to, what other lines of code it acts with, upon, affects, what models, textures etc. it may call up.Yeah, its annoying as heck to write all that extra stuff....but it makes it easier for me to understand what's going on inside the program as well.
User avatar
jonas
Posts: 779
Joined: Tue Jul 05, 2005 5:43 pm
Location: Texas, USA
Contact:

Post by jonas »

Exactly. Writing a comment with your code is well worth it later on. Even if it takes extra time, do it. It will even make your own job easier when coming back to add something in.
Jonas

Focused, hard work is the real key to success. Keep your eyes on the goal, and just keep taking the next step towards completing it. If you aren't sure which way to do something, do it both ways and see which works better. - John Carmack
User avatar
Spyrewolf
Posts: 450
Joined: Tue Jul 05, 2005 4:53 am
Location: Wellington::New Zealand

Post by Spyrewolf »

I am commenting every single line of code I write
Really?!? thats pretty overkill, I found that a comment per function/variable/object, seem sufficient even then i though i was over doing it,

however i guess its what you feel comfortable with, commenting your code is definetly a big plus especially when others will be reading or modify your code at some point or another, or if you will be.
Voltare
Posts: 263
Joined: Tue Jul 05, 2005 10:36 am

Post by Voltare »

yup....it may seem like overkill, but it will make it easier for future programmers to understand what i did, and why i did it that way.
User avatar
zany_001
Posts: 1047
Joined: Fri Mar 02, 2007 8:36 am
Location: Aotearoa

Post by zany_001 »

Link

found this at GameDev.net, thought it might be useful for getting multiplayer to work. Ill do it myself once ive got the experience if noone else will.
Once I was sad, and I stopped being sad and was awesome instead.
True story.
Voltare
Posts: 263
Joined: Tue Jul 05, 2005 10:36 am

Re: community attempt at multiplayer

Post by Voltare »

I'm considering another idea entirely.(sorry for dragging back up an ancient post, heh).


There's something out there called MaNgoS , a complete mysql server/clent solution.I'm thinking of scrapping all rf mp stuff, and seeing if its possible to use this.

edit: right now, it's mainly used to emulate a world of warcraft server...but i want to see if it can work here.
Post Reply