Tiling challenge

Share graphical tips, notes and queries related to our favourite screen layout and its editors.
Post Reply
User avatar
ParadigmShifter
Manic Miner
Posts: 670
Joined: Sat Sep 09, 2023 4:55 am

Tiling challenge

Post by ParadigmShifter »

Hi I'm looking for some attribute based tiling that's more interesting than a checkerboard or a square pattern.

Here is something I made earlier, as they say on Blue Peter

Image

I used a spreadsheet, just set widths and heights of cells to be the same and use spectrumish colours. (which I think are RGB values 128 for dark and 192 for bright?)

Tiled area is 18 wide by 24 high.

I'm sure people can do better than me of course ;)

Bonus points for only using 4 colours (no neighbouring region shares same colour) in the tiled area which is possible cos the 4 colour theorem proved via computers in the 1970s.

EDIT: Nicked the 2nd tiling of course, from this site

https://besttile.com/patterns
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

Re: Tiling challenge

Post by equinox »

This does not seem like a "challenge", rather "I want to produce certain patterns obeying certain rules, and I haven't worked out the rules yet"...

How big must the repeat be (4x4? 5x5? ...) and what are the real rules? We can't use the same colour within x squares?

Emergency rope: the old thread https://spectrumcomputing.co.uk/forums/viewtopic.php?t=11092 ...
User avatar
ParadigmShifter
Manic Miner
Posts: 670
Joined: Sat Sep 09, 2023 4:55 am

Re: Tiling challenge

Post by ParadigmShifter »

Any repeating pattern is fine, it just has to be attribs only.

Clearly the rules are already well known

https://en.wikipedia.org/wiki/Wallpaper_group

EDIT: Your link just takes me to an empty page though
User avatar
Stefan
Manic Miner
Posts: 809
Joined: Mon Nov 13, 2017 9:51 pm
Location: Belgium
Contact:

Re: Tiling challenge

Post by Stefan »

ParadigmShifter wrote: Fri Mar 29, 2024 10:13 am EDIT: Your link just takes me to an empty page though
It was trying to get to viewtopic.php?t=11092
User avatar
ParadigmShifter
Manic Miner
Posts: 670
Joined: Sat Sep 09, 2023 4:55 am

Re: Tiling challenge

Post by ParadigmShifter »

Ok I have read that.

I'm just looking for more interesting background patterns for my columns game engine

Image

EDIT: I'd also like a random number generator with period 18x24 = 432 of course so I can do a nice dissolve effect but I'm not sure if I will be able to find one which hits every attribute square once... am looking though.

Of course I can just use a PRNG with a longer period and skip tiles I have already dissolved. I'd use that for a transition effect between more than 1 background pattern (when level increases etc.).

I'm also planning to do non tiled backgrounds that just animate (so fire effect and so on) like this

https://www.hanshq.net/fire.html

not sure how that will look with such a low resolution and limited colours though ;)

Might do a Conway's game of life or a snake or a pong background that animates as well :)
Last edited by ParadigmShifter on Fri Mar 29, 2024 11:08 am, edited 1 time in total.
User avatar
Stefan
Manic Miner
Posts: 809
Joined: Mon Nov 13, 2017 9:51 pm
Location: Belgium
Contact:

Re: Tiling challenge

Post by Stefan »

How about a live attribute version of a portion of the tiles? This portion could also move and sway around 'magnifying' different areas inducing sea sickness?
User avatar
ParadigmShifter
Manic Miner
Posts: 670
Joined: Sat Sep 09, 2023 4:55 am

Re: Tiling challenge

Post by ParadigmShifter »

Yeah I am planning to animate as per my edit to previous post. Simple colour cycling at first then get weirder as you go on.

I'll use a lookup table to map indices to colours and if they only use 4 colours I can compress each into 2 bits (worst case is 16 colours - well 15) which packs into 4 bits.

EDIT: As mentioned in post #1 it's always possible to colour regions with neighbours having a different colour with only 4 colours although I think limiting the tiling to just 4 colours might be a bit restrictive. https://en.wikipedia.org/wiki/Four_color_theorem EDIT: I'm not going to set that as an exercise as a proof like some teacher did in the early 20th century, they needed a large computer to check the proof in the 70s ;)

Proof 5 colours are sufficient isn't too hard though... Numberphile did a video on it



Probably want at least 40 variations, there's only 5 tile types so it should not be hard to play for a long time so I'll need at least 40 backgrounds before they repeat I think.

EDIT: Current plan for animating is have a list of at most 64 attribs which change per frame and there will be a call which is done to generate the list of tiles to change at the end of each frame.

EDIT2: Non rectangular regions I am fine with as well by the way... just want some interesting backgrounds. L shapes are obviously good for tiling.
User avatar
ParadigmShifter
Manic Miner
Posts: 670
Joined: Sat Sep 09, 2023 4:55 am

Re: Tiling challenge

Post by ParadigmShifter »

Found the theorem that allows you to have a sequence that doesn't repeat and covers every number in the range, it's the Hull-Dobell theorem

If you have an LCG generator i.e.

x(n+1) = (a * x(n) + c) mod m

then this will have period m if and only if:

1. m and c are coprime
2. a-1 is divisible by all prime factors of m
3. a-1 is divisible by 4 if m is divisible by 4

So I can get a period 432 sequence by picking say

m = 432 = 2*2*2*2 * 3*3*3 so prime factors are 2 and 3, and it's divisible by 4
c = something coprime to 432 i.e. one of {415, 419, 421, 425, 427, 431, 433, 437, 439, 443} EDIT: There's more than that though, that's just what WolframAlpha gave as the first result, can keep hitting the "more" button here https://www.wolframalpha.com/input?i=in ... ime+to+432 only numbers c < 432 give different results obviously because of the modulus
a = 205 (204 is divisible by 2 and 3 i.e. a multiple of 6), and 204 is divisible by 4 since m is also divisible by 4, so a-1 has to be divisible by 12. So anything of the form a = 1 + 12n will do.

Some a and c are worse than others though (or better?) in that you see stripes, which might look ok for a swipe/dissolve effect.

I might still use 512 as the period and ignore anything >= 432 though since that is easy to do with bitwise AND.

BASIC code to test

Image
Post Reply