Conveyors, routers, sorters and overflow gates.

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
WAWAWA
Prole
Posts: 32
Joined: Fri Aug 13, 2021 5:10 pm

Conveyors, routers, sorters and overflow gates.

Post by WAWAWA »

Hello, I am starting to make a game like mindustry, but I do not understand how to make conveyors, routers, sorters and overflow gates. Now, let me explain how these blocks work.

Conveyors - Move input that can be then forwarded to the core, turrets or in production.
Routers - Obtain input and output them on 1 - 3 different sides.
Sorters - Move the configurated input forward, and the rest on the sides.
Overflow Gates - If forward is blocked, output on left and right.

I need to recreate these blocks in my game,
any help is appriciated.
Last edited by WAWAWA on Mon Aug 30, 2021 2:37 pm, edited 1 time in total.
User avatar
darkfrei
Party member
Posts: 1169
Joined: Sat Feb 08, 2020 11:09 pm

Re: Conveyors, routers, sorters and overflow gates.

Post by darkfrei »

I've thought about conveyors in Lua :cool: , it looks like that here must be two main tweaks:

1) The items on the belts are not moving (items on the belt are just names in the table).
2) Use the shift as function of time to draw and access items on belts.

For example:

Code: Select all

belt = {}
belt.items = {"wood", "copper", "iron", "empty"}
belt.shift = 0
Right now the inserter takes items from fourth belt tile, where is "empty".

After one second the shift will be belt.shift = belt.shift + 1 and if the inserter must grab item from the belt tile number three, it takes iron and writes "empty" to this belt tile.
After the another second it will be copper, than wood and than the shift must be returned back to 0.
The drawing must be hacked the same way, but with smooth moving.
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
User avatar
WAWAWA
Prole
Posts: 32
Joined: Fri Aug 13, 2021 5:10 pm

Re: Conveyors, routers, sorters and overflow gates.

Post by WAWAWA »

For the drawing I can use rotation, cosine and sine and I can do some if statements and add the item position x or y with 0.1 multiplied by the conveyor speed. Right?
User avatar
darkfrei
Party member
Posts: 1169
Joined: Sat Feb 08, 2020 11:09 pm

Re: Conveyors, routers, sorters and overflow gates.

Post by darkfrei »

WAWAWA wrote: Wed Sep 01, 2021 9:32 am For the drawing I can use rotation, cosine and sine and I can do some if statements and add the item position x or y with 0.1 multiplied by the conveyor speed. Right?
Maybe pre-calculated positions for straight and curved belts, for example 10 positions for straight belt and 16 positions for curved one (target ratio is 1.5708 or half pi).
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
Post Reply

Who is online

Users browsing this forum: No registered users and 43 guests