Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3509 Members - Latest Member: lioneltenel

27. May 2012, 01:40:11 am
Xith3D CommunityProjectsYour Projects (Moderator: 'n ddrylliog)Repeating Network Calls
Pages: [1]
Print
Author Topic: Repeating Network Calls  (Read 1822 times)
kukanani
Fierce Warrior
****
Offline Offline

Posts: 504


My game is coming along fairly smoothly...


View Profile WWW
« on: 14. October 2007, 09:18:52 pm »

Hi guys,

As most of you know, I'm making an MMORPG entitled Exodus Online.  The fact that my game is an MMO means that I need repeating network calls to get the other user's locations.  If I do this in the loopIteration() method, the program becomes far too slow.  So my plan is to make the network calls repeat as fast as possible but in a different thread.  The network call affects the scenegraph, BTW.  Is this "safe"?  Is there a built-in way to do something like this in Xith?  I know that there is talk about thread-safeness, but I never looked into it too deeply, thinking that it didn't concern me.  Guess I was wrong  Undecided .

So, any problems with that?  Does anyone have any other ideas?  I am open to anything.
Logged

xith.setCoolnessLevel(10);
jMe.setCoolnessLevel(0);
xith.rock();
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 14. October 2007, 10:16:14 pm »

Well, there is the UpdatingThread class, that is exactly for this. You can create it with your RenderLoop as a constructor parameter, to synch the game-time. Then invoke the begin() method with a "true" parameter, to let it run in a separate thread.

Then you could use a ScheduledOperation to apply the changes to the scenegraph, that you've computed in the other thread. But don't create a new ScheduledOperation instance each time, but use a non-persistent ScheduledOperation instance, that you reuse each time.

If UpdatingThread doesn't have enough features, you could also use OperationSchedulerImpl, which is an UpdatingThread extension.

Marvin
Logged
kukanani
Fierce Warrior
****
Offline Offline

Posts: 504


My game is coming along fairly smoothly...


View Profile WWW
« Reply #2 on: 15. October 2007, 03:16:43 pm »

Ok, thanks, I try it out today.
Logged

xith.setCoolnessLevel(10);
jMe.setCoolnessLevel(0);
xith.rock();
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic