[V0.7.0] Rethink, a 2D game engine

Documentation
Github
Dev place
Module
Last changelog

Hello world!

Ever stepped back making a 2D game, because ROBLOX does not officially support such style of game? Well, let me introduce you to: Rethink!

A Versatile, easy-to-use 2D game engine.

Current version: 0.7.0


Interested?

Well, let me tell you what it offers:

  • Physics (using Nature2D)
  • Versatile Scene API with symbols
  • Animations with spritesheets or a group of images
  • Directional 2D sounds
  • And more!

Examples

[NOTE]: All of the examples assume that Rethink was initiated beforehand!

Loading in a scene
local Rethink = require(game:GetService("ReplicatedStorage").Rethink)
local Scene = Rethink.GetModules().Scene
local Symbols = Scene.Symbols

Scene.Load({
	Name = "MyScene",

	Interactibles = {
		[Symbols.Type] = "UIBase",
		[Symbols.Property] = {
			BackgroundColor3 = Color3.fromRGB(255, 125, 25),
			Transparency = 0.5,
			[Symbols.Tag] = "Interactibles",
			[Symbols.Tag] = "UniversalTag",
			[Symbols.Class] = "ImageButton",
		},

		Box = {
			AnchorPoint = Vector2.new(0.5, 0.5),
			Position = UDim2.fromScale(0.5, 0.5),
			Size = UDim2.fromOffset(250, 250),

			[Symbols.Tag] = "Box",
			[Symbols.Permanent] = true,

			[Symbols.Event("MouseButton1Click")] = function(thisObject: ImageButton)
				thisObject.BackgroundColor3 =
					Color3.fromRGB(math.random(0, 255), math.random(0, 255), math.random(0, 255))
			end,

			[Symbols.Event("MouseButton2Click")] = function(thisObject: ImageButton)
				Scene.Cleanup(thisObject)
			end,
		},
	},
})

Result:

In Rethink you can assign a container two types:

  • UiBase
  • Rigidbody

But you mentioned something about symbols… Yes, let me tell you about it! Symbols are a way to attach some functionality to an object. Think of them being components in other words. The idea came from Fusion itself. Available symbols are:

Name Description
Tag Gives the given object a tag(s) fetch it with CollectionService or Scene:GetRigidbodyFromTag
Property Applies properties or symbols to objects in the group or the container
Type How the compiler handles the object UiBase and Rigidbody or it’s aliases
Event Hooks events to the given object
Permanent Determines if the object will get deleted on .Flush()
Rigidbody Adds rigidbody properties that later get fed into the Physics engine
LinkTag Adds a tag to object, which can be fetched using LinkGet
LinkGet Returns all of the objects with the specified tag
Class Determines the class of the instance
Children Adds instances parented to the object

Flushing a scene

Flushing a scene in Rethink is very simple:

local Rethink = require(game:GetService("ReplicatedStorage").Rethink)
local Scene = Rethink.GetModules().Scene

Scene.Flush()

Additionally, if it is necessary to fully flush a scene, provide a true in the Scene.Flush function.
This will make scene ignore the Permanent symbol.

Scene.Flush(true)

Animations

Creating animations in Rethink is simple using Animator.

local Rethink = require(game:GetService("ReplicatedStorage").Rethink)
local Modules = Rethink.GetModules()
local Scene = Modules.Scene
local Symbols = Scene.Symbols
local Animator = Modules.Animator

-- Load in a scene
Scene.Load({
	Name = "Animation",
	{
		[Symbols.Type] = "UIBase",

		MyAnimatedObject = {
			AnchorPoint = Vector2.new(0.5, 0.5),
			Position = UDim2.fromScale(0.5, 0.5),
			Size = UDim2.fromOffset(100, 100),

			[Symbols.Class] = "ImageLabel",
			[Symbols.Tag] = "Animated",
		},
	},
})

-- Create our animation class
local MyAnimation = Animator.new(Scene.GetFromTag("Animated"))

-- Create a new animation with a spritesheet
MyAnimation:AddSpritesheet(YOUR_IMAGE_ID_HERE, YOUR_CELL_SIZE_HERE, YOUR_ANIMATION_DATA_HERE)

MyAnimation:ChangeAnimation("MyAnimation")
MyAnimation:SetFramerate(24)
MyAnimation:Play()

Result:


Showcase:

Credits

  • jaipack17 (GitHub) for Nature2D / GuiCollisionService / RayCast2
  • evaera (GitHub) for Promise
  • HowManySmall (GitHub) for Janitor
  • Brownsage for helping with Camera
  • Michael-48 (GitHub) for Iris to test Rethink
  • osyrisrblx (GitHub) for t
30 Likes

This deserves much more attention, it’s sick!! Can’t wait to implement this into one of my games.

7 Likes

It looks very interesting, im gonna to use it :slight_smile:

2 Likes

V0.7.0

  • Fix Animator’s type checking
  • Add Sound to modules
  • Add settings regarding Sound

Miscelaneous changes:

  • Added videos to visualize

Addition of Sound

Sound is a new module added to Rethink. It tries to solve one of the biggest problems that there is no such thing as directional audio in 2D environment out-of-the box!

[NOTE]: Sound is still not completed! New features may include:

  • More customizability
  • Adding effects
  • Better API

The new update is available at:

Hi,
Do you have a demo game to check out what can be done with this?

thanks

Hi! I have not made a game with the engine as of now. However, checking out its testing place should give a pretty good idea of Rethink’s capabilities. The testing place was made uncopylocked to better understand the engine.

In the future if I ever find time, I will make a game with it.

Hope this helps!