Game Development Community

Large or small behaviors?

by jydog · in Torque Game Builder · 04/21/2008 (7:25 pm) · 2 replies

When making behaviors, is it best to put a lot of functionality in 1 or 2, or to break functions into a number of smaller behaviors?

It seams a number of smaller ones would be easier to produce, debug and reuse. But would a bunch impact performance over 1 large one?

Randy

#1
04/22/2008 (9:12 am)
I wouldn't worry too much about performance unless all those small behaviors are using the process-tick callback ( or whatever its called for behaviors ).

As far as I can tell, behaviors are intended to be small and plentiful. If you put your code in one monolithic behavior, then you might as well instead put your code in class-namespace methods and not use behaviors.
#2
04/27/2008 (11:22 am)
As already stated by James, the number of behaviors probably is not a huge concern, unless you were using absolutely massive amounts with a large number of entities. We are creating a title at the moment (a shooter) and entities have upwards of 30+ behaviors and this does not seem to negatively impact performance. Indeed, as James said, using onUpdate callback seems to be far worse.