Mason Mechanical System Implementation Notes

Abstract

Contains various notes covering most of the aspects of MMS implementation and usage in early versions of Mason.
Will later be used as a basis of an updated MMS design document?

Version History

Version Date Author Nick Changes
0.1 2002-02-10 Hans Häggström zzorn Initial version
0.2 2002-02-10 Hans Häggström zzorn Added more lists, clarified, tidied up.

Introduction

This document contains sections describing the following:
  1. The Core Framework classes of the MMS implementation
  2. Various MachineComponent decendant classes, implementing the functionality of machine parts.
  3. The connection types to implement for early Mason versions.
  4. The Technology Types that will be used in Mason.
  5. A list of Machine Part archetypes to be used in early Mason versions.
  6. Examples of some machines built from presented machine parts.

Core Framework

The following classes form the foundation for the mechanical system.
MachineComponent (abstract base class)

extends

properties

  • unique id
  • name optionally given by user on creation time (label on the component somewhere) (not necessarily unique)
  • description of the role of the component supplied by user at creation time
  • list of ConnectionPort instances
  • reference to TechnologyType

description

Various components will inherit this, and implement generic functionality, that will be used to implement a number of different machine parts in the game. For example, an EnergyStorageComponent can be used to implement a spring based light metal technology energy storage machine part item, as well as a battery based electric technology type one. The different inheriting components have properties that can be used to adjust their functionality for different item types (max energy storage, leakage, etc in the case of the example above).

ConnectionPort

extends

