Vertical smooth scrolling with generated tiles ...

All aspects of programming on the Commander X16.
User avatar
svenvandevelde
Posts: 488
Joined: Wed Dec 23, 2020 6:30 am
Location: Belgium, Antwerpen

Vertical smooth scrolling with generated tiles ...

Post by svenvandevelde »


Still around, just having loads of fun creating a random tile generator ... lol ... It's harder than i thought ? it would be ... ?.

Anyway, getting there, i also need to incorporate an evaluation of the diagonal tiles to be able to plot the right new tile.

 

image.thumb.png.44b51505459a92060c84a6bb350c8eb8.png

KICKC home page by Jesper Gravgaard.
My KICKC alpha with Commander X16 extensions.
User avatar
svenvandevelde
Posts: 488
Joined: Wed Dec 23, 2020 6:30 am
Location: Belgium, Antwerpen

Vertical smooth scrolling with generated tiles ...

Post by svenvandevelde »


Improving ..., but not yet perfect ...

It has been quite a trip to get to this point, let me tell you. About 2 months (of course, not every day looking at this ...).

 

image.thumb.png.f3925e705e0b2133bc53215ee5dacf2c.png

KICKC home page by Jesper Gravgaard.
My KICKC alpha with Commander X16 extensions.
User avatar
svenvandevelde
Posts: 488
Joined: Wed Dec 23, 2020 6:30 am
Location: Belgium, Antwerpen

Vertical smooth scrolling with generated tiles ...

Post by svenvandevelde »


Next will be to add "weight" factors which tiles get preference in the random selection algorithm. so that it becomes "spacey".

And then it will be using blender to make some "nice" tiles, as this is all mock-up stuff. Keep you posted.

Kids need to go to school so time for work and father responsibilities :-).

KICKC home page by Jesper Gravgaard.
My KICKC alpha with Commander X16 extensions.
Cunnah
Posts: 14
Joined: Thu Feb 11, 2021 3:40 pm

Vertical smooth scrolling with generated tiles ...

Post by Cunnah »


How are you generating the psudo randomness for this?

User avatar
svenvandevelde
Posts: 488
Joined: Wed Dec 23, 2020 6:30 am
Location: Belgium, Antwerpen

Vertical smooth scrolling with generated tiles ...

Post by svenvandevelde »



2 hours ago, Cunnah said:




How are you generating the psudo randomness for this?



I will do a very detailed write-up once i have it working. I'll share everything ?

KICKC home page by Jesper Gravgaard.
My KICKC alpha with Commander X16 extensions.
Cunnah
Posts: 14
Joined: Thu Feb 11, 2021 3:40 pm

Vertical smooth scrolling with generated tiles ...

Post by Cunnah »


Cool was just wondering if your using a hash or not ? look forward to reading your solution.

User avatar
svenvandevelde
Posts: 488
Joined: Wed Dec 23, 2020 6:30 am
Location: Belgium, Antwerpen

Vertical smooth scrolling with generated tiles ...

Post by svenvandevelde »


It's working now ...

image.thumb.png.08fdbf1a4cd1dece06a1bb617a962d97.png

KICKC home page by Jesper Gravgaard.
My KICKC alpha with Commander X16 extensions.
User avatar
svenvandevelde
Posts: 488
Joined: Wed Dec 23, 2020 6:30 am
Location: Belgium, Antwerpen

Vertical smooth scrolling with generated tiles ...

Post by svenvandevelde »



1 hour ago, Cunnah said:




Cool was just wondering if your using a hash or not ? look forward to reading your solution.



I still need to optimize the speed of tile searching, because that is a culprit (i get a small hickup when a tile boundary is reached and a new row of tiles need to be generated). I'm thinking of building a quad tree or something like this, where each tile is indexed based on it's boundaries.

Each tile has a number, and contains out of 4 segments of 32x32 pixels, so each tile is in total 64 pixels. And yes, the drawing algorithm needs to divide each segment of the 4x32x32 tile into the 16 pixel tile resolution of the vera. (I use the vera 4 bit per pixel with 16x16 pixel tile configuration mode.)

As you can see in the diagram below, each tile has a North, East, South and West "border" type. So the algorithm has a structure to "understand" what the already drawn tiles are, and what the possible tiles are that "glue" as the next one. (It's like a puzzle). 

image.png.f499527e778bbc7b6e6f6d43fa2fe1f0.pngimage.png.e702fe1070759dc36760f59931f4d2cf.pngimage.png.373d4af360710ed7a8430858fa41047a.pngimage.png.48d6789f35e3094a74dff19a4cc223f3.pngimage.png.67ef177933ca229360890068d8346c8f.pngimage.png.3b3872828f94b54d7383bfb9156311be.png

Starting up, the algorithm generates a "base" row totally at the bottom, with just random tiles which are correctly glued to the east. So each tile has matching borders. 

Then it generates one row higher (row - 1), but taking into account glueing to the borders of the tiles already drawn on the row below, ensuring that the borders at the west and south match up for each new tile. There is a potential conflict that can occur with the "next" tile to the right, which is a situation like this:

image.png.edb26cee8f9385b836cea6e7645f438e.png

 

Here you can see tile 23 having an impossible combination (it's my square raster tile), which glues perfectly to the West with tile 25, and to the south with tile 02. But! The next tile, will give an issue! Tile 07 can never result in a match, as the only possible combination to the east of tile 23 is tile 22, which does not glues to the south with border 13, it must have a border 00.

So to solve this, the algorithm "looks ahead", ensuring a valid combination on the road every time ...

My current implementation is a bit too CPU intensive, but the next phase is to get the code more performant, and to start using "trees" or indeed ... "hashing".

 

KICKC home page by Jesper Gravgaard.
My KICKC alpha with Commander X16 extensions.
User avatar
svenvandevelde
Posts: 488
Joined: Wed Dec 23, 2020 6:30 am
Location: Belgium, Antwerpen

Vertical smooth scrolling with generated tiles ...

Post by svenvandevelde »


I'll post now very soon the program as a new version to my earlier "space demo" program, so you can also look at the code etc, and try it out yourself!

KICKC home page by Jesper Gravgaard.
My KICKC alpha with Commander X16 extensions.
User avatar
svenvandevelde
Posts: 488
Joined: Wed Dec 23, 2020 6:30 am
Location: Belgium, Antwerpen

Vertical smooth scrolling with generated tiles ...

Post by svenvandevelde »


Just updated the demo version to 1.1.0, on the downloads page ...

Space Flight - Demos - Commander X16™ Community

KICKC home page by Jesper Gravgaard.
My KICKC alpha with Commander X16 extensions.
Post Reply