1
\$\begingroup\$

How do you create a random grid where the lines aren't orthogonal (and cells aren't a perfect square), but are warped?

Here's an example of what I mean: Warped Grid

(Credit: screenshot taken from a video by Silvarret about the game Townscaper.)

Lines curve. Sometimes many cells come together in a single point. Yet, it still looks like a grid and the cells are clearly visible and roughly equal in size and shape.

I have absolutely no clue how to go about something like this. How is this achieved? Is there an algorithm for this? How would you detect the cell over which the mouse hovers?

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Oskar Stålberg has shown and explained the algorithm in his tweets - have you run into any trouble applying this to your case? \$\endgroup\$ Commented Jul 9, 2020 at 15:01
  • \$\begingroup\$ Oh my, how did I miss that! Yes, that explains everything for me, thanks a lot! (I've been searching for terms like "warped grid", never finding anything, but apparantly the magic word was "quadrangulations".) Now I don't know what to do with this question - should I keep it online? \$\endgroup\$ Commented Jul 9, 2020 at 15:32
  • 1
    \$\begingroup\$ You could write a step-by-step breakdown of the algorithm as you understand it and post it as an Answer below. \$\endgroup\$ Commented Jul 9, 2020 at 15:34

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.