Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Communication between far-away objects

Hawk Horton
Registered User
Join date: 7 Sep 2005
Posts: 26
06-09-2006 08:16
I ran into a little communicative hurdle while building a game.

I have 2 objects, one in sim A, the other in sim B. I want both these objects to know each other's location. I can get their locations with a simple combination of llGetRegionName() and llGetPos(). What I can't get is object 1 to know the location of object 2 and vice versa. A simple listener won't work as that has a maximum range of 100 meters. The objects should actually be a lot further apart, maybe a kilometre or more.

Does anyone know another way of having two objects communicate with each other? If you know a completely different way of storing and transporting variables, that would be okay as well.
Sator Canetti
Frustrated Catgirl
Join date: 20 Sep 2005
Posts: 130
06-09-2006 08:26
In the past, the only option was, pretty much, email between the 2. Now you could possibly also use llHTTPRequest, and a script hosted somewhere, in your favorite web scripting language (php, perl, etc) and it pass info around.
_____________________
"Have gone to commit suicide. Intend to return from grave Friday. Feed cat." -- A memo by Spider Jerusalem in Transmetropolitan

"Some people are like Slinkies; not really good for anything, but they still bring a smile to your face when you push them down a flight of stairs."

If you're reading this signature, I've probably just disagreed with you. Welcome to the club :D
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
06-09-2006 14:16
The most common method for communication between distant objects, especially in different sims, is through the use of llEmail.
Kalel Venkman
Citizen
Join date: 10 Mar 2006
Posts: 587
Combining two bits of information..
06-09-2006 14:23
From: Talarus Luan
The most common method for communication between distant objects, especially in different sims, is through the use of llEmail.


The catch, of course, is that an object gets a new resource ID each time you rez it, so both the sender and receiver have unpredictable, volatile email addresses. Have each one report its current resource ID to an external server via llHTTPRequest(), and get the other's ID from the same place. In effect, you're "publishing" the resource Id.

Once your objects have that, they can email messages to each other and not worry about whether one of them's gotten re-rezzed or not - the ID's will always be correct.
Adriana Caligari
Registered User
Join date: 21 Apr 2005
Posts: 458
06-09-2006 14:39
From: Kalel Venkman
The catch, of course, is that an object gets a new resource ID each time you rez it, so both the sender and receiver have unpredictable, volatile email addresses. Have each one report its current resource ID to an external server via llHTTPRequest(), and get the other's ID from the same place. In effect, you're "publishing" the resource Id.

Once your objects have that, they can email messages to each other and not worry about whether one of them's gotten re-rezzed or not - the ID's will always be correct.


Thats seems like an awful waste of resource to me.

Send an http request to the server
Receive Email address
Send email asking for position
Receive email with position

When the server you initially sent the http request to already knows the position of the other object ( the region name and object position are stored in teh outgoing http header ) as it got it when it sent out a http request itself.

Use the initial suggestion of just sending a request to an eternal server from both objects and reporting the others position back to its partner.

Or us an in-world server and send that emails from each object - and reply to each email with the others address ( region and position are stored in the email header )

( yes the server suffers the same re-rez problem but if you keep it on your land it will only be re-rezzed when you want it to be or when a sim goes down - then you would probably have to reset the game anyway so feeding in a new server email address shoudnt be a problem )
Kalel Venkman
Citizen
Join date: 10 Mar 2006
Posts: 587
06-09-2006 14:49
From: Adriana Caligari
Thats seems like an awful waste of resource to me.

Send an http request to the server
Receive Email address
Send email asking for position
Receive email with position

When the server you initially sent the http request to already knows the position of the other object ( the region name and object position are stored in teh outgoing http header ) as it got it when it sent out a http request itself.

Use the initial suggestion of just sending a request to an eternal server from both objects and reporting the others position back to its partner.

Or us an in-world server and send that emails from each object - and reply to each email with the others address ( region and position are stored in the email header )

( yes the server suffers the same re-rez problem but if you keep it on your land it will only be re-rezzed when you want it to be or when a sim goes down - then you would probably have to reset the game anyway so feeding in a new server email address shoudnt be a problem )



I believe I just said that.
Kokiri Saarinen
Quoted for truth
Join date: 7 Jan 2006
Posts: 44
06-09-2006 20:04
If you create an object that is stationary and will not de-rezz, you can make rezzable game peices that communicate thier key's and positions to the server object, which in turn communicates them to the other sim's game peices. In other words, you can get around the de-rezzing problem by having the objects update a server's key database on rez.

-Kokiri
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
06-09-2006 20:37
From: someone
If you create an object that is stationary and will not de-rezz, you can make rezzable game peices that communicate thier key's and positions to the server object, which in turn communicates them to the other sim's game peices. In other words, you can get around the de-rezzing problem by having the objects update a server's key database on rez.

-Kokiri


unless the sim crashes in the middle of a game, then your having to manually clean up all the peices, which would suck if your not around, plus this is SLOW + not really viable if you have abunch of clients ect ect ect, html seems to be the least PITA and most reliable for keeping track of things

and since were going to do all this, most of the info you need can be passed in one swipe tru the url or body, and your server can simply email the other client(s) automaticly (since i dont think you can just up and send html to something that didnt request it)
Lazink Maeterlinck
Registered User
Join date: 8 Nov 2005
Posts: 332
06-09-2006 20:52
I've never had a problem with our objects that really on email, even when the sim crashes, it doesn't get a new key from what I've experienced, only when you de-rez/rez the object have I seen it get a new key.
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
06-09-2006 21:14
well thats becuase your using an external server i was refering to the post about client / server objects inworld

ive never used the email function, 20 seconds for what i would want to use it for (not spam) is pointless, and my budget server wont let me set things up properly

html drasticly reduces wait time, and doesnt require one to have mutiple scripts running to bypass the timeout

html for input, email for broadcast / echo relay output seems like the best choice now IMO
Lazink Maeterlinck
Registered User
Join date: 8 Nov 2005
Posts: 332
06-09-2006 22:28
no, I'm talking pure inworld things. The key of an object does not change, to my knowledge (as I've had the sim crash several times as we all have i'm sure) and those items still work perfectly.
Hawk Horton
Registered User
Join date: 7 Sep 2005
Posts: 26
06-10-2006 02:23
Thanks for all the helpful advice.
I'll go play around with it a bit to see what works best for me.
I'll keep you posted on my progress.