Page 1 of 1

"Islands" not being generated after certain x/y value

Posted: Sat Feb 02, 2019 4:20 pm
by BlueThumbDevelopment
So I've been messing around with island generation and i do have on that works. However if I try and generate an island after certain x and y values it says it generated but does not draw on screen? I do not know if I have accidentally made a limiting factor for x/y values perhaps?

Feel free to request code or have a look at the code (generation is in noise.lua)

I've tried to fix this for god knows how long and I'm in need of help :3

Re: "Islands" not being generated after certain x/y value

Posted: Sat Feb 02, 2019 7:55 pm
by ReFreezed
Are you maybe drawing outside the 5000x5000 canvas? I don't see any other limits in the code.

Re: "Islands" not being generated after certain x/y value

Posted: Sat Feb 02, 2019 8:09 pm
by pgimeno
The # operator isn't guaranteed to work unless the arrays start in 1. I think LuaJIT is more forgiving about not starting exactly with 1, but not as much as 1000 times more forgiving.

The problem seems to be in the iteration limit for the drawing loop. Changing it to this worked for me:

Code: Select all

                for x = island.x, island.x + size do
                        for y = island.y, island.y + size do

Re: "Islands" not being generated after certain x/y value

Posted: Sun Feb 03, 2019 12:31 am
by BlueThumbDevelopment
pgimeno wrote: Sat Feb 02, 2019 8:09 pm The # operator isn't guaranteed to work unless the arrays start in 1. I think LuaJIT is more forgiving about not starting exactly with 1, but not as much as 1000 times more forgiving.

The problem seems to be in the iteration limit for the drawing loop. Changing it to this worked for me:

Code: Select all

                for x = island.x, island.x + size do
                        for y = island.y, island.y + size do
Okay pgimeno, I'll give it a try in the morning! Thanks for giving me a hand 😀