Okay, I'm asking this here as this forum undoubtedly gets viewed more, and also because it's not really a Blitzmax programming question (although it is Blitzmax related.)
I've mentioned it in a few other threads, but I'm coding a custom behavior system, and am really curious if others would be interested in using it once it's complete. If there is a lot of interest I will put even more effort into polishing it and optimizing it, whereas if there isn't all I need to do is get it to the point where it's working for my project :P.
Now, onto the purpose and design of the system. The system itself is a modular behavior system wherein a behavior is coded once, and then instances of that behavior are attached to BehaviorObjects. Generally, behaviors are coded as "finite state machines" that operate relatively autonomously on their owner, although they can be coded to do just about anything, really.
The real flexibility of the system is that behaviors can add or remove variables to itself or to it's owner, it can access any variable of it's owner (it doesn't even need to know it's name prior to runtime). The same is true for functions - functions can be added or swapped on the fly. Behaviors can also look for the existance of other behaviors owned by the same parent object, and modify their behavior based on the existance or lack of of one (or more) other behaviors. For instance, you could make a "drunken" behavior that modifies the strength and intelligence of it's parent object, and also checks to see if that parent object has a "chat" behavior, and if so it replaces the chat function with it's own version which modifies text and adds slurring to words and other little distortions to the speech. It could even be coded to check and see what race it's parent object is, and then provide different word slurring functions based on race (or gender, or whatever you want.)
Of course, some behaviors would be very game specific and may not be all that useful to others, but the real beauty of the system is that a lot of general purpose modules can be made and will truly be "plug'n'play." I've mentioned this in another thread, but one good example is a "Sin Modulation" behavior that takes some variables and modifies them according the a sin wave, whose parameters you can adjust either in code or during runtime. So this behavior can be attached to any BehaviorObject and modify any and/or all variables of that BehaviorObject. Also, each instance of the sin behavior would have it's own frequency and amplitude variables that could be adjusted.
As a trite example, you might attach the behavior to an enemy ship and have it linked to that ships X variable, so as it flys down the screen, it moves left to right in a sin pattern. You then create another instance of the sin behavior and attach it to the stars in the background, and have it modify their alpha value. So now the stars will fade in and out against the background. Now, you want to create another little effect and have a graphic on the HUD grow and shrink a bit over time, so you create another instance of the sin behavior, set it's frequency and amplitude values, and attach it to the X and Y scale of the HUD graphic, and now this graphic's size will fluctuate over time.
The key idea behind the behaviors is that they are highly interchangeable and are truly plug'n'play, where you could literally copy and paste someone elses code into your own game, and simply instantiating an instance of the behavior and attaching it to one of your behaviorObjects and it would work. At most, all you'd have to do is change the input variables fed to the behavior and the output variables that the behavior is modulating in some way. And, due to the system, these variables can be adjusted at runtime and can even be added at runtime.
So, that's the basic idea. Yes, the flexibility of the system (allowing dynamically typed variables to be created/added to objects, and allowing functions to be swapped, removed, or added during runtime) does have a small performance and memory hit, but it won't be enough to impact a casual game unless you had hundred and hundreds of behaviors attached to hundreds of onscreen BehaviorObjects.
Anyways, my kind of utopian ideal here is to get some interest in this and then have people openly sharing behaviors so that we can all benefit from each others work.
I've mentioned it in a few other threads, but I'm coding a custom behavior system, and am really curious if others would be interested in using it once it's complete. If there is a lot of interest I will put even more effort into polishing it and optimizing it, whereas if there isn't all I need to do is get it to the point where it's working for my project :P.
Now, onto the purpose and design of the system. The system itself is a modular behavior system wherein a behavior is coded once, and then instances of that behavior are attached to BehaviorObjects. Generally, behaviors are coded as "finite state machines" that operate relatively autonomously on their owner, although they can be coded to do just about anything, really.
The real flexibility of the system is that behaviors can add or remove variables to itself or to it's owner, it can access any variable of it's owner (it doesn't even need to know it's name prior to runtime). The same is true for functions - functions can be added or swapped on the fly. Behaviors can also look for the existance of other behaviors owned by the same parent object, and modify their behavior based on the existance or lack of of one (or more) other behaviors. For instance, you could make a "drunken" behavior that modifies the strength and intelligence of it's parent object, and also checks to see if that parent object has a "chat" behavior, and if so it replaces the chat function with it's own version which modifies text and adds slurring to words and other little distortions to the speech. It could even be coded to check and see what race it's parent object is, and then provide different word slurring functions based on race (or gender, or whatever you want.)
Of course, some behaviors would be very game specific and may not be all that useful to others, but the real beauty of the system is that a lot of general purpose modules can be made and will truly be "plug'n'play." I've mentioned this in another thread, but one good example is a "Sin Modulation" behavior that takes some variables and modifies them according the a sin wave, whose parameters you can adjust either in code or during runtime. So this behavior can be attached to any BehaviorObject and modify any and/or all variables of that BehaviorObject. Also, each instance of the sin behavior would have it's own frequency and amplitude variables that could be adjusted.
As a trite example, you might attach the behavior to an enemy ship and have it linked to that ships X variable, so as it flys down the screen, it moves left to right in a sin pattern. You then create another instance of the sin behavior and attach it to the stars in the background, and have it modify their alpha value. So now the stars will fade in and out against the background. Now, you want to create another little effect and have a graphic on the HUD grow and shrink a bit over time, so you create another instance of the sin behavior, set it's frequency and amplitude values, and attach it to the X and Y scale of the HUD graphic, and now this graphic's size will fluctuate over time.
The key idea behind the behaviors is that they are highly interchangeable and are truly plug'n'play, where you could literally copy and paste someone elses code into your own game, and simply instantiating an instance of the behavior and attaching it to one of your behaviorObjects and it would work. At most, all you'd have to do is change the input variables fed to the behavior and the output variables that the behavior is modulating in some way. And, due to the system, these variables can be adjusted at runtime and can even be added at runtime.
So, that's the basic idea. Yes, the flexibility of the system (allowing dynamically typed variables to be created/added to objects, and allowing functions to be swapped, removed, or added during runtime) does have a small performance and memory hit, but it won't be enough to impact a casual game unless you had hundred and hundreds of behaviors attached to hundreds of onscreen BehaviorObjects.
Anyways, my kind of utopian ideal here is to get some interest in this and then have people openly sharing behaviors so that we can all benefit from each others work.