Vertical smooth scrolling with generated tiles ...
Posted: Fri Mar 19, 2021 7:27 am
The fun part of all this tiling is exactly the internal mechanisms:
How to identify the possible tiles that glue to a combination of already placed tiles on the canvas.
How to randomly select from these possible tiles one tile that will be glued.
How to selectively randomly select that tile, meaning, with weighting factors.
Trying to figure out the most CPU cost effective way to get the job done.
Right now, the whole thing works with arrays, which is good, but it involves linear searching.
And multiple loops are involved to find the collection of tiles that can be glued.
The advantage of using arrays is that the random selection process becomes very easy.
Using lists or tree structures would make this process much harder, but on the other side,
using structures would make the process of searching for the viable tiles the fastest as is possible.
I'm thinking of another way of doing it, by using bit-wise selection criteria, for each direction, that would allow me to kind of
"mathematically" calculate the right tiles that can be glued, so no tree structures would be required.
But then still, this would involve building a collection of possible tiles through loops ...
I hope you get my above points.
To show you what i mean with the above forum question, have a read through this, which are articles about "bitmasking":
How to Use Tile Bitmasking to Auto-Tile Your Level Layouts (tutsplus.com)
Bitwise Tilemapping - kyle kukshtel's game dev/design blog
Any ideas here in the community? You can have a look at my code here:
X16_Code/tileengine.c at main · FlightControl-User/X16_Code (github.com)
If you want to compile it, ensure you are using the kickc derived version (helping Jesper on that) here:
Files · CX16_VERA · Sven Van de Velde / kickc · GitLab
Sven