The Student Room Group

Logic gates in Unity

I need to make some logic gate function for a game I'm making. I just need the different systems work so the player can open doors.

I can't find anything that can help me with this so I am stuck and pretty much cannot move on. Also, if I can't get this to work, I can't make my game at all as logic gates are the thing game is based on.

This game is for my computing NEA so this is a dire situation.
Does anyone have any ideas of how to make working logic gate systems. Or at least know some good tutorials I can use so I can move on.

I would really, REALLY appreciate it.
Reply 1
Hi again \^-^

To start with you'll probably want to look into graphs/trees (this is a Y13 topic). You can represent the circuit as a graph, with each input, gate, and output being a node in the graph.

If you only want to have a single output to the circuit then you can use a basic tree and it should be fairly straightforward once you're somewhat familiar with them

If you want to have multiple outputs (e.g half adders, full adders) then it starts to get a lot more complicated. Certainly doable but definitely a bit harder.

Then if you want to also include a clock (e.g for flip-flops, latches) it gets more complex still.

Probably I'd recommend doing option 2 (multiple outputs), but if that's too much option 1 will probably still get a lot of marks, covering tree traversal and recursion.

Logic circuits are surprisingly complicated right? I can probably go more in-depth on what such a system would look like, in terms of class structure, inheritance, etc. if you need it
Original post by Teruko
Hi again \^-^

To start with you'll probably want to look into graphs/trees (this is a Y13 topic). You can represent the circuit as a graph, with each input, gate, and output being a node in the graph.

If you only want to have a single output to the circuit then you can use a basic tree and it should be fairly straightforward once you're somewhat familiar with them

If you want to have multiple outputs (e.g half adders, full adders) then it starts to get a lot more complicated. Certainly doable but definitely a bit harder.

Then if you want to also include a clock (e.g for flip-flops, latches) it gets more complex still.

Probably I'd recommend doing option 2 (multiple outputs), but if that's too much option 1 will probably still get a lot of marks, covering tree traversal and recursion.

Logic circuits are surprisingly complicated right? I can probably go more in-depth on what such a system would look like, in terms of class structure, inheritance, etc. if you need it


Heya Teruko!! Nice to meet you again (0u 0 ).

Thanks for the ideas. I hope these will work! I'll try starting with option 1 for the first few levels (since the game is level based) then I'd probably try 2 & 3 later down the line.

For now, I think I'll stick with trying to make these work. Then, if I need anymore help, I'll come back to you.
Damn, you're really helpful. If you don't mind, I'll tell you whether you're suggestions work. If they do, I will be ABSOLUTELY grateful. I'm glad I've come across you (^v^).

Thanks again!
Reply 3
Original post by Nyanomii•にゃのみい
Heya Teruko!! Nice to meet you again (0u 0 ).

Thanks for the ideas. I hope these will work! I'll try starting with option 1 for the first few levels (since the game is level based) then I'd probably try 2 & 3 later down the line.

For now, I think I'll stick with trying to make these work. Then, if I need anymore help, I'll come back to you.
Damn, you're really helpful. If you don't mind, I'll tell you whether you're suggestions work. If they do, I will be ABSOLUTELY grateful. I'm glad I've come across you (^v^).

Thanks again!


Yw!

Quick Reply

Latest