Saturday, January 28, 2012

On fuels

I've prototyped blocks and connections (inputs and outputs). Now I need a structure for fuels. My aim is to have fuels work hierarchically, so that using a more general type of fuel in an input that requires a more specific type of fuel is possible, but at a reduced effectiveness. This much is easy--it follows the basic polymorphic OOP model of any major programming language.

Here's a starting blueprint for a fuel:
  • A type
  • An ID (this may be used for bit masking for more dynamic fuel identification)
  • A concrete flag (whether this fuel is a physical substance or denotes a class of fuels)
  • A parent fuel type (implicit)
There will likely be major additions to this, but it's a start. Here's an example of a fuel tree:
  • Fuel
    • Organic
      • Blood
        • Animal blood
          • Human blood
          • Elephant blood
      • Sugar
        • Animal sugar
        • Plant sugar
    • Inorganic
      • Oil
        • Natural oil
          • Fossil oil
          • Corn oil
        • Synthetic oil
          • Robot oil
            • Robot A oil
            • Robot B oil
          • Car oil
      • Water
Every fuel type derives from the most general Fuel type. In order for this to make sense, we should allow for fuels to have restrictions on whether or not we can use fuels of a more general type in their place. We can do this by simply setting a flag on the fuel blueprint (or class).
  • Allow more general fuel type flag
What we do with this is when a block goes to make a connection, the input of the connection is checked for which type of fuel it accepts. If this fuel type doesn't match the type coming from the ouput, the fuel is checked for this flag and if the flag is "true," then we check if the output's fuel matches the fuel type of the current fuel's parent. And so on until we encounter a "false," or exhaust the fuel tree, or we find a match.

My goal is to allow new fuel types to be developed or defined without having to code them explicitly. This is pretty ambitious, as it would require developing a basic chemistry system to govern the interaction between connections--instead of just fuel types, you could compose a fuel of "elements," some of which could interact and some of which could not. For now, though, this is only a goal.

With these basic building blocks I am going to attempt to create a simple ecosystem which can sustain basic "life" systems on other organic and inorganic systems.

No comments:

Post a Comment