Game Development Community

Inheritance issues, and a general problem

by Patrick Jeeves · in Torque Game Engine · 10/02/2008 (10:12 am) · 5 replies

Hello,
i'm having trouble figuring out if an object should be a child of SimObject or GameBase; it isn't rendered but it does manipulate objects that are rendered. My basic problem is that i don't know wether or not it should be networked, so what this comes down to is what the point of networking is. I know that it is used to send datablocks to the client instead of whole objects, thus saving time and bandwidth; but does the client need to know anything about objects that won't be rendered?

-----

also while the comments in the code tell me what functions in the various base classes can be overloaded, it won't tell me which ones have to be overloaded for the thing to work, and which can be left alone. And for that matter it doesn't tell me which ones were part of the base class's base class and either need to be overloaded, or have already been overloaded and so don't need to be. Is there anything that will tell me what things i need to overload? (like the basicObject resource does for SimObject)

-----

Finally i wanted to make it so that when an object moves from not being rendered to its lowest LOD it is invisible, and the closer you get to it the more visible it is, becoming completely visible when it gets to the next LOD. After some poking around i found some LOD stuff in tsShape.cc; in the form of 5 variables. Which are used for calculating transparency in tsShapeInstance.cc's render(), but when i changed two of them (smAlphaInDefault, and smAlphaOutDefault) there was no noticeable difference in the game. Though when i tried to exit the mission torque crashed. So why did that happen? and where should i have started with this?

#1
10/02/2008 (12:07 pm)
Whats the real-world example of what your trying to accomplish? That would help in deciding what an appropriate parent class is.
#2
10/02/2008 (2:51 pm)
Basically i want to make a magic system where if a fire and ice spell are both cast a water spell is created; without the water being specifically programmed in. So the object i'm making now is supposed to have the data for one of the spells, and it this 'spell' object should have a function where two spells will be combined; the result being a castSpell object being created where the spells were aimed. The new castSpell object should, ideally be sent over the network.

See the problem is that the castSpell would have to execute the scripts for the status effects and such of the spells it was made of. Thus i need to send the script names through so they can be used in eval commands, but i don't like this solution because it seems that the largest char array allowed in packed data seems to be 256 chars long. Ergo this would break down if a chain of spells got big enough. And since the castSpell wouldn't need to be rendered itself, (but would however have to test for collisions to see what gets affected) i wondered if i would need to network it at all.
#3
10/02/2008 (3:35 pm)
I would create a new class from SimObject called "SpellEffectManager" or some such. Then collisions between spells and other objects (players, statics, other spells) could be passed of to the manager to resolve their effects using whatever game mechanics you see fit. You could try with it being a server-side only object at first, but you may end up having it networked so the client can do "predictions" or "guesses" on what the effect of spell collisions is going to be before receiving an update from the server. This should help reduce lag.
#4
10/02/2008 (4:45 pm)
You don't really need even a SimObject for your spells. Possibly just a C++ class. You can then separate your spell-rendering-object from the one that actually does damage, gets combined, or whatever.
#5
10/03/2008 (8:32 am)
Okay thanks.