Captive Imagination
September 06, 2010, 09:38:33 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: jSeamless 1.0 Beta 7 is Available http://www.jseamless.org
 
   Home   Help Search Calendar Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Late client join & synchronization  (Read 433 times)
0 Members and 1 Guest are viewing this topic.
Dentoid
Newbie
*
Offline Offline

Posts: 2


View Profile
« on: November 08, 2009, 04:53:11 PM »

Hey

I've set up a quick test with JGE in a little project I'm doing, and I think I've managed to wrap my head around how things are supposed to work. One thing, however, that I don't quite see how it's supposed to work is clients joining a server when it has already registered objects. (E.g. joining a running game.) I find no code to sync existing objects to new clients... Should I be doing this myself (just register the objects over again when I get a new client connection), or what is the idea about how to do it?

Thanks in advance
Logged
Tumaini
JGN Developer
Jr. Member
*****
Offline Offline

Posts: 51


View Profile
« Reply #1 on: November 09, 2009, 04:10:28 AM »

Hello and welcome to the forums!

Already registered objects get their sync create messages sent to new clients that connect to the server in this method in SynchronizationManager:
Code:
public void connected(JGNConnection connection) {
// Client connected to server - send creation messages to new connection
for (SyncWrapper wrapper : queue) {
connection.sendMessage(wrapper.getCreateMessage());
}
for (SyncWrapper wrapper : disabled) {
connection.sendMessage(wrapper.getCreateMessage());
}
for (SyncWrapper wrapper : passive) {
connection.sendMessage(wrapper.getCreateMessage());
}
}

So you shouldn't register the same object twice.
I'm currently revising the sync code, so expect to see a few additions in the near future.
I hope you find JGN to be a good help in your project!
Logged
Dentoid
Newbie
*
Offline Offline

Posts: 2


View Profile
« Reply #2 on: November 09, 2009, 06:40:20 PM »

Ah, thanks a lot! I'm actually not sure what I did wrong (think I missed some update thread), but it works now, so I'm happy. Seems nice so far. Smiley
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.147 seconds with 20 queries.