Game Development Community

Another Realtime Networking thread?

by Ricky Taylor · in Torque Game Builder · 09/06/2007 (12:37 pm) · 6 replies

Howdy. I couldn't think of a better title, because put simply that's what this thread is about.

I have some kind of coded Realtime Networking in TGB. Nice and shiny, connects fine, rewrote some bits of the ghosting, etc, etc.

This is what's bugging me:
t2dVector pos = getPosition();
	t2dVector vec = getLinearVelocity();
	F32 rot = getRotation();
	F32 rotVel = getAngularVelocity();

	if(stream->writeFlag( (oldVec.isLenNotZero() && vec.isLenZero())
		|| vec.isLenNotZero() || pos != oldPos || mMap != oldMap || rot != oldRot))
	{
		stream->write(pos.mX);
		stream->write(pos.mY);
		stream->write(vec.mX);
		stream->write(vec.mY);
		stream->write(rot);
		stream->write(rotVel);
		stream->write(mMap);
	}

This is in packUpdate... but... when I unpack the data, and set it, (setRotation, setAngularVelocity, etc, etc), the movement of my object becomes VERY jumpy! Any of you TGE and TGB gurus out there care to help? =]

I believe it is something to do with the physics updating, but the new t2dPhysics object... just seems odd and confusing. =[

Thank you.

-- Ricky Taylor

#1
09/07/2007 (3:28 am)
Without interpolation it will always become choppy if you realtime update position and not only velocity ...
#2
09/07/2007 (4:05 am)
Any chances some of your work might turn into a resource ?

Aun.
#3
09/07/2007 (6:24 am)
You could give the illusion, by not showing the actual networked sceneobject and mounting another sprite to it with a force, it'll do the interpolation trick.
#4
09/07/2007 (10:35 am)
@ Ricky : Can you share how you got the scene graph to work properly on both the server and client ?

*edit : Rick -> Ricky :)
Aun.
#5
09/09/2007 (10:06 am)
Haha, I collected some interest I see... I was setting all the velocities and hoping that they would work as an interpolation. Okay then, I shall have a look for some thought on interpolation.

My code is not copied from TGE so its all good with just a TGB Pro licence... but it was made for an MMO game, so its missing some parts. I shall work on realtime networking a bit, see if I can't get a nice drop-in for folks.

Also, its "Ricky". Its only five letters. Thankyou.

-- Ricky Taylor
#6
09/19/2007 (9:40 pm)
I wish you the best and if you need any help feel free to drop me an e-mail and I'll try to respond as best I can with time I have... I'd love to help much more but time is limited for me. It's been a good 2 years since I've looked deep into the networking code, though before I came to work at GG I did the port for the "turn based" networking code from TGE to TGB as a contract (as well as digging into the guts of T2D to re-initialize aspects).