Days 2&3 (concept mechanics)


and welcome to day 2 I guess! After day 1, I had finished the idea and what I thought was a part of a simple process of getting the demo mechanics done. (I was very, very wrong lol) From day 1 I had spawners and movers, where movers moved on even ticks and spawners spawned on odd ticks. I also had joiners but no support for joined tiles(they added tiles to a groups list).


I was talking on discord whilst developing, and by doing so, accumulated masses of screenshots of all the various bugs I am about to share:

Moving tiles with the overhauled system was putting in the wrong tile:


Moving groups caused this issue, I later realized was due to it only moving the "outer face"(if moving right, it would only moves all tiles on the right side of the shape)

A very confuzing looking bug with the grouping, I made a debugger that colour codes each group so you can identify them.

I realize the bug is due to having groups ontop of each other(overlapping)


After a bit of debugging I realize it's because a group gets moved twice. when the black group gets pushed down into these other groups, It moves orange, and moves purple. then purple moves orange out of the way resulting in 2 orange pushes.

I spend a while getting confuzed by things like this - I think this is meant to make an l shape. After a while I realize the issue is joiners merging a group with itself, and it ends up deleting the group

Finally at a point where I can show, working, one of the machines from the concept! (also green fists happen on an opposite cycle to blue)

And now for an interesting part! I needed to implement the arm. I had a talk with a friend about a few systems for it.

My problem was that what I shown in the demo wouldn't work because if the arm rotates what it holds, it will only snap to the grid after the rotation if it rotated a multiple of 90.

Picture to show what I mean (rotation that arent multiples of 90 dont work)

To counter this issue, I thought of 3 methods:

1)after placing an arm, you use scrollwheel to select the length, then you can select a tile for input and output(it highlights the 4 tiles on 90degree rotations)

2)they work like inserters in factorio(they take from infront and move to behind), but insted they rotate what's infront 180 degrees to go behind it

Here is a demo gif of my cross factory(it exploits a glitch where pushers can be "stacked".

what I mean by this is they happen one after each other, and if after one pusher has pushed another can push the same thing, it will.

Another thing to consider is that pushers can push from under a shape, as long as the cell infront in filled.

Next up is the crafters. and the first thing I decided to do was autotiling.

Here you can see all the autotiles I drew, and bitmasks in godot(in red):

After doing it I found a way of saving ridiculous amounts of time making new autotiles!

Every autotile can be made up of I think 20? smaller 8x8 tiles!


This means if I convert it to a tilemap in aseprite, I only have to change/draw those 20 tiles and it will update the rest of the autotile for me!


Fairly out of place because I'm lacking screenshots for most of the code but here is my crafter code(it works out where all your blobs of crafter's are and adds all the points in each crafter to seperate lists inside the crafters list.


The next thing I did was make a dictionary of recipies, where the key is a grid for the crafter(-1 is ignored(outside of the crafter)), and the value(in this case, 7) is the tile I fill it with once the recipie is complete.

To complete a recipie, a crafter must have a group identical to itself ontop of it(every cell in a crafter is 1) in the same group 2) the group has no points that arent in the crafter 3)not empty



After this I change the system(-2 is now ignore, and -1 is air.)

The changes mean crafting recipies can do anything to tiles in the grid(not just fill the crafter).

This allows me to make the crafter only put the result in the center:

ANNNNND FINALLY!!

(I also added trash tiles)

all the concept features are done! allowing me to make this gif(I really enjoyed playing around with the game and designing these)

My code is now quite long, spanning more than this preview and 333 lines.(also linked the code if you want to see how anything works!

https://pastebin.com/0K1P6XwG


Get my game thing lol

Leave a comment

Log in with itch.io to leave a comment.