Game Development Community

Attached lights and zones

by Yannis Sovolakis · in Technical Issues · 05/13/2007 (12:02 pm) · 7 replies

Hi there,

I am facing a problem with attached lights. (TGE 1.5.1)

I attach/detach (attchtoobject) a light on the players which works as a flashlight.
The lights work as expected.

The problem begins when the player enters a zone inside an interior.
At that time, it seems to lose sync over the network and when the player returns out of the interior, is sees the other players' lights turned off.

When 2 players enter the interior together, the lights work fine.

The same problem appears when bots carry the flashlights.
When the player comes out of the interior, the lights get detached from the bot and attached to another bot.

Any guess on how to overcome this issue?

Thanks in advance

Y.

#1
05/13/2007 (4:03 pm)
Just a follow up.

I think that the problem seems to be with scoping and ghost ids.

When setting %bot.setScopeAlways() the problem seems to dissapear.
Is there a workaround that does not require to scope every bot and player to every connection?

Thanks (again) in advance for any thoughts.

Y.
#2
05/20/2007 (10:22 am)
Any thoughts?
#3
05/20/2007 (3:53 pm)
Maybe you could use a trigger in front of the interior. when a player is in the trigger, call setScopeSlways().
#4
05/20/2007 (4:29 pm)
Thanks for the reply Sean.

I am not sure if your suggestion would solve the issue.

The problem is that the player coming inside the interior, looses the information about all the other players that are outside the zone.

If I call setScopeAlways for the player coming in the interior, when he comes out, all the others will have the correct view of this single player's light.
This player on the other hand, will see all the others' lights out of sync.

In my understanding (possibly wrong by no harm to note) the light when attached, keeps the ghost id of the object it is attached on. When that object comes out of scope for a specific player by entering a zone, then when exiting the zone, the ghost ids are changed, so the light that a player had, may be now attached on another object (a static shape in some cases).

Only when setting setScopeAlways for all the players or AIPlayers holding lights solves this issue.

I do not know the network performance penalty for this and would like to find a more elegant solution.

Anyway, I will try triggers as a probable solution in my research.

Thank you for your answer.

Y.
#5
05/20/2007 (6:21 pm)
Thanks for the reply Sean.

I am not sure if your suggestion would solve the issue.

The problem is that the player coming inside the interior, looses the information about all the other players that are outside the zone.

If I call setScopeAlways for the player coming in the interior, when he comes out, all the others will have the correct view of this single player's light.
This player on the other hand, will see all the others' lights out of sync.

In my understanding (possibly wrong by no harm to note) the light when attached, keeps the ghost id of the object it is attached on. When that object comes out of scope for a specific player by entering a zone, then when exiting the zone, the ghost ids are changed, so the light that a player had, may be now attached on another object (a static shape in some cases).

Only when setting setScopeAlways for all the players or AIPlayers holding lights solves this issue.

I do not know the network performance penalty for this and would like to find a more elegant solution.

Anyway, I will try triggers as a probable solution in my research.

Thank you for your answer.

Y.
#6
05/21/2007 (8:21 am)
Hi Yannis,

Attaching lights is better suited for objects like animated ScopeAlwaysShapes - attached lights sync with the object's animated mount points and the object if it moves. Scoped objects like players and cars work great in smaller outdoor environments where they do not fall out of scope.
#7
05/21/2007 (9:38 am)
Thank you John.

I understand your point.

If a light is to be attached on players or vehicles, I have to make sure that they are always scoped to everyone else.

I will try to examine the code that provides the ghost ids and see if I can change something over there.

Thank you.