Vertical smooth scrolling with generated tiles ...
- svenvandevelde
- Posts: 488
- Joined: Wed Dec 23, 2020 6:30 am
- Location: Belgium, Antwerpen
Vertical smooth scrolling with generated tiles ...
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.
- svenvandevelde
- Posts: 488
- Joined: Wed Dec 23, 2020 6:30 am
- Location: Belgium, Antwerpen
Vertical smooth scrolling with generated tiles ...
- svenvandevelde
- Posts: 488
- Joined: Wed Dec 23, 2020 6:30 am
- Location: Belgium, Antwerpen
Vertical smooth scrolling with generated tiles ...
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 :-).
Vertical smooth scrolling with generated tiles ...
How are you generating the psudo randomness for this?
- svenvandevelde
- Posts: 488
- Joined: Wed Dec 23, 2020 6:30 am
- Location: Belgium, Antwerpen
Vertical smooth scrolling with generated tiles ...
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 ?
Vertical smooth scrolling with generated tiles ...
Cool was just wondering if your using a hash or not ? look forward to reading your solution.
- svenvandevelde
- Posts: 488
- Joined: Wed Dec 23, 2020 6:30 am
- Location: Belgium, Antwerpen
- svenvandevelde
- Posts: 488
- Joined: Wed Dec 23, 2020 6:30 am
- Location: Belgium, Antwerpen
Vertical smooth scrolling with generated tiles ...
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).
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:
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".
- svenvandevelde
- Posts: 488
- Joined: Wed Dec 23, 2020 6:30 am
- Location: Belgium, Antwerpen
Vertical smooth scrolling with generated tiles ...
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!
- svenvandevelde
- Posts: 488
- Joined: Wed Dec 23, 2020 6:30 am
- Location: Belgium, Antwerpen
Vertical smooth scrolling with generated tiles ...
Just updated the demo version to 1.1.0, on the downloads page ...
Space Flight - Demos - Commander X16™ Community