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

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
BlueThumbDevelopment
Prole
Posts: 7
Joined: Mon Jan 21, 2019 5:36 pm
Contact:

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

Post 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
Attachments
islands.zip
(1.41 KiB) Downloaded 127 times
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

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

Post by ReFreezed »

Are you maybe drawing outside the 5000x5000 canvas? I don't see any other limits in the code.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
User avatar
pgimeno
Party member
Posts: 3656
Joined: Sun Oct 18, 2015 2:58 pm

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

Post 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
BlueThumbDevelopment
Prole
Posts: 7
Joined: Mon Jan 21, 2019 5:36 pm
Contact:

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

Post 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 😀
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 4 guests