properties

  • name of this Port (can be specified by user, doesn't have to be unique)
  • source MachineComponent
  • destination MachineComponent (if connected)
  • connection type - reference to connection type object, or an enum that holds the connection type.
  • incoming or outgoing connection - enum.
  • ConnectionStrategy object instance? This is a strategy pattern object that holds connection type specific data about the current state of the connection, such as the current outgoing signal value, or energy level, or queue of items, etc.

description

Alternatively to using a connection strategy object, we could simply have different inheriting objects for different connection types? The component code needs to know the type of the connection Ports anyway.

TechnologyType

extends

properties

  • name
  • description (for user?)
  • a reference to a set of textures, models and other media that can be used for machine parts based on this technology.
  • typical energy loss in this technology for each connection (both a constant factor and multiplier)

Holds various parameters that describe the performance, media, typical raw materials / items (?), default size of machine parts, and other properties of a technology type.

ConnectionStrategy (abstract base class)

extends

properties

description

This is the base class for all connection strategy classes. Each type of connection has an own connection strategy class that is used to hold information about a connection that is specific to a particular connection type, such as the current outgoing signal value for SignalConnections, or energy level for EnergyConnections, or queue of items for ItemConnections, etc.

How is it accessed uniformly from the host object?? Is the strategy pattern really the best alternative here?

MachineManager

extends

properties

  • List of MachineComponents to simulate.
  • Scheduler - contains scheduled future events to handle (resulting from internal state changes of components, and such).
  • list of ConnectionPorts that are marked dirty, that is, their output value has changed and the target component needs to be updated.

description

Keeps track of all the machine components on a game server, and simulates their functionality.

Contains methods to allow ComponentPorts to be added to a dirty list if they change and the target should be updated (output ComponentPorts mostly add themselves here when they are updated, if they are connected to some target Port).

Could perhaps in the future be able to work together with other MachineManagers to keep track of connections between machines handled by different MachineManagers, either on the same server, or on other servers (when distributed servers are implemented).

Also has methods for adding new MachineComponents, and connecting a ConnectionPort to another ConnectionPort.

Scheduler

extends

properties

  • list of scheduled events (callback + parameters), and the time they should be activated.

description

Used to schedule events that occur in the future, or now. Each event consists of a callback reference (using libsig for example) along with parameters to pass it.

MachineComponentBuilder

extends

properties

description

Creates a MachineComponent based on some atlas description / parameter set or similar. Also creates ConnectionPorts for the machine part, but doesn't connect them anywhere (?).

Machine Component Classes

Classes derived from MachineComponent are implementations of different kind of functionality. They should be designed to be relatively general, and can be configured on creation time with a set of properties giving various constant factors and settings that configures the exact behavior of the MachineComponent. The properties of Machin components are also affected by the TechnologyType.

This is a list of some MachineComponents that could be implemented.

EnergyGeneratorComponent

inputs

  • signal - amount of energy to produce, if possible (in Watts (=Joule/s)).

outputs

  • energy - generated energy.
  • signal - amount of generated energy in Watts.

properties

  • float - maximum energy output (adjusted by the technology type?).
  • float - half-life. Time before it takes for the max energy to shrink by half. Set to a negative value to disable (?)

description Generates energy from some source. Probably needs different sub classes for different energy generation methods (windmill wings, water wheel, steam engine, etc). These subclasses can also define additional inputs or outputs (such as an incoming item and/or fluid connection for fuel to be burned. The default implementation just generates energy constantly at a maximum rate specified in the properties. It is possible to specify the maximum amount of energy it can generate before running out, though.

The amount of energy should not change too often, to decrease the amount of simulation updates needed.

EnergyTransmissionComponent

inputs

  • energy - N number of energy inputs

outputs

  • energy - N number of energy outputs
  • signal - total amount of input energy (Watts)
  • signal - total amount of output energy (Watts)
  • signal - current usage level of the provided energy (0..1)

properties

description An energy transmission component provides an energy bus that various machine pars tap into. If the energy desired by machine parts is greater than the supply, the amount of energy actually delivered to components is decreased until it is equal to the supplied energy. If the input energy exceeds the output energy, the excess energy is wasted (?).

TODO: What policy should be used to divide the energy between different outputs, if there isn't enough for all?

EnergyStorageComponent

inputs

outputs

properties

description

EnergyControlComponent

inputs

  • energy - M number of energy inputs.
  • signal - N number of signals to control the proportional amount of energy to send to the corresponding energy output (0..)

outputs

  • energy - N number of energy outputs.

properties

description Has a number of output Ports, each of which has an input signal controlling the amount of the incoming energy to direct to that Port. This component can also be used as a general junction component to add many incoming energy connections, or as a switch, that turns energy flow on or off to the output.

Connection Types

Energy Connection
Transmits energy between machine components.
Signal Connection
This is basically a floating point number. Many machines take input or produce input in the range 0..1, or -1..1, but it makes sense to allow a free range, so that we can express unbound numbers too (for example to count things, etc). The signal of an output Port stays the same until it is changed.

A signal output could be connected to multiple signal inputs, but each input can only recieve a signal from one output. (will this result in complications? it would make life a bit easier for teh user)

Item Connection
Individual items are transported between machine parts that can operate on them in different ways. An item can only be transported from a source machine component to a destination Port on another machine if the destination Port is ready to receive it.

Item connections come in different sizes, that each has some maximum size of the item that canbe transported, and requirements for a minimum size of the machine part that contains it.

The connection area sizes are:

  • tiny - 12.5 * 12.5 cm
  • small - 25 * 25 cm
  • medium - 50 * 50 cm
  • large - 1 * 1 m
  • huge - 2 * 2 m
The maximum size of an item that can be transmitted through a given connection size is around 10% smaller than the connection area size.

Fluid Connection
For liquids, gases, and perhaps powders also. Simulates pressure, and thus opens up some complex issues, so it was left for a later Mason iteration.
Information Object Connection
Sends information objects (text, pictures, structured data, scripts, blueprints, etc). Postponed for a later iteration.

Technology Types

A technology type specifies the general technology that machine parts are created with. This affects what the machine parts look like, their size, and various constants, such as energy lost in energy connections, calculation speed, item transport speed, energy use of machine parts, etc.

Note that a machine part can be connected to a machine part of another technology type without problems.

Parameters

These are the parameters that each Technology Type defines. Some are a bit unclear yet how they should work exactly, like the media references.

List of Technology Types

This is a list of some Technology Types that could be used in Mason.

Wood
Creates machines out of wood, with optional metal reinforcements (although pure use of wood is also possible). Typical size of machine parts is around 0.5 m3. Relatively high friction, and slow, although it can manage moderate loads. Moderate energy use.
Light Metal
Small, intricate metal working. typical size 0.25 m3. Faster, but can handle smaller energy amounts. Small energy use.
Heavy Metal
Large cast-iron components. Typical size 1 m3. Handles heavy loads, but can have a lot of friction, resulting in some energy loss in energy connections. Large energy use.

Machine Part Archetypes

Machine Parts are Archetypes that define specific item types that can be created in-game. Each machine part maps to one MachineComponent class, and contains parameters to configure it (the TechnologyType and other general parameters, as well as parameters specific to the particular subclass of MachineComponent that is used.

The machine part also contains a description of the shape and size of the object (as multiplies of the typical dimensions specified in the Technology Type).

Connection Areas

Machine Parts have one or more Connection Areas. In order to connect two ports in two different machine parts together, they have to be placed so that some of their connection areas touch each other. Any number of connections can be made through one connection area. The size of a connection area depends on the technology type, and in the case of components with matter connections, also on the size of the matter connection.

Appearance of a Machine Part

A machine part generally fits within a box shaped bounding box, with a side length that is typical for the technology type it is based on. Machine parts can have custom models, but if one isn't present, a normal solid box is used. There are a number of standardized machine part template textures that are used for skinning a box or a model. For each technology type there are different realisations of the template textures.

There are template textures for some different categories of machine parts, such as transmission, processing, effector, sensor, grouping, etc. In addition there's template textures for various types of parts on custom models, such as thin membranes, reinforced thin surfaces, supporting beams, machinery, covering plates, connection areas, and so on.

Machine Part Categories

Machine Parts can be divided roughly in the following groups, although there are no absolute boundaries, and a machine part can belong to none or many of these:

Grouping
Contains a number of internal machine parts, and presents a custom interface to them.
Generator
Produces energy, in one way or other.
Transmission
Moves energy, signals, matter, etc.
Energy Storage
Machine Parts that store energy in one way or another.
Sensors
Machine Parts that react to the outside world, and encode it in one or more signals.
Processors
Machine Parts that manipulate signals in various ways to produce new signals.
Manipulators
Machine Parts that apply some action to items arriving through item connections.
Effectors
Machine Parts that have some direct effect on the world, by moving things in different ways normally. Also includes machine part taht produce sound or light.
Gauges
Presents various incoming signals to characters in some way.
Control Panels
This is advanced functionality that will not be needed in the first iteration of mason.

Machine parts that present the user with a number of various controls and gauges as one single interface, that the user can use by issuing an use action, and stop using by issuing some stopUsage type of action (the game communicates the new properties and possible actions to the user through a Control Interface or in a similar way).

Machine Part List

This is a list of some of the Machine Parts that could be implemented for Mason, sorted roughly by category.

Grouping

Contains a number of internal machine parts, and presents a custom interface to them.
Assembly Box

inputs

  • User defined, up to some maximal number

outputs

  • User defined, up to some maximal number

technology types All

sizes Many different (user definable?)

description Contained machine parts have to be smaller or as big as the assembly box, but there could perhaps be some number of them allowed, independent on their added size, to avoid too large boxes, and to simulate the effect of not having to build a frame for each machine part.

Generator

Produces energy, in one way or other.
Crank

inputs

outputs

  • energy
  • signal - amount of generated energy (in Watts)

technology types Light metal, Wood

description A hand turnable crank attached to a unit sized box (=the size depends on the typical size of the technology type).

Waterwheel

inputs

outputs

  • energy
  • signal - amount of generated energy (in Watts)

technology type Light metal, Wood, Heavy metal

description A water wheel that is rotated by flowing water. The light metal water wheel is just a tiny one(0.5 m), the wooden one is relatively large (2m or so), and the heavy metal one is industrial size (4 m). The water wheel is attached to a unit cube.

Windmill Wings

inputs

outputs

  • energy
  • signal - amount of generated energy (in Watts)

technology type Light Metal, Wooden

description Windmill wings attached to a default sized cube. The wings have a diameter of eight times the default size of the technology type.

Transmission

Moves energy, signals, matter, etc.
Energy Transmission

inputs

  • energy - in port

outputs

  • energy - out port

technology typeAll

size Default height and width, length can be 1, 2, 4 or 8 times default length.

description Has contact areas at both ends, allowing transmission of energy over a distance.

Signal Transmission

inputs

  • signal - Signal 1 in
  • signal - Signal 2 in
  • signal - Signal 3 in
  • signal - Signal 4 in
  • signal - Signal 5 in
  • signal - Signal 6 in
  • signal - Signal 7 in
  • signal - Signal 8 in

outputs

  • signal - Signal 1 out
  • signal - Signal 2 out
  • signal - Signal 3 out
  • signal - Signal 4 out
  • signal - Signal 5 out
  • signal - Signal 6 out
  • signal - Signal 7 out
  • signal - Signal 8 out

technology typeAll

size Default height and width, length can be 1, 2, 4 or 8 times default length.

description Transmitts up to eight different signals. Has contact areas at regular intervalls along it'slength, and at ends, so it's easy to connect to many machine parts.

Matter Transport

inputs

outputs

technology type

description

Energy Storage

Machine Parts that store energy in one way or another.
Spring

inputs

  • energy - Energy in
  • signal - Desired amount of energy to be released (in Watts)

outputs

  • energy - Energy out
  • signal - Amount of energy stored (in Joule)
  • signal - Amount of energy currently being released (in Watts)

technology type Light Metal, Heavy Metal

description The energy is stored by winding up a metal spring.

Gyroscope (?) / rotating wheel

inputs

  • energy - Energy in
  • signal - Desired amount of energy to be released (in Watts)

outputs

  • energy - Energy out
  • signal - Amount of energy stored (in Joule)
  • signal - Amount of energy currently being released (in Watts)

technology type Light Metal, Wood, Heavy Metal

description The energy is stored as rotation in a heavy wheel. This means that the energy is lost over time to friction, but on the other hand it is possible to get out quite large amounts of energy out of the storage in a short time span.

Weights

inputs

  • energy - Energy in
  • signal - Desired amount of energy to be released (in Watts)

outputs

  • energy - Energy out
  • signal - Amount of energy stored (in Joule)
  • signal - Amount of energy currently being released (in Watts)

technology type

description The machine part contains heavy internal weights used to store energy as kinetical energy. There is a clear upper limit on the amount of energy that can be stored, but it is stored reliably and can be released relatively fast.

Sensors

Machine Parts that react to the outside world, and encode it in one or more signals.
Button

inputs

outputs

  • signal - Pressed (0 or 1)

technology type

description A simple button that reverts to unpressed when released.

Lever

inputs

outputs

  • signal - Position (0..1)

technology type

description A lever that can be left at any position between two end points.

Steering Wheel

inputs

outputs

  • signal - Value
  • signal - Current rate of change

technology type

description Wheel that can be rotated freely in either direction, resulting in an unlimited input range, although it takes time to rotate it, and there's no built in feedback about the current position to the user.

Weight Sensor

inputs

outputs

  • signal - Weight resting on it (in kg)
  • signal - Rate of change

technology type Light Metal, Wood, Heavy Metal

size unit width and length, but 0.25 in height.

description A weight sensor that for example can be used as a hidden swith under a floor tile. The accuracy and range depends on the technology type (?).

inputs

outputs

technology type

description

inputs

outputs

technology type

description

inputs

outputs

technology type

description

Processors

Machine Parts that manipulate signals in various ways to produce new signals.
Function

inputs

  • signal - Argument a
  • signal - Argument b
  • signal - Argument c
  • signal - Argument d

outputs

  • signal - Output 1
  • signal - Output 2
  • signal - Output 3
  • signal - Output 4

parameters A function that calculates each output based on values from inputs. It can use normal arthimetical operations, trigonometrical operations, and other useful operations.

technology type Light Metal, Wood

description

inputs

outputs

technology type

description

inputs

outputs

technology type

description

Manipulators

Machine Parts that apply some action to items arriving through item connections.

inputs

outputs

technology type

description

inputs

outputs

technology type

description

inputs

outputs

technology type

description

Effectors

Machine Parts that have some direct effect on the world, by moving things in different ways normally. Also includes machine part taht produce sound or light.

inputs

outputs

technology type

description

inputs

outputs

technology type

description

inputs

outputs

technology type

description

Gauges

Presents various incoming signals to characters in some way.

inputs

outputs

technology type

description

inputs

outputs

technology type

description

inputs

outputs

technology type

description

Examples

Windmill

Saw

MechWarrior

Death Star

Aibo Dog

Slashdot Troll

Rubics Cube Solver

*Catch the runaway designer!*
Time for sleep I guess.