Mount point inception, possible?
by Kyrah Abattoir · in Torque 3D Beginner · 09/30/2012 (11:36 pm) · 3 replies
So the other day I had a breakthrough on my "visual" inventory system. For each object in inventory, the client will scan the player for a list of "item" mount points and mount a visual representation of objects matching the mount point type.
Example:
So, in theory, with this system, any items in the player inventory will "try" to be displayed on the player model if a free matching mount point can be found (backpack, grenade bandoler, hip holster, etc etc...)
Can it be made indefinitely recursive?
Basically, have the display model of an item have mount points itself (and obviously it's own inventory but that's beside the point)
Sorry for the really ugly pseudocode, i haven't done torquescript, lua, or C++ in ages so it's all a big jumble at the moment, but i hope the idea is understandable.
TL:DR
Does torque supporte mount point recursion:
A mount point, on a mount point, on a mount point...
Example:
//pseudocode!
for(i=0;i<ply.inventory.count();i++)
{
for(j=0;j<ply.mountpoint.count();j++)
{
if( ply.mountpoint[j].free() == true && ply.mountpoint[j].type() == ply.inventory[i].type() )
{
ply.mountpoint[j].mount(ply.inventory[i].getviewmodel());
break;
}
}
}So, in theory, with this system, any items in the player inventory will "try" to be displayed on the player model if a free matching mount point can be found (backpack, grenade bandoler, hip holster, etc etc...)
Can it be made indefinitely recursive?
Basically, have the display model of an item have mount points itself (and obviously it's own inventory but that's beside the point)
//pseudocode!
function mount_visuals()
for(i=0;i<this.inventory.count();i++)
{
for(j=0;j<this.mountpoint.count();j++)
{
if( this.mountpoint[j].free() == true && this.mountpoint[j].type() == this.inventory[i].type() )
{
this.mountpoint[j].mount(this.inventory[i].getviewmodel());
//now that we have mounted this object, if it has an inventory, we do the same process with it.
//and so on, in theory until there is no more containers to loop through.
if(this.inventory[i].inventory != nil)
this.inventory[i].mount_visuals();
break;
}
}
}
//...
//somewhere
ply.mount_visuals();Sorry for the really ugly pseudocode, i haven't done torquescript, lua, or C++ in ages so it's all a big jumble at the moment, but i hope the idea is understandable.
TL:DR
Does torque supporte mount point recursion:
A mount point, on a mount point, on a mount point...
About the author
3D artist, programmer, game designer, jack of all trades, master of none.
#2
I don't know torquescript, but something like:
That should at least keep it from hanging if the code goes haywire.
The deepest I've seen in terms of mounting is 2. That was a helmet mounted to a character mounted to a vehicle. Sounds like what you're thinking of could work.
10/02/2012 (1:27 am)
One way to make recursive code safer is to avoid unlimited recursion.I don't know torquescript, but something like:
function mount_visuals(level)
if (level > 5){
echo(" debug: mount_visuals exceeded recursion limit.");
return;
}
... other code ...
item.mount_visuals(level + 1);That should at least keep it from hanging if the code goes haywire.
The deepest I've seen in terms of mounting is 2. That was a helmet mounted to a character mounted to a vehicle. Sounds like what you're thinking of could work.
#3
Oh, do we still have to use mesh hiding for everything that has to be skinned on the actor's bones?
10/02/2012 (1:29 am)
Would i want to mount shapebaseimages or something else?Oh, do we still have to use mesh hiding for everything that has to be skinned on the actor's bones?
Torque Owner Demolishun
DemolishunConsulting Rocks!
One thing that might help is a shapebase like object that is not networked. Then you can keep track of inventory only and have the visual representations being client side only. I have not delved into the object hierarchy for some time so I cannot comment on which objects might work better.
I also noticed that when you mount a shapebase object onto another shapebase that there is a slight and visual delay in updates of position. I created a stick figure skeleton and was planning on using shapebase objects on mountpoints to represent different armor types. As the animation sequence would oscillate for the idle anim I could see a slight delay in the shapebase objects tracking their mount points. I had to get really close up to the model to really notice this though. So it may cause some visual artifacts with this movement desynchronization.