Option 1, have a massive switch or if/else chain in my System:
For example, if I have an AI component with several different behaviours, I could use an integer to define which type of AI to use for that particular entity. It seems a bit convoluted and inelegant.
Option 2, have a separate Component and matching System for each behaviour:
This would be neater in each individual System but as a whole, the program would be a mess. This wouldn't work because of the large amounts of variation such as hundreds of different guns in a shooter game.
Option 3, use a flyweight-like data structure independent of the Component:
This would mean storing all of the different behaviours elsewhere, and storing a key that a System can use to access the behaviour. This is basically a fancy version of the switch option above, but it seems neater as there wouldn't be a massive dump of code in the System.
Option 4, creating a complex way of encoding a description of the desired behaviour which the System can interpret:
This seems to be the most overkill of the lot. Unless I have to, or there are significant advantages, I'm trying to stay away from this.
Have a massive
switchorif/elsechain in my System:For example, if I have an AI component with several different behaviours, I could use an integer to define which type of AI to use for that particular entity. It seems a bit convoluted and inelegant.
Have a separate Component and matching System for each behaviour:
This would be neater in each individual System but as a whole, the program would be a mess. This wouldn't work because of the large amounts of variation such as hundreds of different guns in a shooter game.
Use a flyweight-like data structure independent of the Component:
This would mean storing all of the different behaviours elsewhere, and storing a key that a System can use to access the behaviour. This is basically a fancy version of the
switchoption above, but it seems neater as there wouldn't be a massive dump of code in the System.Creating a complex way of encoding a description of the desired behaviour which the System can interpret:
This seems to be the most overkill of the lot. Unless I have to, or there are significant advantages, I'm trying to stay away from this.