How to make a Logic System in Roblox?

I have recently seen a game that involves creating circuits. I was thinking, how would this be possible in Roblox? Where would I start and what would I do?

I have examples here:

This is my first post in the Roblox Devforum.

1 Like

I don’t actually really know what this is.

But based on my own assumption, I assume you want to create a system where you can essentially connect objects together to create functionality?

so e.g: some event takes place, and any connected object reacts to it.

If that’s the case, you’d want to establish a connection between some object to the logic object. When ever an event occurs on the logic object, determine if there’s connected objects to be managed. If so, handle processing the connected objects to do something. I would probably do this with the use of BindableEvents.

If you’re familiar with OOP (object-oriented programming) I’d probably make each logic object inherit from a base class, and establish a method where you can then connect objects to the logic object.

Lot of information, and I have no idea if this is what the video meant, but hopefully it helps to any extent.

3 Likes

I’m not sure exactly what you’re trying to make, but if you want to make a sandbox like game where you can make circuits and write simple commands, you should be able to find some examples on google, or you could make it your self. It seems like the circuit system in the video uses a graph tree system to store the circuits positions, with different nodes derived from a base node class to represent the different types of components.

I’ve recently messed around with a graph tree and Dijkstra’s algorithm with C#, and by the looks of it, it’s not that hard. I made my own binary tree in C#, which is pretty close to a graph tree.

Oh yeah, and for the “simple” commands, you’re going to need a parser! If this wasn’t Roblox, I would recommend Gold Parser, since I have a bit of experience with it, and it supports the most languages of any parser (I think), but since we’re dealing with the hit 2006 game engine and metaverse, Roblox, you’re going to need to make it all on your own, which is just a nightmare, especially with Luau, and how it’s not the most OOP centered language there is.

3 Likes