Hey guys,
ESystem, is a collection of functions and types which will let you create and simulate electrical or logical systems in your games and programs.
You create various circuits using different parts from the system, such as:
- WIREs
- TRIGGERs
- TIMERs
- GATEs (AND, OR, XOR, NAND, and Compare Gates)
- You can set up various Triggers, Gates, and Timers, and then connect them using the Wires.
- The system then simulates the circuit by following the wires and updating the various Gates, and Timers.
- Connect Triggers or Wires to your ingame events, to have an actual electrical or logic system in your game.
- You can Cut or Uncut wires to simulate someone trying to bypass the circuit.
Here's a quick example of a simple circuit:
Create 3 new Wires.
wire1 = ES_NewWire()
wire2 = ES_NewWire()
wire3 = ES_NewWire()
Create 2 new Triggers, and connect them to the Wires.
trigger1 = ES_NewTrigger(wire1)
trigger2 = ES_NewTrigger(wire2)
Create 1 new AND Gate, and connect the first two Wires to the inputs. Connect the third Wire to the output.
andgate = ES_NewAndGate(wire1, wire2, wire3)
You now have a basic AND Gate which is only opened if both triggers are activated...
I have plans to expand the system with more gates, and other types of units, but it should be very useable as it is.
Included in the .zip file is all the source(includes), and some examples that I have made to demonstrate how to use the functions.
Everything is commented, so it should be easy to understand.
Use the system as you like, and you are welcome to post any modifications or additions you make to it. It is FREE/OpenSource.
Credits is appreciated though...
- enderleit
[href]www.eleit.dk[/href]