Game Development Community

Visible and invisible objects

by Guanjn · in Torque Game Engine · 09/01/2008 (2:20 am) · 8 replies

I am new here, and I have a problem when developing our game.

The situation is as follow:
There're two diffenent teams in our game, if one team place an object in the map , how could this object be seen by only by the members this team , but the members of another team can't?

Can we implement these function?And how can we do that?

About the author


#1
09/01/2008 (11:41 am)
You need an svn repository, a single version of the project that can be shared by all developers. Its still a little tricky with mission files because a lot of times you have to merge changes from different developers by hand.

There was a resource or .plan posting not long ago about implementing networking to the world editor, so multiple clients can connect and make changes at the same time.
#2
09/01/2008 (6:37 pm)
I am sorry my expression is not clear enough, the teams I mentioned is not the concept in development, but in the game itself.
I should say that there're two game characters, when one put an object in the map, the object can only be seen by himself,while the other character can not see it.
I want to implement this.
#3
09/01/2008 (8:15 pm)
So, you want the object placed by one player to also exist for all other players? Or you want them to just exist for the player that placed it?

But basically, you control this by either creating the object on the server or the client. If the "placed" object is created on the client, it will only exist for that client. If the placed object is created on the server, then it will be ghosted to all clients automatically and therefore exist for them all (assuming it is a ghostable or ghostalways object).
#4
09/02/2008 (1:44 am)
I want the object to be seen by his "owner", the others can not see the object but can collision with the object.

i try to creat an object on one client, but other clients aslo see it,i don't konw how to do.
#5
09/02/2008 (1:52 am)
@Guanjn - It seems like you need to add some special functionality on the C++ side.

If you want them to only be invisible... but still have collision... then you need to add testing in the object's prepRenderImage() to skip rendering if the player is not of the right type.

If you want them to not exist on the opposite team's clients at all... then you need to add some new functionality to NetObject and/or GameConnection which allows you to set ghost-ability on a per-client basis.
#6
09/02/2008 (7:42 pm)
@Tom Spilman- Thx for your reply, I need them to be invisble but still have collision.

Can I just add scripts to solve this problem?

I don't quite understand the mechanism Torque used, so I can not find where the c++ file lies.
#7
09/02/2008 (7:57 pm)
@Guanjn - I don't think you can do this from script alone.

If your not familiar with C++ or coding in C++ then you'll need to learn a little bit to make the change you want. You should start with the [url=http://www.garagegames.com/docs/tgea/official/index.html?content/documentation/Getting Started/Getting Started.html]Getting Started docs[/url].

Once you got TGEA compiling and running then do a "Find in Files" in VisualStudio for "::prepRenderImage(" (without quotes). You'll get several results... you need to pick the right one for the object your trying to make not render. Once you find it just place a "return;" statement at the top... that object will *always* not render.

I suggest you try to get this far first.

The next trick will be deciding when to render and not render your object based on whatever rules you want.
#8
09/02/2008 (8:56 pm)
@Tom Spilman - Thank you for leading me, I learn c++ before, and I think if I can find that file, I can solve this problem step by step, I will try hard to do that.

I will start will installing VS first-.-
This PC has no that kind of IDE, I'm so upset...